X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fcodebook.h;h=efaa1b0a790ab9531f7c7ba2ef2308758e1ae1d7;hb=2d0dc6a37ab741b09404599b885bdd7882d382a7;hp=4104f4a44ac8143459cf555ecb386475ac3a0d8d;hpb=939a038b6faf62b95d599e72564498c71db4b2af;p=platform%2Fupstream%2Flibvorbis.git diff --git a/lib/codebook.h b/lib/codebook.h index 4104f4a..efaa1b0 100644 --- a/lib/codebook.h +++ b/lib/codebook.h @@ -5,20 +5,20 @@ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * - * by the XIPHOPHORUS Company http://www.xiph.org/ * - + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * + * by the Xiph.Org Foundation http://www.xiph.org/ * + * * ******************************************************************** function: basic shared codebook operations - last mod: $Id: codebook.h,v 1.6 2001/05/27 06:43:59 xiphmont Exp $ + last mod: $Id$ ********************************************************************/ #ifndef _V_CODEBOOK_H_ #define _V_CODEBOOK_H_ -#include "ogg/ogg.h" +#include /* This structure encapsulates huffman and VQ style encoding books; it doesn't do anything specific to either. @@ -40,8 +40,8 @@ typedef struct static_codebook{ /* mapping ***************************************************************/ int maptype; /* 0=none - 1=implicitly populated values from map column - 2=listed arbitrary values */ + 1=implicitly populated values from map column + 2=listed arbitrary values */ /* The below does a linear, single monotonic sequence mapping. */ long q_min; /* packed 32 bit float; quant value 0 maps to minval */ @@ -50,81 +50,41 @@ typedef struct static_codebook{ int q_sequencep; /* bitflag */ long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map - map == 2: list of dim*entries quantized entry vals - */ - - /* encode helpers ********************************************************/ - struct encode_aux_nearestmatch *nearest_tree; - struct encode_aux_threshmatch *thresh_tree; - struct encode_aux_pigeonhole *pigeon_tree; - + map == 2: list of dim*entries quantized entry vals + */ int allocedp; } static_codebook; -/* this structures an arbitrary trained book to quickly find the - nearest cell match */ -typedef struct encode_aux_nearestmatch{ - /* pre-calculated partitioning tree */ - long *ptr0; - long *ptr1; - - long *p; /* decision points (each is an entry) */ - long *q; /* decision points (each is an entry) */ - long aux; /* number of tree entries */ - long alloc; -} encode_aux_nearestmatch; - -/* assumes a maptype of 1; encode side only, so that's OK */ -typedef struct encode_aux_threshmatch{ - float *quantthresh; - long *quantmap; - int quantvals; - int threshvals; -} encode_aux_threshmatch; - -typedef struct encode_aux_pigeonhole{ - float min; - float del; - - int mapentries; - int quantvals; - long *pigeonmap; - - long fittotal; - long *fitlist; - long *fitmap; - long *fitlength; -} encode_aux_pigeonhole; - -typedef struct decode_aux{ - long *tab; - int *tabl; - int tabn; - - long *ptr0; - long *ptr1; - long aux; /* number of tree entries */ -} decode_aux; - typedef struct codebook{ long dim; /* codebook dimensions (elements per vector) */ long entries; /* codebook entries */ + long used_entries; /* populated codebook entries */ const static_codebook *c; - float *valuelist; /* list of dim*entries actual entry values */ - long *codelist; /* list of bitstream codewords for each entry */ - struct decode_aux *decode_tree; - - long zeroentry; + /* for encode, the below are entry-ordered, fully populated */ + /* for decode, the below are ordered by bitreversed codeword and only + used entries are populated */ + float *valuelist; /* list of dim*entries actual entry values */ + ogg_uint32_t *codelist; /* list of bitstream codewords for each entry */ + + int *dec_index; /* only used if sparseness collapsed */ + char *dec_codelengths; + ogg_uint32_t *dec_firsttable; + int dec_firsttablen; + int dec_maxlength; + + /* The current encoder uses only centered, integer-only lattice books. */ + int quantvals; + int minval; + int delta; } codebook; -extern void vorbis_staticbook_clear(static_codebook *b); extern void vorbis_staticbook_destroy(static_codebook *b); extern int vorbis_book_init_encode(codebook *dest,const static_codebook *source); extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source); extern void vorbis_book_clear(codebook *b); -extern float *_book_unquantize(const static_codebook *b); +extern float *_book_unquantize(const static_codebook *b,int n,int *map); extern float *_book_logdist(const static_codebook *b,float *vals); extern float _float32_unpack(long val); extern long _float32_pack(float val); @@ -139,22 +99,20 @@ extern long vorbis_book_codelen(codebook *book,int entry); extern int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *b); -extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c); +extern static_codebook *vorbis_staticbook_unpack(oggpack_buffer *b); extern int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b); -extern int vorbis_book_errorv(codebook *book, float *a); -extern int vorbis_book_encodev(codebook *book, int best,float *a, - oggpack_buffer *b); -extern int vorbis_book_encodevs(codebook *book, float *a, oggpack_buffer *b, - int step,int stagetype); extern long vorbis_book_decode(codebook *book, oggpack_buffer *b); -extern long vorbis_book_decodevs(codebook *book, float *a, oggpack_buffer *b, - int step,int stagetype); -extern long s_vorbis_book_decodevs(codebook *book, float *a, oggpack_buffer *b, - int step,int stagetype); -extern long s_vorbis_book_decodev(codebook *book, float *a, oggpack_buffer *b, - int partsize,int stagetype); +extern long vorbis_book_decodevs_add(codebook *book, float *a, + oggpack_buffer *b,int n); +extern long vorbis_book_decodev_set(codebook *book, float *a, + oggpack_buffer *b,int n); +extern long vorbis_book_decodev_add(codebook *book, float *a, + oggpack_buffer *b,int n); +extern long vorbis_book_decodevv_add(codebook *book, float **a, + long off,int ch, + oggpack_buffer *b,int n);