decint.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /********************************************************************
  2. * *
  3. * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
  4. * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
  5. * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  6. * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
  7. * *
  8. * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009 *
  9. * by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
  10. * *
  11. ********************************************************************
  12. function:
  13. last mod: $Id: decint.h 16503 2009-08-22 18:14:02Z giles $
  14. ********************************************************************/
  15. #include <limits.h>
  16. #if !defined(_decint_H)
  17. # define _decint_H (1)
  18. # include "theora/theoradec.h"
  19. # include "internal.h"
  20. # include "bitpack.h"
  21. typedef struct th_setup_info oc_setup_info;
  22. typedef struct th_dec_ctx oc_dec_ctx;
  23. # include "huffdec.h"
  24. # include "dequant.h"
  25. /*Constants for the packet-in state machine specific to the decoder.*/
  26. /*Next packet to read: Data packet.*/
  27. #define OC_PACKET_DATA (0)
  28. struct th_setup_info{
  29. /*The Huffman codes.*/
  30. oc_huff_node *huff_tables[TH_NHUFFMAN_TABLES];
  31. /*The quantization parameters.*/
  32. th_quant_info qinfo;
  33. };
  34. struct th_dec_ctx{
  35. /*Shared encoder/decoder state.*/
  36. oc_theora_state state;
  37. /*Whether or not packets are ready to be emitted.
  38. This takes on negative values while there are remaining header packets to
  39. be emitted, reaches 0 when the codec is ready for input, and goes to 1
  40. when a frame has been processed and a data packet is ready.*/
  41. int packet_state;
  42. /*Buffer in which to assemble packets.*/
  43. oc_pack_buf opb;
  44. /*Huffman decode trees.*/
  45. oc_huff_node *huff_tables[TH_NHUFFMAN_TABLES];
  46. /*The index of the first token in each plane for each coefficient.*/
  47. ptrdiff_t ti0[3][64];
  48. /*The number of outstanding EOB runs at the start of each coefficient in each
  49. plane.*/
  50. ptrdiff_t eob_runs[3][64];
  51. /*The DCT token lists.*/
  52. unsigned char *dct_tokens;
  53. /*The extra bits associated with DCT tokens.*/
  54. unsigned char *extra_bits;
  55. /*The number of dct tokens unpacked so far.*/
  56. int dct_tokens_count;
  57. /*The out-of-loop post-processing level.*/
  58. int pp_level;
  59. /*The DC scale used for out-of-loop deblocking.*/
  60. int pp_dc_scale[64];
  61. /*The sharpen modifier used for out-of-loop deringing.*/
  62. int pp_sharp_mod[64];
  63. /*The DC quantization index of each block.*/
  64. unsigned char *dc_qis;
  65. /*The variance of each block.*/
  66. int *variances;
  67. /*The storage for the post-processed frame buffer.*/
  68. unsigned char *pp_frame_data;
  69. /*Whether or not the post-processsed frame buffer has space for chroma.*/
  70. int pp_frame_state;
  71. /*The buffer used for the post-processed frame.
  72. Note that this is _not_ guaranteed to have the same strides and offsets as
  73. the reference frame buffers.*/
  74. th_ycbcr_buffer pp_frame_buf;
  75. /*The striped decode callback function.*/
  76. th_stripe_callback stripe_cb;
  77. # if defined(HAVE_CAIRO)
  78. /*Output metrics for debugging.*/
  79. int telemetry;
  80. int telemetry_mbmode;
  81. int telemetry_mv;
  82. int telemetry_qi;
  83. int telemetry_bits;
  84. int telemetry_frame_bytes;
  85. int telemetry_coding_bytes;
  86. int telemetry_mode_bytes;
  87. int telemetry_mv_bytes;
  88. int telemetry_qi_bytes;
  89. int telemetry_dc_bytes;
  90. unsigned char *telemetry_frame_data;
  91. # endif
  92. };
  93. #endif