codebook.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /************************************************************************
  2. * Copyright (C) 2002-2009, Xiph.org Foundation
  3. * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * * Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * * Redistributions in binary form must reproduce the above
  13. * copyright notice, this list of conditions and the following disclaimer
  14. * in the documentation and/or other materials provided with the
  15. * distribution.
  16. * * Neither the names of the Xiph.org Foundation nor Pinknoise
  17. * Productions Ltd nor the names of its contributors may be used to
  18. * endorse or promote products derived from this software without
  19. * specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. ************************************************************************
  33. function: basic shared codebook operations
  34. ************************************************************************/
  35. #ifndef _V_CODEBOOK_H_
  36. #define _V_CODEBOOK_H_
  37. #include "ogg.h"
  38. typedef struct codebook{
  39. /* Top 15 used in ARM code */
  40. int dec_maxlength;
  41. void *dec_table;
  42. int dec_method;
  43. int dec_type; /* 0 = entry number
  44. 1 = packed vector of values
  45. 2 = packed vector of column offsets, maptype 1
  46. 3 = scalar offset into value array, maptype 2 */
  47. int q_bits;
  48. long dim; /* codebook dimensions (elements per vector) */
  49. int q_delp;
  50. int q_minp;
  51. ogg_int32_t q_del;
  52. ogg_int32_t q_min;
  53. int q_seq;
  54. int q_pack;
  55. void *q_val;
  56. long used_entries; /* populated codebook entries */
  57. ogg_int32_t *dec_buf;
  58. /* C only */
  59. int dec_nodeb;
  60. int dec_leafw;
  61. long entries; /* codebook entries */
  62. } codebook;
  63. extern void vorbis_book_clear(codebook *b);
  64. extern int vorbis_book_unpack(oggpack_buffer *b,codebook *c);
  65. extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
  66. extern long vorbis_book_decodevs_add(codebook *book, ogg_int32_t *a,
  67. oggpack_buffer *b,int n,int point);
  68. extern long vorbis_book_decodev_set(codebook *book, ogg_int32_t *a,
  69. oggpack_buffer *b,int n,int point);
  70. extern long vorbis_book_decodev_add(codebook *book, ogg_int32_t *a,
  71. oggpack_buffer *b,int n,int point);
  72. extern long vorbis_book_decodevv_add(codebook *book, ogg_int32_t **a,
  73. long off,int ch,
  74. oggpack_buffer *b,int n,int point);
  75. extern int _ilog(unsigned int v);
  76. #endif