codebook.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /********************************************************************
  2. * *
  3. * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
  4. * *
  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 OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
  10. * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
  11. * *
  12. ********************************************************************
  13. function: basic shared codebook operations
  14. ********************************************************************/
  15. #ifndef _V_CODEBOOK_H_
  16. #define _V_CODEBOOK_H_
  17. #include "ogg.h"
  18. typedef struct codebook{
  19. long dim; /* codebook dimensions (elements per vector) */
  20. long entries; /* codebook entries */
  21. long used_entries; /* populated codebook entries */
  22. int dec_maxlength;
  23. void *dec_table;
  24. int dec_nodeb;
  25. int dec_leafw;
  26. int dec_type; /* 0 = entry number
  27. 1 = packed vector of values
  28. 2 = packed vector of column offsets, maptype 1
  29. 3 = scalar offset into value array, maptype 2 */
  30. ogg_int32_t q_min;
  31. int q_minp;
  32. ogg_int32_t q_del;
  33. int q_delp;
  34. int q_seq;
  35. int q_bits;
  36. int q_pack;
  37. void *q_val;
  38. } codebook;
  39. extern void vorbis_book_clear(codebook *b);
  40. extern int vorbis_book_unpack(oggpack_buffer *b,codebook *c);
  41. extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
  42. extern long vorbis_book_decodevs_add(codebook *book, ogg_int32_t *a,
  43. oggpack_buffer *b,int n,int point);
  44. extern long vorbis_book_decodev_set(codebook *book, ogg_int32_t *a,
  45. oggpack_buffer *b,int n,int point);
  46. extern long vorbis_book_decodev_add(codebook *book, ogg_int32_t *a,
  47. oggpack_buffer *b,int n,int point);
  48. extern long vorbis_book_decodevv_add(codebook *book, ogg_int32_t **a,
  49. long off,int ch,
  50. oggpack_buffer *b,int n,int point);
  51. extern int _ilog(unsigned int v);
  52. #endif