huffdec.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* SPDX-License-Identifier: LGPL-2.1 OR BSD-3-Clause */
  2. /********************************************************************
  3. * *
  4. * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE. *
  5. * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
  6. * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  7. * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
  8. * *
  9. * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009 *
  10. * by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
  11. * *
  12. ********************************************************************
  13. function:
  14. last mod: $Id: huffdec.h 17410 2010-09-21 21:53:48Z tterribe $
  15. ********************************************************************/
  16. #if !defined(_huffdec_H)
  17. # define _huffdec_H (1)
  18. # include "bitpack.h"
  19. /*The range of valid quantized DCT coefficient values.
  20. VP3 used 511 in the encoder, but the bitstream is capable of 580.*/
  21. #define OC_DCT_VAL_RANGE (580)
  22. #define OC_NDCT_TOKEN_BITS (5)
  23. #define OC_DCT_EOB1_TOKEN (0)
  24. #define OC_DCT_EOB2_TOKEN (1)
  25. #define OC_DCT_EOB3_TOKEN (2)
  26. #define OC_DCT_REPEAT_RUN0_TOKEN (3)
  27. #define OC_DCT_REPEAT_RUN1_TOKEN (4)
  28. #define OC_DCT_REPEAT_RUN2_TOKEN (5)
  29. #define OC_DCT_REPEAT_RUN3_TOKEN (6)
  30. #define OC_DCT_SHORT_ZRL_TOKEN (7)
  31. #define OC_DCT_ZRL_TOKEN (8)
  32. #define OC_ONE_TOKEN (9)
  33. #define OC_MINUS_ONE_TOKEN (10)
  34. #define OC_TWO_TOKEN (11)
  35. #define OC_MINUS_TWO_TOKEN (12)
  36. #define OC_DCT_VAL_CAT2 (13)
  37. #define OC_DCT_VAL_CAT3 (17)
  38. #define OC_DCT_VAL_CAT4 (18)
  39. #define OC_DCT_VAL_CAT5 (19)
  40. #define OC_DCT_VAL_CAT6 (20)
  41. #define OC_DCT_VAL_CAT7 (21)
  42. #define OC_DCT_VAL_CAT8 (22)
  43. #define OC_DCT_RUN_CAT1A (23)
  44. #define OC_DCT_RUN_CAT1B (28)
  45. #define OC_DCT_RUN_CAT1C (29)
  46. #define OC_DCT_RUN_CAT2A (30)
  47. #define OC_DCT_RUN_CAT2B (31)
  48. #define OC_NDCT_EOB_TOKEN_MAX (7)
  49. #define OC_NDCT_ZRL_TOKEN_MAX (9)
  50. #define OC_NDCT_VAL_MAX (23)
  51. #define OC_NDCT_VAL_CAT1_MAX (13)
  52. #define OC_NDCT_VAL_CAT2_MAX (17)
  53. #define OC_NDCT_VAL_CAT2_SIZE (OC_NDCT_VAL_CAT2_MAX-OC_DCT_VAL_CAT2)
  54. #define OC_NDCT_RUN_MAX (32)
  55. #define OC_NDCT_RUN_CAT1A_MAX (28)
  56. extern const unsigned char OC_DCT_TOKEN_EXTRA_BITS[TH_NDCT_TOKENS];
  57. int32_t oc_huff_trees_unpack(oc_pack_buf *_opb,int16_t *_nodes[TH_NHUFFMAN_TABLES]);
  58. int32_t oc_huff_trees_copy(int16_t *_dst[TH_NHUFFMAN_TABLES], const int16_t *const _src[TH_NHUFFMAN_TABLES]);
  59. void oc_huff_trees_clear(int16_t *_nodes[TH_NHUFFMAN_TABLES]);
  60. int32_t oc_huff_token_decode_c(oc_pack_buf *_opb,const int16_t *_node);
  61. #endif