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 34 function: basic shared codebook operations 35 36 ************************************************************************/ 37 38 #ifndef _V_CODEBOOK_H_ 39 #define _V_CODEBOOK_H_ 40 41 #include "ogg.h" 42 43 typedef struct codebook{ 44 /* Top 15 used in ARM code */ 45 int dec_maxlength; 46 void *dec_table; 47 int dec_method; 48 int dec_type; /* 0 = entry number 49 1 = packed vector of values 50 2 = packed vector of column offsets, maptype 1 51 3 = scalar offset into value array, maptype 2 */ 52 int q_bits; 53 long dim; /* codebook dimensions (elements per vector) */ 54 int q_delp; 55 int q_minp; 56 ogg_int32_t q_del; 57 ogg_int32_t q_min; 58 int q_seq; 59 int q_pack; 60 void *q_val; 61 long used_entries; /* populated codebook entries */ 62 ogg_int32_t *dec_buf; 63 64 /* C only */ 65 int dec_nodeb; 66 int dec_leafw; 67 68 long entries; /* codebook entries */ 69 70 } codebook; 71 72 extern void vorbis_book_clear(codebook *b); 73 extern int vorbis_book_unpack(oggpack_buffer *b,codebook *c); 74 75 extern long vorbis_book_decode(codebook *book, oggpack_buffer *b); 76 extern long vorbis_book_decodevs_add(codebook *book, ogg_int32_t *a, 77 oggpack_buffer *b,int n,int point); 78 extern long vorbis_book_decodev_set(codebook *book, ogg_int32_t *a, 79 oggpack_buffer *b,int n,int point); 80 extern long vorbis_book_decodev_add(codebook *book, ogg_int32_t *a, 81 oggpack_buffer *b,int n,int point); 82 extern long vorbis_book_decodevv_add(codebook *book, ogg_int32_t **a, 83 long off,int ch, 84 oggpack_buffer *b,int n,int point); 85 86 extern int _ilog(unsigned int v); 87 88 89 #endif 90