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