decint.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* SPDX-License-Identifier: LGPL-2.1 OR BSD-3-Clause */
  2. /********************************************************************
  3. Copyright (C) 2002-2009 Xiph.org Foundation
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions
  6. are met:
  7. - Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. - Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in the
  11. documentation and/or other materials provided with the distribution.
  12. - Neither the name of the Xiph.org Foundation nor the names of its
  13. contributors may be used to endorse or promote products derived from
  14. this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  16. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  17. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  18. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
  19. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  20. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  21. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  25. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. ********************************************************************/
  27. #include <limits.h>
  28. #if !defined(_decint_H)
  29. # define _decint_H (1)
  30. # include "theoradec.h"
  31. # include "state.h"
  32. # include "bitpack.h"
  33. # include "huffdec.h"
  34. # include "dequant.h"
  35. typedef struct th_setup_info oc_setup_info;
  36. typedef struct th_dec_ctx oc_dec_ctx;
  37. /*Next packet to read: Data packet.*/
  38. #define OC_PACKET_DATA (0)
  39. struct th_setup_info
  40. {
  41. /*The Huffman codes.*/
  42. int16_t *huff_tables[TH_NHUFFMAN_TABLES];
  43. /*The quantization parameters.*/
  44. th_quant_info qinfo;
  45. };
  46. struct th_dec_ctx
  47. {
  48. /*Shared encoder/decoder state.*/
  49. oc_theora_state state;
  50. /*Whether or not packets are ready to be emitted.
  51. This takes on negative values while there are remaining header packets to
  52. be emitted, reaches 0 when the codec is ready for input, and goes to 1
  53. when a frame has been processed and a data packet is ready.*/
  54. int32_t packet_state;
  55. /*Buffer in which to assemble packets.*/
  56. oc_pack_buf opb;
  57. /*Huffman decode trees.*/
  58. int16_t *huff_tables[TH_NHUFFMAN_TABLES];
  59. /*The index of the first token in each plane for each coefficient.*/
  60. int32_t ti0[3][64];
  61. /*The number of outstanding EOB runs at the start of each coefficient in each
  62. plane.*/
  63. int32_t eob_runs[3][64];
  64. /*The DCT token lists.*/
  65. unsigned char *dct_tokens;
  66. /*The extra bits associated with DCT tokens.*/
  67. unsigned char *extra_bits;
  68. /*The number of dct tokens unpacked so far.*/
  69. int32_t dct_tokens_count;
  70. /*The DC scale used for out-of-loop deblocking.*/
  71. int32_t pp_dc_scale[64];
  72. /*The sharpen modifier used for out-of-loop deringing.*/
  73. int32_t pp_sharp_mod[64];
  74. };
  75. #endif