diff options
author | Monty <xiphmont@xiph.org> | 2001-12-18 23:49:24 +0000 |
---|---|---|
committer | Monty <xiphmont@xiph.org> | 2001-12-18 23:49:24 +0000 |
commit | 30dbeaa12a8d0c5ce34308c06cf521bf55771ab1 (patch) | |
tree | 0d9592492a990673268765b438fb0a9a83032719 | |
parent | 29c8c8cf5b1b1993efb436ea3a493138af336bc5 (diff) | |
download | libvorbis-git-30dbeaa12a8d0c5ce34308c06cf521bf55771ab1.tar.gz |
Fixed numerous typos; all rc3 books build
svn path=/branches/branch_monty_20011217/vorbis/; revision=2819
33 files changed, 4891 insertions, 288 deletions
diff --git a/examples/encoder_example.c b/examples/encoder_example.c new file mode 100644 index 00000000..78582a0b --- /dev/null +++ b/examples/encoder_example.c @@ -0,0 +1,218 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * 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/ * + + ******************************************************************** + + function: simple example encoder + last mod: $Id: encoder_example.c,v 1.28.2.1 2001/12/18 23:49:15 xiphmont Exp $ + + ********************************************************************/ + +/* takes a stereo 16bit 44.1kHz WAV file from stdin and encodes it into + a Vorbis bitstream */ + +/* Note that this is POSIX, not ANSI, code */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <math.h> +#include <vorbis/vorbisenc.h> + +#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */ +#include <io.h> +#include <fcntl.h> +#endif + +#if defined(macintosh) && defined(__MWERKS__) +#include <console.h> /* CodeWarrior's Mac "command-line" support */ +#endif + +#define READ 1024 +signed char readbuffer[READ*4+44]; /* out of the data segment, not the stack */ + +int main(){ + ogg_stream_state os; /* take physical pages, weld into a logical + stream of packets */ + ogg_page og; /* one Ogg bitstream page. Vorbis packets are inside */ + ogg_packet op; /* one raw packet of data for decode */ + + vorbis_info vi; /* struct that stores all the static vorbis bitstream + settings */ + vorbis_comment vc; /* struct that stores all the user comments */ + + vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */ + vorbis_block vb; /* local working space for packet->PCM decode */ + + int eos=0; + int i, founddata; + +#if defined(macintosh) && defined(__MWERKS__) + int argc = 0; + char **argv = NULL; + argc = ccommand(&argv); /* get a "command line" from the Mac user */ + /* this also lets the user set stdin and stdout */ +#endif + + /* we cheat on the WAV header; we just bypass 44 bytes and never + verify that it matches 16bit/stereo/44.1kHz. This is just an + example, after all. */ + +#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */ + /* Beware the evil ifdef. We avoid these where we can, but this one we + cannot. Don't add any more, you'll probably go to hell if you do. */ + _setmode( _fileno( stdin ), _O_BINARY ); + _setmode( _fileno( stdout ), _O_BINARY ); +#endif + + /* we cheat on the WAV header; we just bypass the header and never + verify that it matches 16bit/stereo/44.1kHz. This is just an + example, after all. */ + + readbuffer[0] = '\0'; + for (i=0, founddata=0; i<30 && ! feof(stdin) && ! ferror(stdin); i++) + { + fread(readbuffer,1,2,stdin); + + if ( ! strncmp(readbuffer, "da", 2) ) + { + founddata = 1; + fread(readbuffer,1,6,stdin); + break; + } + } + + /********** Encode setup ************/ + + /* choose an encoding mode */ + /* (mode 0: 44kHz stereo uncoupled, roughly 128kbps VBR) */ + vorbis_info_init(&vi); + + vorbis_encode_init_vbr(&vi,2,44100,.4); + + /* add a comment */ + vorbis_comment_init(&vc); + vorbis_comment_add(&vc,"ENCODER=encoder_example.c"); + + /* set up the analysis state and auxiliary encoding storage */ + vorbis_analysis_init(&vd,&vi); + vorbis_block_init(&vd,&vb); + + /* set up our packet->stream encoder */ + /* pick a random serial number; that way we can more likely build + chained streams just by concatenation */ + srand(time(NULL)); + ogg_stream_init(&os,rand()); + + /* Vorbis streams begin with three headers; the initial header (with + most of the codec setup parameters) which is mandated by the Ogg + bitstream spec. The second header holds any comment fields. The + third header holds the bitstream codebook. We merely need to + make the headers, then pass them to libvorbis one at a time; + libvorbis handles the additional Ogg bitstream constraints */ + + { + ogg_packet header; + ogg_packet header_comm; + ogg_packet header_code; + + vorbis_analysis_headerout(&vd,&vc,&header,&header_comm,&header_code); + ogg_stream_packetin(&os,&header); /* automatically placed in its own + page */ + ogg_stream_packetin(&os,&header_comm); + ogg_stream_packetin(&os,&header_code); + + /* We don't have to write out here, but doing so makes streaming + * much easier, so we do, flushing ALL pages. This ensures the actual + * audio data will start on a new page + */ + while(!eos){ + int result=ogg_stream_flush(&os,&og); + if(result==0)break; + fwrite(og.header,1,og.header_len,stdout); + fwrite(og.body,1,og.body_len,stdout); + } + + } + + while(!eos){ + long i; + long bytes=fread(readbuffer,1,READ*4,stdin); /* stereo hardwired here */ + + if(bytes==0){ + /* end of file. this can be done implicitly in the mainline, + but it's easier to see here in non-clever fashion. + Tell the library we're at end of stream so that it can handle + the last frame and mark end of stream in the output properly */ + vorbis_analysis_wrote(&vd,0); + + }else{ + /* data to encode */ + + /* expose the buffer to submit data */ + float **buffer=vorbis_analysis_buffer(&vd,READ); + + /* uninterleave samples */ + for(i=0;i<bytes/4;i++){ + buffer[0][i]=((readbuffer[i*4+1]<<8)| + (0x00ff&(int)readbuffer[i*4]))/32768.f; + buffer[1][i]=((readbuffer[i*4+3]<<8)| + (0x00ff&(int)readbuffer[i*4+2]))/32768.f; + } + + /* tell the library how much we actually submitted */ + vorbis_analysis_wrote(&vd,i); + } + + /* vorbis does some data preanalysis, then divvies up blocks for + more involved (potentially parallel) processing. Get a single + block for encoding now */ + while(vorbis_analysis_blockout(&vd,&vb)==1){ + + /* analysis, assume we want to use bitrate management */ + vorbis_analysis(&vb,NULL); + vorbis_bitrate_addblock(&vb); + + while(vorbis_bitrate_flushpacket(&vd,&op)){ + + /* weld the packet into the bitstream */ + ogg_stream_packetin(&os,&op); + + /* write out pages (if any) */ + while(!eos){ + int result=ogg_stream_pageout(&os,&og); + if(result==0)break; + fwrite(og.header,1,og.header_len,stdout); + fwrite(og.body,1,og.body_len,stdout); + + /* this could be set above, but for illustrative purposes, I do + it here (to show that vorbis does know where the stream ends) */ + + if(ogg_page_eos(&og))eos=1; + } + } + } + } + + /* clean up and exit. vorbis_info_clear() must be called last */ + + ogg_stream_clear(&os); + vorbis_block_clear(&vb); + vorbis_dsp_clear(&vd); + vorbis_comment_clear(&vc); + vorbis_info_clear(&vi); + + /* ogg_page and ogg_packet structs always point to storage in + libvorbis. They're never freed or manipulated directly */ + + fprintf(stderr,"Done.\n"); + return(0); +} diff --git a/lib/Makefile b/lib/Makefile index 80ee0579..3a77ab6e 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -123,7 +123,7 @@ CONFIG_CLEAN_FILES = LTLIBRARIES = $(lib_LTLIBRARIES) -DEFS = -DPACKAGE=\"libvorbis\" -DVERSION=\"1.0rc3\" -DHAVE_DLFCN_H=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DHAVE_SQRTF=1 -DHAVE_LOGF=1 -DHAVE_EXPF=1 -DHAVE_ACOSF=1 -DHAVE_ATANF=1 -DHAVE_FREXPF=1 -DHAVE_RINTF=1 -I. -I$(srcdir) +DEFS = -DPACKAGE=\"libvorbis\" -DVERSION=\"1.0rc3\" -DHAVE_DLFCN_H=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DHAVE_SQRTF=1 -DHAVE_LOGF=1 -DHAVE_EXPF=1 -DHAVE_ACOSF=1 -DHAVE_ATANF=1 -DHAVE_FREXPF=1 -DHAVE_RINTF=1 -I. -I$(srcdir) -DTRAIN_RES -DTRAIN_FLOOR1 CPPFLAGS = LDFLAGS = libvorbis_la_LIBADD = diff --git a/lib/bitrate.c b/lib/bitrate.c index 0d5c8c67..2305b0e6 100644 --- a/lib/bitrate.c +++ b/lib/bitrate.c @@ -11,7 +11,7 @@ ******************************************************************** function: bitrate tracking and management - last mod: $Id: bitrate.c,v 1.3.2.1 2001/12/17 05:39:23 xiphmont Exp $ + last mod: $Id: bitrate.c,v 1.3.2.2 2001/12/18 23:49:16 xiphmont Exp $ ********************************************************************/ @@ -264,7 +264,7 @@ int vorbis_bitrate_addblock(vorbis_block *vb){ in use) are taken into account by the min/max limiter (if min/max is in use) */ if(bm->avg_binacc){ - long desired_center=bm->avg_centerdesired; + unsigned long desired_center=bm->avg_centerdesired; if(eofflag)desired_center=0; /* update the avg head */ @@ -335,13 +335,13 @@ int vorbis_bitrate_addblock(vorbis_block *vb){ if(bm->noisetrigger_postpone<=0){ if(bm->noisetrigger_request<0.){ bm->avgnoise-=1.f; - if(bm->noisetrigger_request<bm->avg_sampleacc/2) + if(bm->noisetrigger_request<(signed long)(bm->avg_sampleacc)/2) bm->avgnoise-=1.f; bm->noisetrigger_postpone=bm->avg_sampleacc/2; } if(bm->noisetrigger_request>0.){ bm->avgnoise+=1.f; - if(bm->noisetrigger_request>bm->avg_sampleacc/2) + if(bm->noisetrigger_request>(signed long)(bm->avg_sampleacc)/2) bm->avgnoise+=1.f; bm->noisetrigger_postpone=bm->avg_sampleacc/2; } @@ -373,10 +373,11 @@ int vorbis_bitrate_addblock(vorbis_block *vb){ /* update the min/max queues and enforce limits */ if(bm->minmax_binstack){ - long sampledesired=eofflag?0:bm->minmax_sampledesired; + unsigned long sampledesired=eofflag?0:bm->minmax_sampledesired; /* add to stack recent */ while(minmax_head!=new_minmax_head){ + unsigned int i; int samples=ci->blocksizes[bm->queue_actual[minmax_head]& 0x80000000UL?1:0]>>1; @@ -400,7 +401,7 @@ int vorbis_bitrate_addblock(vorbis_block *vb){ -bin+1 minmax[0] <-> floater limited to 1 limited to zero (val= -bin) is implicit */ - for(i=0;i<bins;i++){ + for(i=0;i<(unsigned int)bins;i++){ bm->minmax_binstack[bm->minmax_stackptr*bins*2+bins+i]+= LACING_ADJUST( BINBITS(minmax_head, diff --git a/lib/block.c b/lib/block.c new file mode 100644 index 00000000..0adf5a3e --- /dev/null +++ b/lib/block.c @@ -0,0 +1,822 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * 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/ * + + ******************************************************************** + + function: PCM data vector blocking, windowing and dis/reassembly + last mod: $Id: block.c,v 1.51.2.1 2001/12/18 23:49:16 xiphmont Exp $ + + Handle windowing, overlap-add, etc of the PCM vectors. This is made + more amusing by Vorbis' current two allowed block sizes. + + ********************************************************************/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ogg/ogg.h> +#include "vorbis/codec.h" +#include "codec_internal.h" + +#include "window.h" +#include "mdct.h" +#include "lpc.h" +#include "registry.h" +#include "misc.h" + +static int ilog2(unsigned int v){ + int ret=0; + while(v>1){ + ret++; + v>>=1; + } + return(ret); +} + +/* pcm accumulator examples (not exhaustive): + + <-------------- lW ----------------> + <--------------- W ----------------> +: .....|..... _______________ | +: .''' | '''_--- | |\ | +:.....''' |_____--- '''......| | \_______| +:.................|__________________|_______|__|______| + |<------ Sl ------>| > Sr < |endW + |beginSl |endSl | |endSr + |beginW |endlW |beginSr + + + |< lW >| + <--------------- W ----------------> + | | .. ______________ | + | | ' `/ | ---_ | + |___.'___/`. | ---_____| + |_______|__|_______|_________________| + | >|Sl|< |<------ Sr ----->|endW + | | |endSl |beginSr |endSr + |beginW | |endlW + mult[0] |beginSl mult[n] + + <-------------- lW -----------------> + |<--W-->| +: .............. ___ | | +: .''' |`/ \ | | +:.....''' |/`....\|...| +:.........................|___|___|___| + |Sl |Sr |endW + | | |endSr + | |beginSr + | |endSl + |beginSl + |beginW +*/ + +/* block abstraction setup *********************************************/ + +#ifndef WORD_ALIGN +#define WORD_ALIGN 8 +#endif + +int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){ + memset(vb,0,sizeof(*vb)); + vb->vd=v; + vb->localalloc=0; + vb->localstore=NULL; + if(v->analysisp){ + vorbis_block_internal *vbi= + vb->internal=_ogg_calloc(1,sizeof(vorbis_block_internal)); + oggpack_writeinit(&vb->opb); + vbi->ampmax=-9999; + vbi->packet_markers=_ogg_malloc(vorbis_bitrate_maxmarkers()* + sizeof(*vbi->packet_markers)); + } + + return(0); +} + +void *_vorbis_block_alloc(vorbis_block *vb,long bytes){ + bytes=(bytes+(WORD_ALIGN-1)) & ~(WORD_ALIGN-1); + if(bytes+vb->localtop>vb->localalloc){ + /* can't just _ogg_realloc... there are outstanding pointers */ + if(vb->localstore){ + struct alloc_chain *link=_ogg_malloc(sizeof(*link)); + vb->totaluse+=vb->localtop; + link->next=vb->reap; + link->ptr=vb->localstore; + vb->reap=link; + } + /* highly conservative */ + vb->localalloc=bytes; + vb->localstore=_ogg_malloc(vb->localalloc); + vb->localtop=0; + } + { + void *ret=(void *)(((char *)vb->localstore)+vb->localtop); + vb->localtop+=bytes; + return ret; + } +} + +/* reap the chain, pull the ripcord */ +void _vorbis_block_ripcord(vorbis_block *vb){ + /* reap the chain */ + struct alloc_chain *reap=vb->reap; + while(reap){ + struct alloc_chain *next=reap->next; + _ogg_free(reap->ptr); + memset(reap,0,sizeof(*reap)); + _ogg_free(reap); + reap=next; + } + /* consolidate storage */ + if(vb->totaluse){ + vb->localstore=_ogg_realloc(vb->localstore,vb->totaluse+vb->localalloc); + vb->localalloc+=vb->totaluse; + vb->totaluse=0; + } + + /* pull the ripcord */ + vb->localtop=0; + vb->reap=NULL; +} + +int vorbis_block_clear(vorbis_block *vb){ + if(vb->vd) + if(vb->vd->analysisp) + oggpack_writeclear(&vb->opb); + _vorbis_block_ripcord(vb); + if(vb->localstore)_ogg_free(vb->localstore); + + if(vb->internal){ + vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal; + if(vbi->packet_markers)_ogg_free(vbi->packet_markers); + + _ogg_free(vb->internal); + } + + memset(vb,0,sizeof(*vb)); + return(0); +} + +/* Analysis side code, but directly related to blocking. Thus it's + here and not in analysis.c (which is for analysis transforms only). + The init is here because some of it is shared */ + +static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){ + int i; + codec_setup_info *ci=vi->codec_setup; + backend_lookup_state *b=NULL; + + memset(v,0,sizeof(*v)); + b=v->backend_state=_ogg_calloc(1,sizeof(*b)); + + v->vi=vi; + b->modebits=ilog2(ci->modes); + + b->transform[0]=_ogg_calloc(VI_TRANSFORMB,sizeof(*b->transform[0])); + b->transform[1]=_ogg_calloc(VI_TRANSFORMB,sizeof(*b->transform[1])); + + /* MDCT is tranform 0 */ + + b->transform[0][0]=_ogg_calloc(1,sizeof(mdct_lookup)); + b->transform[1][0]=_ogg_calloc(1,sizeof(mdct_lookup)); + mdct_init(b->transform[0][0],ci->blocksizes[0]); + mdct_init(b->transform[1][0],ci->blocksizes[1]); + + b->window[0][0][0]=_ogg_calloc(VI_WINDOWB,sizeof(*b->window[0][0][0])); + b->window[0][0][1]=b->window[0][0][0]; + b->window[0][1][0]=b->window[0][0][0]; + b->window[0][1][1]=b->window[0][0][0]; + b->window[1][0][0]=_ogg_calloc(VI_WINDOWB,sizeof(*b->window[1][0][0])); + b->window[1][0][1]=_ogg_calloc(VI_WINDOWB,sizeof(*b->window[1][0][1])); + b->window[1][1][0]=_ogg_calloc(VI_WINDOWB,sizeof(*b->window[1][1][0])); + b->window[1][1][1]=_ogg_calloc(VI_WINDOWB,sizeof(*b->window[1][1][1])); + + for(i=0;i<VI_WINDOWB;i++){ + b->window[0][0][0][i]= + _vorbis_window(i,ci->blocksizes[0],ci->blocksizes[0]/2,ci->blocksizes[0]/2); + b->window[1][0][0][i]= + _vorbis_window(i,ci->blocksizes[1],ci->blocksizes[0]/2,ci->blocksizes[0]/2); + b->window[1][0][1][i]= + _vorbis_window(i,ci->blocksizes[1],ci->blocksizes[0]/2,ci->blocksizes[1]/2); + b->window[1][1][0][i]= + _vorbis_window(i,ci->blocksizes[1],ci->blocksizes[1]/2,ci->blocksizes[0]/2); + b->window[1][1][1][i]= + _vorbis_window(i,ci->blocksizes[1],ci->blocksizes[1]/2,ci->blocksizes[1]/2); + } + + if(encp){ /* encode/decode differ here */ + /* finish the codebooks */ + b->fullbooks=_ogg_calloc(ci->books,sizeof(*b->fullbooks)); + for(i=0;i<ci->books;i++) + vorbis_book_init_encode(b->fullbooks+i,ci->book_param[i]); + v->analysisp=1; + }else{ + /* finish the codebooks */ + b->fullbooks=_ogg_calloc(ci->books,sizeof(*b->fullbooks)); + for(i=0;i<ci->books;i++) + vorbis_book_init_decode(b->fullbooks+i,ci->book_param[i]); + } + + /* initialize the storage vectors to a decent size greater than the + minimum */ + + v->pcm_storage=8192; /* we'll assume later that we have + a minimum of twice the blocksize of + accumulated samples in analysis */ + v->pcm=_ogg_malloc(vi->channels*sizeof(*v->pcm)); + v->pcmret=_ogg_malloc(vi->channels*sizeof(*v->pcmret)); + { + int i; + for(i=0;i<vi->channels;i++) + v->pcm[i]=_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i])); + } + + /* all 1 (large block) or 0 (small block) */ + /* explicitly set for the sake of clarity */ + v->lW=0; /* previous window size */ + v->W=0; /* current window size */ + + /* all vector indexes */ + v->centerW=ci->blocksizes[1]/2; + + v->pcm_current=v->centerW; + + /* initialize all the mapping/backend lookups */ + b->mode=_ogg_calloc(ci->modes,sizeof(*b->mode)); + for(i=0;i<ci->modes;i++){ + int mapnum=ci->mode_param[i]->mapping; + int maptype=ci->map_type[mapnum]; + b->mode[i]=_mapping_P[maptype]->look(v,ci->mode_param[i], + ci->map_param[mapnum]); + } + + return(0); +} + +/* arbitrary settings and spec-mandated numbers get filled in here */ +int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi){ + backend_lookup_state *b=NULL; + + _vds_shared_init(v,vi,1); + b=v->backend_state; + b->psy_g_look=_vp_global_look(vi); + + /* Initialize the envelope state storage */ + b->ve=_ogg_calloc(1,sizeof(*b->ve)); + _ve_envelope_init(b->ve,vi); + + vorbis_bitrate_init(vi,&b->bms); + + return(0); +} + +void vorbis_dsp_clear(vorbis_dsp_state *v){ + int i,j,k; + if(v){ + vorbis_info *vi=v->vi; + codec_setup_info *ci=(vi?vi->codec_setup:NULL); + backend_lookup_state *b=v->backend_state; + + if(b){ + if(b->window[0][0][0]){ + for(i=0;i<VI_WINDOWB;i++) + if(b->window[0][0][0][i])_ogg_free(b->window[0][0][0][i]); + _ogg_free(b->window[0][0][0]); + + for(j=0;j<2;j++) + for(k=0;k<2;k++){ + for(i=0;i<VI_WINDOWB;i++) + if(b->window[1][j][k][i])_ogg_free(b->window[1][j][k][i]); + _ogg_free(b->window[1][j][k]); + } + } + + if(b->ve){ + _ve_envelope_clear(b->ve); + _ogg_free(b->ve); + } + + if(b->transform[0]){ + mdct_clear(b->transform[0][0]); + _ogg_free(b->transform[0][0]); + _ogg_free(b->transform[0]); + } + if(b->transform[1]){ + mdct_clear(b->transform[1][0]); + _ogg_free(b->transform[1][0]); + _ogg_free(b->transform[1]); + } + if(b->psy_g_look)_vp_global_free(b->psy_g_look); + vorbis_bitrate_clear(&b->bms); + } + + if(v->pcm){ + for(i=0;i<vi->channels;i++) + if(v->pcm[i])_ogg_free(v->pcm[i]); + _ogg_free(v->pcm); + if(v->pcmret)_ogg_free(v->pcmret); + } + + /* free mode lookups; these are actually vorbis_look_mapping structs */ + if(ci){ + for(i=0;i<ci->modes;i++){ + int mapnum=ci->mode_param[i]->mapping; + int maptype=ci->map_type[mapnum]; + if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]); + } + /* free codebooks */ + for(i=0;i<ci->books;i++) + if(b && b->fullbooks)vorbis_book_clear(b->fullbooks+i); + } + + if(b){ + if(b->mode)_ogg_free(b->mode); + if(b->fullbooks)_ogg_free(b->fullbooks); + + /* free header, header1, header2 */ + if(b->header)_ogg_free(b->header); + if(b->header1)_ogg_free(b->header1); + if(b->header2)_ogg_free(b->header2); + _ogg_free(b); + } + + memset(v,0,sizeof(*v)); + } +} + +float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){ + int i; + vorbis_info *vi=v->vi; + backend_lookup_state *b=v->backend_state; + + /* free header, header1, header2 */ + if(b->header)_ogg_free(b->header);b->header=NULL; + if(b->header1)_ogg_free(b->header1);b->header1=NULL; + if(b->header2)_ogg_free(b->header2);b->header2=NULL; + + /* Do we have enough storage space for the requested buffer? If not, + expand the PCM (and envelope) storage */ + + if(v->pcm_current+vals>=v->pcm_storage){ + v->pcm_storage=v->pcm_current+vals*2; + + for(i=0;i<vi->channels;i++){ + v->pcm[i]=_ogg_realloc(v->pcm[i],v->pcm_storage*sizeof(*v->pcm[i])); + } + } + + for(i=0;i<vi->channels;i++) + v->pcmret[i]=v->pcm[i]+v->pcm_current; + + return(v->pcmret); +} + +static void _preextrapolate_helper(vorbis_dsp_state *v){ + int i; + int order=32; + float *lpc=alloca(order*sizeof(*lpc)); + float *work=alloca(v->pcm_current*sizeof(*work)); + long j; + v->preextrapolate=1; + + if(v->pcm_current-v->centerW>order*2){ /* safety */ + for(i=0;i<v->vi->channels;i++){ + /* need to run the extrapolation in reverse! */ + for(j=0;j<v->pcm_current;j++) + work[j]=v->pcm[i][v->pcm_current-j-1]; + + /* prime as above */ + vorbis_lpc_from_data(work,lpc,v->pcm_current-v->centerW,order); + + /* run the predictor filter */ + vorbis_lpc_predict(lpc,work+v->pcm_current-v->centerW-order, + order, + work+v->pcm_current-v->centerW, + v->centerW); + + for(j=0;j<v->pcm_current;j++) + v->pcm[i][v->pcm_current-j-1]=work[j]; + + } + } +} + + +/* call with val<=0 to set eof */ + +int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){ + vorbis_info *vi=v->vi; + codec_setup_info *ci=vi->codec_setup; + /*backend_lookup_state *b=v->backend_state;*/ + + if(vals<=0){ + int order=32; + int i; + float *lpc=alloca(order*sizeof(*lpc)); + + /* if it wasn't done earlier (very short sample) */ + if(!v->preextrapolate) + _preextrapolate_helper(v); + + /* We're encoding the end of the stream. Just make sure we have + [at least] a full block of zeroes at the end. */ + /* actually, we don't want zeroes; that could drop a large + amplitude off a cliff, creating spread spectrum noise that will + suck to encode. Extrapolate for the sake of cleanliness. */ + + vorbis_analysis_buffer(v,ci->blocksizes[1]*2); + v->eofflag=v->pcm_current; + v->pcm_current+=ci->blocksizes[1]*2; + + for(i=0;i<vi->channels;i++){ + if(v->eofflag>order*2){ + /* extrapolate with LPC to fill in */ + long n; + + /* make a predictor filter */ + n=v->eofflag; + if(n>ci->blocksizes[1])n=ci->blocksizes[1]; + vorbis_lpc_from_data(v->pcm[i]+v->eofflag-n,lpc,n,order); + + /* run the predictor filter */ + vorbis_lpc_predict(lpc,v->pcm[i]+v->eofflag-order,order, + v->pcm[i]+v->eofflag,v->pcm_current-v->eofflag); + }else{ + /* not enough data to extrapolate (unlikely to happen due to + guarding the overlap, but bulletproof in case that + assumtion goes away). zeroes will do. */ + memset(v->pcm[i]+v->eofflag,0, + (v->pcm_current-v->eofflag)*sizeof(*v->pcm[i])); + + } + } + }else{ + + if(v->pcm_current+vals>v->pcm_storage) + return(OV_EINVAL); + + v->pcm_current+=vals; + + /* we may want to reverse extrapolate the beginning of a stream + too... in case we're beginning on a cliff! */ + /* clumsy, but simple. It only runs once, so simple is good. */ + if(!v->preextrapolate && v->pcm_current-v->centerW>ci->blocksizes[1]) + _preextrapolate_helper(v); + + } + return(0); +} + +/* do the deltas, envelope shaping, pre-echo and determine the size of + the next block on which to continue analysis */ +int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){ + int i; + vorbis_info *vi=v->vi; + codec_setup_info *ci=vi->codec_setup; + backend_lookup_state *b=v->backend_state; + vorbis_look_psy_global *g=b->psy_g_look; + vorbis_info_psy_global *gi=&ci->psy_g_param; + long beginW=v->centerW-ci->blocksizes[v->W]/2,centerNext; + vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal; + + /* check to see if we're started... */ + if(!v->preextrapolate)return(0); + + /* check to see if we're done... */ + if(v->eofflag==-1)return(0); + + /* By our invariant, we have lW, W and centerW set. Search for + the next boundary so we can determine nW (the next window size) + which lets us compute the shape of the current block's window */ + + if(ci->blocksizes[0]<ci->blocksizes[1]){ + long bp=_ve_envelope_search(v); + if(bp==-1)return(0); /* not enough data currently to search for a + full long block */ + v->nW=bp; + //v->nW=0; + + }else + v->nW=0; + + centerNext=v->centerW+ci->blocksizes[v->W]/4+ci->blocksizes[v->nW]/4; + + { + /* center of next block + next block maximum right side. */ + + long blockbound=centerNext+ci->blocksizes[v->nW]/2; + if(v->pcm_current<blockbound)return(0); /* not enough data yet; + although this check is + less strict that the + _ve_envelope_search, + the search is not run + if we only use one + block size */ + + + } + + /* fill in the block. Note that for a short window, lW and nW are *short* + regardless of actual settings in the stream */ + + _vorbis_block_ripcord(vb); + if(v->W){ + vb->lW=v->lW; + vb->W=v->W; + vb->nW=v->nW; + }else{ + vb->lW=0; + vb->W=v->W; + vb->nW=0; + } + + if(v->W){ + if(!v->lW || !v->nW) + vbi->blocktype=BLOCKTYPE_TRANSITION; + else + vbi->blocktype=BLOCKTYPE_LONG; + }else{ + if(_ve_envelope_mark(v)) + vbi->blocktype=BLOCKTYPE_IMPULSE; + else + vbi->blocktype=BLOCKTYPE_PADDING; + } + + vb->vd=v; + vb->sequence=v->sequence; + vb->granulepos=v->granulepos; + vb->pcmend=ci->blocksizes[v->W]; + + + /* copy the vectors; this uses the local storage in vb */ + { + vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal; + + /* this tracks 'strongest peak' for later psychoacoustics */ + /* moved to the global psy state; clean this mess up */ + if(vbi->ampmax>g->ampmax)g->ampmax=vbi->ampmax; + g->ampmax=_vp_ampmax_decay(g->ampmax,v); + vbi->ampmax=g->ampmax; + + vb->pcm=_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels); + vbi->pcmdelay=_vorbis_block_alloc(vb,sizeof(*vbi->pcmdelay)*vi->channels); + for(i=0;i<vi->channels;i++){ + vbi->pcmdelay[i]= + _vorbis_block_alloc(vb,(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i])); + memcpy(vbi->pcmdelay[i],v->pcm[i],(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i])); + vb->pcm[i]=vbi->pcmdelay[i]+beginW; + + /* before we added the delay + vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i])); + memcpy(vb->pcm[i],v->pcm[i]+beginW,ci->blocksizes[v->W]*sizeof(*vb->pcm[i])); + */ + + } + } + + /* handle eof detection: eof==0 means that we've not yet received EOF + eof>0 marks the last 'real' sample in pcm[] + eof<0 'no more to do'; doesn't get here */ + + if(v->eofflag){ + if(v->centerW>=v->eofflag){ + v->eofflag=-1; + vb->eofflag=1; + return(1); + } + } + + /* advance storage vectors and clean up */ + { + int new_centerNext=ci->blocksizes[1]/2+gi->delaycache; + int movementW=centerNext-new_centerNext; + + if(movementW>0){ + + _ve_envelope_shift(b->ve,movementW); + v->pcm_current-=movementW; + + for(i=0;i<vi->channels;i++) + memmove(v->pcm[i],v->pcm[i]+movementW, + v->pcm_current*sizeof(*v->pcm[i])); + + + v->lW=v->W; + v->W=v->nW; + v->centerW=new_centerNext; + + v->sequence++; + + if(v->eofflag){ + v->eofflag-=movementW; + /* do not add padding to end of stream! */ + if(v->centerW>=v->eofflag){ + v->granulepos+=movementW-(v->centerW-v->eofflag); + }else{ + v->granulepos+=movementW; + } + }else{ + v->granulepos+=movementW; + } + } + } + + /* done */ + return(1); +} + +int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){ + _vds_shared_init(v,vi,0); + + v->pcm_returned=-1; + v->granulepos=-1; + v->sequence=-1; + + return(0); +} + +/* Unlike in analysis, the window is only partially applied for each + block. The time domain envelope is not yet handled at the point of + calling (as it relies on the previous block). */ + +int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ + vorbis_info *vi=v->vi; + codec_setup_info *ci=vi->codec_setup; + + /* Shift out any PCM that we returned previously */ + /* centerW is currently the center of the last block added */ + + if(v->centerW>ci->blocksizes[1]/2 && + /* Quick additional hack; to avoid *alot* of shifts, use an + oversized buffer. This increases memory usage, but doesn't make + much difference wrt L1/L2 cache pressure. */ + v->pcm_returned>8192){ + + /* don't shift too much; we need to have a minimum PCM buffer of + 1/2 long block */ + + int shiftPCM=v->centerW-ci->blocksizes[1]/2; + shiftPCM=(v->pcm_returned<shiftPCM?v->pcm_returned:shiftPCM); + + v->pcm_current-=shiftPCM; + v->centerW-=shiftPCM; + v->pcm_returned-=shiftPCM; + + if(shiftPCM){ + int i; + for(i=0;i<vi->channels;i++) + memmove(v->pcm[i],v->pcm[i]+shiftPCM, + v->pcm_current*sizeof(*v->pcm[i])); + } + } + + v->lW=v->W; + v->W=vb->W; + v->nW=-1; + + v->glue_bits+=vb->glue_bits; + v->time_bits+=vb->time_bits; + v->floor_bits+=vb->floor_bits; + v->res_bits+=vb->res_bits; + + if(v->sequence+1 != vb->sequence)v->granulepos=-1; /* out of sequence; + lose count */ + + v->sequence=vb->sequence; + + { + int sizeW=ci->blocksizes[v->W]; + int centerW=v->centerW+ci->blocksizes[v->lW]/4+sizeW/4; + int beginW=centerW-sizeW/2; + int endW=beginW+sizeW; + int beginSl; + int endSl; + int i,j; + + /* Do we have enough PCM/mult storage for the block? */ + if(endW>v->pcm_storage){ + /* expand the storage */ + v->pcm_storage=endW+ci->blocksizes[1]; + + for(i=0;i<vi->channels;i++) + v->pcm[i]=_ogg_realloc(v->pcm[i],v->pcm_storage*sizeof(*v->pcm[i])); + } + + /* overlap/add PCM */ + + switch(v->W){ + case 0: + beginSl=0; + endSl=ci->blocksizes[0]/2; + break; + case 1: + beginSl=ci->blocksizes[1]/4-ci->blocksizes[v->lW]/4; + endSl=beginSl+ci->blocksizes[v->lW]/2; + break; + default: + return(-1); + } + + for(j=0;j<vi->channels;j++){ + float *pcm=v->pcm[j]+beginW; + float *p=vb->pcm[j]; + + /* the overlap/add section */ + for(i=beginSl;i<endSl;i++) + pcm[i]+=p[i]; + /* the remaining section */ + for(;i<sizeW;i++) + pcm[i]=p[i]; + + } + + /* deal with initial packet state; we do this using the explicit + pcm_returned==-1 flag otherwise we're sensitive to first block + being short or long */ + + if(v->pcm_returned==-1) + v->pcm_returned=centerW; + + /* track the frame number... This is for convenience, but also + making sure our last packet doesn't end with added padding. If + the last packet is partial, the number of samples we'll have to + return will be past the vb->granulepos. + + This is not foolproof! It will be confused if we begin + decoding at the last page after a seek or hole. In that case, + we don't have a starting point to judge where the last frame + is. For this reason, vorbisfile will always try to make sure + it reads the last two marked pages in proper sequence */ + + if(v->granulepos==-1) + if(vb->granulepos==-1){ + v->granulepos=0; + }else{ + v->granulepos=vb->granulepos; + } + else{ + v->granulepos+=(centerW-v->centerW); + if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){ + + if(v->granulepos>vb->granulepos){ + long extra=v->granulepos-vb->granulepos; + + if(vb->eofflag){ + /* partial last frame. Strip the extra samples off */ + centerW-=extra; + }else if(vb->sequence == 1){ + /* ^^^ argh, this can be 1 from seeking! */ + + + /* partial first frame. Discard extra leading samples */ + v->pcm_returned+=extra; + if(v->pcm_returned>centerW)v->pcm_returned=centerW; + + } + + }/* else{ Shouldn't happen *unless* the bitstream is out of + spec. Either way, believe the bitstream } */ + v->granulepos=vb->granulepos; + } + } + + /* Update, cleanup */ + + v->centerW=centerW; + v->pcm_current=endW; + + if(vb->eofflag)v->eofflag=1; + } + + return(0); +} + +/* pcm==NULL indicates we just want the pending samples, no more */ +int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm){ + vorbis_info *vi=v->vi; + if(v->pcm_returned>-1 && v->pcm_returned<v->centerW){ + if(pcm){ + int i; + for(i=0;i<vi->channels;i++) + v->pcmret[i]=v->pcm[i]+v->pcm_returned; + *pcm=v->pcmret; + } + return(v->centerW-v->pcm_returned); + } + return(0); +} + +int vorbis_synthesis_read(vorbis_dsp_state *v,int bytes){ + if(bytes && v->pcm_returned+bytes>v->centerW)return(OV_EINVAL); + v->pcm_returned+=bytes; + return(0); +} + diff --git a/lib/books/coupled/_44c0_s1_pS_r0.vqh b/lib/books/coupled/_44c0_s1_pS_r0.vqh index e69de29b..f654250e 100644 --- a/lib/books/coupled/_44c0_s1_pS_r0.vqh +++ b/lib/books/coupled/_44c0_s1_pS_r0.vqh @@ -0,0 +1,58 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * 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/ * + * * + ******************************************************************** + + function: static codebook autogenerated by vq/somethingorother + + ********************************************************************/ + +#ifndef _V__44c0_s1_pS_r0_VQH_ +#define _V__44c0_s1_pS_r0_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s1_pS_r0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c0_s1_pS_r0[] = { + 1, 2, 3, 6, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__44c0_s1_pS_r0[] = { + -0.16667, 0.16667, +}; + +static long _vq_quantmap__44c0_s1_pS_r0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s1_pS_r0 = { + _vq_quantthresh__44c0_s1_pS_r0, + _vq_quantmap__44c0_s1_pS_r0, + 3, + 3 +}; + +static static_codebook _44c0_s1_pS_r0 = { + 2, 9, + _vq_lengthlist__44c0_s1_pS_r0, + 1, -539667115, 1607816533, 2, 0, + _vq_quantlist__44c0_s1_pS_r0, + NULL, + &_vq_auxt__44c0_s1_pS_r0, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c4_s1_p2_s0.vqh b/lib/books/coupled/_44c4_s1_p2_s0.vqh index 1621b385..d4070e15 100644 --- a/lib/books/coupled/_44c4_s1_p2_s0.vqh +++ b/lib/books/coupled/_44c4_s1_p2_s0.vqh @@ -27,8 +27,8 @@ static long _vq_quantlist__44c4_s1_p2_s0[] = { }; static long _vq_lengthlist__44c4_s1_p2_s0[] = { - 2, 3, 3,10,10, 5, 4, 4,10,10, 5, 4, 4,10,10,10, - 4, 4,10, 9, 9, 6, 5, 9, 9, + 1,12,12,12,12, 3, 5, 4,12,12, 3, 4, 4,12,12, 6, + 12,12, 7, 8,12,12,12,12,11, }; static float _vq_quantthresh__44c4_s1_p2_s0[] = { diff --git a/lib/books/coupled/_44c4_s1_p4_s0.vqh b/lib/books/coupled/_44c4_s1_p4_s0.vqh index e57b45f6..c4a47534 100644 --- a/lib/books/coupled/_44c4_s1_p4_s0.vqh +++ b/lib/books/coupled/_44c4_s1_p4_s0.vqh @@ -31,12 +31,12 @@ static long _vq_quantlist__44c4_s1_p4_s0[] = { }; static long _vq_lengthlist__44c4_s1_p4_s0[] = { - 3, 3, 3,12,12, 4, 4, 4,12,12, 4, 4, 4,12,12,12, - 4, 4,11,12,11, 5, 4,11,11,11,11,11,11,11,11,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11, + 1,19,19,19,19,19,19,19,19, 3, 5, 5,19,19,19,19, + 19,19, 3, 5, 5,19,19,19,19,19,19, 5, 7, 7, 6, 6, + 19,19,19,19, 8, 7, 7,13,12,19,19,19,19, 8, 8, 8, + 19,19,19,19,19,19, 8, 8, 8,19,19,19,19,19,19, 9, + 19,19,19,19,19,19,10,11,18,18,18,18,18,18,18,18, + 18, }; static float _vq_quantthresh__44c4_s1_p4_s0[] = { diff --git a/lib/books/coupled/_44c4_s1_p6_s0.vqh b/lib/books/coupled/_44c4_s1_p6_s0.vqh index 23a576e8..9bceb15c 100644 --- a/lib/books/coupled/_44c4_s1_p6_s0.vqh +++ b/lib/books/coupled/_44c4_s1_p6_s0.vqh @@ -31,12 +31,12 @@ static long _vq_quantlist__44c4_s1_p6_s0[] = { }; static long _vq_lengthlist__44c4_s1_p6_s0[] = { - 3, 3, 3,12,12, 4, 4, 4,12,12, 4, 4, 4,12,12,12, - 4, 4,12,11,11, 5, 4,11,11,11,11,11,11,11,11,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11, + 1,18,18,18,18,18,18,18,18, 3, 5, 5,18,18,18,18, + 18,18, 3, 5, 5,18,18,18,18,18,18, 5, 7, 7, 7, 6, + 18,18,18,18, 8, 7, 7,11,12,18,18,18,18, 7, 8, 8, + 18,18,18,18,18,18, 8, 8, 8,18,18,18,18,18,18, 8, + 18,18,18,18,18,18, 9,10,17,17,17,17,17,17,17,17, + 17, }; static float _vq_quantthresh__44c4_s1_p6_s0[] = { diff --git a/lib/books/coupled/_44c4_s1_p7_s0.vqh b/lib/books/coupled/_44c4_s1_p7_s0.vqh index 5d098d44..b1a232d0 100644 --- a/lib/books/coupled/_44c4_s1_p7_s0.vqh +++ b/lib/books/coupled/_44c4_s1_p7_s0.vqh @@ -31,12 +31,12 @@ static long _vq_quantlist__44c4_s1_p7_s0[] = { }; static long _vq_lengthlist__44c4_s1_p7_s0[] = { - 3, 3, 3,12,12, 4, 4, 4,12,12, 4, 4, 4,12,12,12, - 4, 4,12,11,11, 5, 4,11,11,11,11,11,11,11,11,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11, + 1,18,18,18,18,18,18,18,18, 3, 5, 5,18,18,18,18, + 18,18, 3, 5, 5,18,18,18,18,18,18, 5, 7, 7, 7, 7, + 18,18,18,18, 7, 7, 7,11,12,18,18,18,18, 7, 8, 8, + 18,18,18,18,18,18, 7, 8, 8,18,18,18,18,18,18, 8, + 18,18,18,18,18,18,10, 9,17,17,17,17,17,17,17,17, + 17, }; static float _vq_quantthresh__44c4_s1_p7_s0[] = { diff --git a/lib/books/coupled/_44c4_s1_p8_s0.vqh b/lib/books/coupled/_44c4_s1_p8_s0.vqh index bd65daea..542f7aeb 100644 --- a/lib/books/coupled/_44c4_s1_p8_s0.vqh +++ b/lib/books/coupled/_44c4_s1_p8_s0.vqh @@ -31,12 +31,12 @@ static long _vq_quantlist__44c4_s1_p8_s0[] = { }; static long _vq_lengthlist__44c4_s1_p8_s0[] = { - 3, 3, 3,12,12, 4, 4, 4,12,12, 4, 4, 4,12,12,12, - 4, 4,12,11,11, 5, 4,11,11,11,11,11,11,11,11,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11, + 1,14,14,14,14,14,14,14,14, 3, 5, 5,14,14,14,14, + 14,14, 3, 5, 5,14,14,14,14,14,14, 5, 7, 7, 7, 7, + 14,14,14,14, 8, 7, 7,12,14,14,14,14,14, 7, 8, 8, + 14,14,14,14,14,14, 7, 8, 8,14,14,14,14,14,14, 8, + 14,14,14,14,14,14, 9, 9,14,14,14,14,14,13,13,13, + 13, }; static float _vq_quantthresh__44c4_s1_p8_s0[] = { diff --git a/lib/books/coupled/_44c4_s1_p9_s0.vqh b/lib/books/coupled/_44c4_s1_p9_s0.vqh index 4d5bd7ef..99227e03 100644 --- a/lib/books/coupled/_44c4_s1_p9_s0.vqh +++ b/lib/books/coupled/_44c4_s1_p9_s0.vqh @@ -31,12 +31,12 @@ static long _vq_quantlist__44c4_s1_p9_s0[] = { }; static long _vq_lengthlist__44c4_s1_p9_s0[] = { - 3, 3, 3,12,12, 4, 4, 4,12,12, 4, 4, 4,12,11,12, - 4, 4,12,12,11, 5, 4,11,11,11,11,11,11,11,11,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, - 11, + 1, 9, 9, 9, 9, 9, 9, 9, 9, 4, 5, 5, 9, 9, 9, 9, + 9, 9, 4, 5, 6, 9, 9, 9, 9, 9, 9, 6, 8, 6, 7, 6, + 9, 9, 9, 9, 7, 6, 6, 9, 9, 9, 9, 9, 9, 9, 8, 9, + 9, 9, 9, 9, 9, 9, 7, 9, 9, 9, 9, 9, 9, 9, 9, 8, + 9, 9, 9, 9, 8, 8, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, }; static float _vq_quantthresh__44c4_s1_p9_s0[] = { diff --git a/lib/books/coupled/_44c4_s1_pS_r0.vqh b/lib/books/coupled/_44c4_s1_pS_r0.vqh index e69de29b..5e9c7688 100644 --- a/lib/books/coupled/_44c4_s1_pS_r0.vqh +++ b/lib/books/coupled/_44c4_s1_pS_r0.vqh @@ -0,0 +1,58 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * 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/ * + * * + ******************************************************************** + + function: static codebook autogenerated by vq/somethingorother + + ********************************************************************/ + +#ifndef _V__44c4_s1_pS_r0_VQH_ +#define _V__44c4_s1_pS_r0_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c4_s1_pS_r0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c4_s1_pS_r0[] = { + 3, 2, 1, 6, 6, 6, 6, 5, 5, +}; + +static float _vq_quantthresh__44c4_s1_pS_r0[] = { + -0.16667, 0.16667, +}; + +static long _vq_quantmap__44c4_s1_pS_r0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c4_s1_pS_r0 = { + _vq_quantthresh__44c4_s1_pS_r0, + _vq_quantmap__44c4_s1_pS_r0, + 3, + 3 +}; + +static static_codebook _44c4_s1_pS_r0 = { + 2, 9, + _vq_lengthlist__44c4_s1_pS_r0, + 1, -539667115, 1607816533, 2, 0, + _vq_quantlist__44c4_s1_pS_r0, + NULL, + &_vq_auxt__44c4_s1_pS_r0, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c4_s1_pS_r1.vqh b/lib/books/coupled/_44c4_s1_pS_r1.vqh index 11cc3ed9..00c53138 100644 --- a/lib/books/coupled/_44c4_s1_pS_r1.vqh +++ b/lib/books/coupled/_44c4_s1_pS_r1.vqh @@ -25,7 +25,7 @@ static long _vq_quantlist__44c4_s1_pS_r1[] = { }; static long _vq_lengthlist__44c4_s1_pS_r1[] = { - 4, 4, 3, 3, 3, 3, 3, 3, 3, + 1, 3, 2, 6, 6, 6, 6, 5, 5, }; static float _vq_quantthresh__44c4_s1_pS_r1[] = { diff --git a/lib/books/coupled/_44c4_s2_p6_s0.vqh b/lib/books/coupled/_44c4_s2_p6_s0.vqh index 223c4149..ec84e61f 100644 --- a/lib/books/coupled/_44c4_s2_p6_s0.vqh +++ b/lib/books/coupled/_44c4_s2_p6_s0.vqh @@ -39,25 +39,25 @@ static long _vq_quantlist__44c4_s2_p6_s0[] = { }; static long _vq_lengthlist__44c4_s2_p6_s0[] = { - 2, 2, 2,16,16, 5, 6, 6,16,16, 5, 6, 7,16,16,16, - 5, 5,16,16,16, 5, 5,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15, + 1,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, + 19, 5, 6, 6,19,19,19,19,19,19,19,19,19,19,19,19, + 19,19, 5, 6, 5,19,19,19,19,19,19,19,19,19,19,19, + 19,19,19, 7, 5, 5,10,10,19,19,19,19,19,19,19,19, + 19,19,19,19, 7, 5, 5, 9, 9,19,19,19,19,19,19,19, + 19,19,19,19,19, 8, 6, 6, 9, 9,13,14,19,19,19,19, + 19,19,19,19,19,19, 8, 6, 6, 8, 8,12,12,19,19,19, + 19,19,19,19,19,19,19, 8, 7, 7,10,10,14,13,17,18, + 19,19,19,19,19,19,19,19, 8, 6, 6, 9, 9,13,13,16, + 17,19,19,19,19,19,19,19,19, 7, 7, 7,11,11,15,15, + 19,19,19,19,19,19,19,19,19,19, 7, 7, 7,11,11,14, + 14,19,19,19,19,19,19,19,19,19,19, 8,10,10,13,13, + 19,19,19,19,19,19, 9, 9,19,19,19,19,11,10,10,13, + 13,19,19,19,19,19,19,19,19,19,19,19,19,10,10,10, + 19,19,19,19,19,19,19,19,19,19,19,19,19,19,10,10, + 11,19,19,19,19,19,19,19,19,19,19,19,19,19,19,10, + 19,19,19,19,19,19,19,19,19,19,19,19,19,19,12,11, + 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, + 18, }; static float _vq_quantthresh__44c4_s2_p6_s0[] = { diff --git a/lib/books/coupled/_44c4_s2_p7_s0.vqh b/lib/books/coupled/_44c4_s2_p7_s0.vqh index 29e1800c..083c71e3 100644 --- a/lib/books/coupled/_44c4_s2_p7_s0.vqh +++ b/lib/books/coupled/_44c4_s2_p7_s0.vqh @@ -39,25 +39,25 @@ static long _vq_quantlist__44c4_s2_p7_s0[] = { }; static long _vq_lengthlist__44c4_s2_p7_s0[] = { - 2, 3, 3,15,15, 4, 4, 4,15,15, 4, 4, 4,15,15,15, - 5, 5,15,15,15, 6, 5,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,14,14,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, - 14, + 1,18,18,18,18,18,18,18,18,18,18,17,17,17,17,17, + 17, 5, 6, 6,17,17,17,17,17,17,17,17,17,17,17,17, + 17,17, 5, 6, 6,17,17,17,17,17,17,17,17,17,17,17, + 17,17,17, 7, 6, 6, 9,10,17,17,17,17,17,17,17,17, + 17,17,17,17, 7, 5, 6, 9,10,17,17,17,17,17,17,17, + 17,17,17,17,17, 7, 6, 6, 8, 9,12,13,17,17,17,17, + 17,17,17,17,17,17, 8, 6, 6, 8, 8,12,12,17,17,17, + 17,17,17,17,17,17,17, 7, 6, 6, 9, 9,12,13,17,17, + 17,17,17,17,17,17,17,17, 8, 6, 6, 9, 9,12,12,16, + 15,17,17,17,17,17,17,17,17, 7, 7, 7,10,10,14,14, + 17,17,17,17,17,17,17,17,17,17, 7, 7, 7,10,10,13, + 13,17,17,17,17,17,17,17,17,17,17, 7, 8, 8,12,12, + 17,17,17,17,17,17, 8, 8,17,17,17,17,10, 8, 8,12, + 11,17,17,17,17,17,17,17,17,17,17,17,17, 9, 9, 9, + 17,17,17,17,17,17,17,17,17,17,17,17,17,17, 8, 9, + 9,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 9, + 17,17,17,17,17,17,17,17,17,17,17,17,17,17,10,10, + 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, + 17, }; static float _vq_quantthresh__44c4_s2_p7_s0[] = { diff --git a/lib/books/coupled/_44c4_s2_p8_s0.vqh b/lib/books/coupled/_44c4_s2_p8_s0.vqh index 2e4d6a40..8e4ae338 100644 --- a/lib/books/coupled/_44c4_s2_p8_s0.vqh +++ b/lib/books/coupled/_44c4_s2_p8_s0.vqh @@ -39,25 +39,25 @@ static long _vq_quantlist__44c4_s2_p8_s0[] = { }; static long _vq_lengthlist__44c4_s2_p8_s0[] = { - 3, 3, 3,14,14, 4, 4, 4,14,14, 4, 4, 4,14,14,14, - 4, 4,14,14,14, 5, 4,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13, + 1,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12, 5, 6, 6,12,12,12,12,12,12,12,12,12,12,12,12, + 12,12, 5, 6, 5,12,12,12,12,12,12,12,12,12,12,12, + 12,12,12, 7, 6, 6,10,11,12,12,12,12,12,12,12,12, + 12,12,12,12, 8, 6, 6,10,10,12,12,12,12,12,12,12, + 12,12,12,12,12, 8, 6, 6, 9, 9,12,12,12,12,12,12, + 12,12,12,12,12,12, 8, 6, 6, 9, 9,12,12,12,12,12, + 12,12,12,12,12,12,12, 9, 7, 7, 9, 9,12,12,12,12, + 12,12,12,12,12,12,12,12, 9, 6, 6, 8, 9,11,11,12, + 12,12,12,12,12,12,12,12,12, 7, 7, 7,10,12,11,11, + 12,12,12,12,12,12,12,12,12,12, 7, 7, 7,12,10,12, + 11,12,12,12,12,12,12,12,12,12,12, 8, 8, 8,12,12, + 12,12,12,12,12,12,10, 9,12,12,12,12,10, 9, 8,11, + 11,12,12,12,12,12,12,12,12,12,12,12,12, 8, 9,10, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12, 9, 9, + 10,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 9, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,10,10, + 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 12, }; static float _vq_quantthresh__44c4_s2_p8_s0[] = { diff --git a/lib/books/coupled/_44c4_s2_p9_s0.vqh b/lib/books/coupled/_44c4_s2_p9_s0.vqh index 3f03a277..35c1c324 100644 --- a/lib/books/coupled/_44c4_s2_p9_s0.vqh +++ b/lib/books/coupled/_44c4_s2_p9_s0.vqh @@ -39,25 +39,25 @@ static long _vq_quantlist__44c4_s2_p9_s0[] = { }; static long _vq_lengthlist__44c4_s2_p9_s0[] = { - 3, 3, 3,14,14, 4, 4, 4,14,14, 4, 4, 4,14,13,14, - 4, 4,14,14,14, 5, 4,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, - 14,14,14,14,14,14,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, - 13, + 1,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10, 7, 7,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10, 7, 8, 7,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10, 9, 8, 8,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10, 8,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10, 7,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10, 9, 8,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10, 8,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10, 8,10, 8, 8, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 9, 8, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, }; static float _vq_quantthresh__44c4_s2_p9_s0[] = { diff --git a/lib/books/coupled/_44c4_s3_p9_s0.vqh b/lib/books/coupled/_44c4_s3_p9_s0.vqh index 6c398a08..2d349e09 100644 --- a/lib/books/coupled/_44c4_s3_p9_s0.vqh +++ b/lib/books/coupled/_44c4_s3_p9_s0.vqh @@ -55,75 +55,75 @@ static long _vq_quantlist__44c4_s3_p9_s0[] = { }; static long _vq_lengthlist__44c4_s3_p9_s0[] = { - 3, 3, 3,16,16, 4, 4, 4,16,16, 4, 4, 4,16,15,16, - 4, 4,16,16,16, 5, 4,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, - 16,16,16,16,16,16,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, - 15, + 1,17,17,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16, 6, 6, 6,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16, 6, 6, 6,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16, 8, 6, 6, 9,10,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16, 8, 6, 6, 9, 9,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16, 9, 7, 7, 7, 7,12,11,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16, 9, 7, 7, 7, 7,11,11,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16, 9, 8, 8, 7, 7, 9,10,13,13, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,10, 8, 8, 7, 7,10, 9,12, + 12,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16, 9, 8, 8, 8, 8, 9,10, + 11,12,15,15,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,10, 8, 8, 8, 7, 9, + 9,11,11,15,13,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,10, 8, 8, 8, 8, + 10,10,12,12,13,14,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,10, 8, 8, 8, + 8, 9,10,11,11,13,14,15,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,10, 8, 8, + 9, 9,10,10,12,11,14,14,15,15,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,10, 8, + 8, 9, 9,10,10,12,12,13,13,15,15,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,10, + 8, 8, 9, 9,11,11,13,13,14,15,15,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 10, 8, 8, 9, 9,11,10,13,13,15,15,14,15,16,15,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16, 9, 9, 9,10,10,12,11,13,15,16,14,15,15,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16, 9, 9, 9,10,10,11,12,14,13,14,14,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16, 9,10,10,11,11,12,12,14,14,16,16,16,15, + 16,16,16,16,16,16,10,10,16,16,16,16,16,16,16,16, + 16,16,16,16,12,10,10,11,11,12,13,14,15,16,15,15, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,10,10,10,11,12,14,13,15,14,16,15, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,10,10,10,11,12,13,13,15,14,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,11,11,11,13,12,14,14,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,12,12, + 16,16,16,16,16,16,16,16,13,11,11,12,12,14,14,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,11,12,12,14,14,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,12,11,11,13,13,16, + 15,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,12,13,12,15,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,13,14,16,16,16,16,14,13,13,15, + 15,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,13,15,14, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,13,13, + 14,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,13, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,14,14, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, + 16, }; static float _vq_quantthresh__44c4_s3_p9_s0[] = { diff --git a/lib/mapping0.c b/lib/mapping0.c index 4052f5ef..ac53229c 100644 --- a/lib/mapping0.c +++ b/lib/mapping0.c @@ -11,7 +11,7 @@ ******************************************************************** function: channel mapping 0 implementation - last mod: $Id: mapping0.c,v 1.39.2.1 2001/12/17 05:39:24 xiphmont Exp $ + last mod: $Id: mapping0.c,v 1.39.2.2 2001/12/18 23:49:16 xiphmont Exp $ ********************************************************************/ @@ -378,14 +378,11 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){ /* perform psychoacoustics; do masking */ _vp_compute_mask(look->psy_look[blocktype], - b->psy_g_look, - i, logfft, /* -> logmax */ logmdct, logmask, global_ampmax, local_ampmax[i], - ci->blocksizes[vb->lW]/2, bm->avgnoise); _analysis_output("mask",seq+i,logmask,n/2,1,0); @@ -401,12 +398,9 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){ _vp_remove_floor(look->psy_look[blocktype], - b->psy_g_look, - logmdct, mdct, codedflr, - res, - local_ampmax[i]); + res); /*for(j=0;j<n/2;j++) if(fabs(res[j])>1200){ @@ -414,7 +408,6 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){ fprintf(stderr,"%ld ",seq+i); }*/ - //_analysis_output("res",seq+i,res,n/2,1,0); _analysis_output("codedflr",seq+i,codedflr,n/2,1,1); } @@ -493,8 +486,8 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){ 0); } - //for(i=0;i<vi->channels;i++) - //_analysis_output("quant",seq+i,quantized[i],n/2,1,0); + for(i=0;i<vi->channels;i++) + _analysis_output("quant",seq+i,quantized[i],n/2,1,0); /* classify, by submap */ @@ -555,6 +548,7 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){ lqua[j]=lpcm[j]-lsof[j]; } }else{ + _vp_quantize_couple(look->psy_look[blocktype], info, pcm, @@ -562,7 +556,6 @@ static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){ quantized, nonzero, i); - } } } diff --git a/lib/modes/psych_44.h b/lib/modes/psych_44.h index 95dc57ff..2c1546b6 100644 --- a/lib/modes/psych_44.h +++ b/lib/modes/psych_44.h @@ -11,7 +11,7 @@ ******************************************************************** function: key psychoacoustic settings for 44.1/48kHz - last mod: $Id: psych_44.h,v 1.3.2.1 2001/12/17 05:39:26 xiphmont Exp $ + last mod: $Id: psych_44.h,v 1.3.2.2 2001/12/18 23:49:22 xiphmont Exp $ ********************************************************************/ @@ -571,11 +571,11 @@ static double _psy_tone_masteratt[11]={ }; static double _psy_tone_masterguard[11]={ - -18.,-24.,-24.,-24.,-26.,-40.,-40.,-40.,-40.,-45.,-45.,-45., + -18.,-24.,-24.,-24.,-26.,-40.,-40.,-40.,-45.,-45.,-45., }; static double _psy_tone_suppress[11]={ - -10.,-20.,-20.,-20.,-30.,-30.,-40.,-40.,-40.,-45.,-45.,-45., + -10.,-20.,-20.,-20.,-30.,-30.,-40.,-40.,-45.,-45.,-45., }; static double _psy_tone_0dB[11]={ @@ -583,7 +583,7 @@ static double _psy_tone_0dB[11]={ }; static double _psy_noise_suppress[11]={ - -0.,-24.,-24.,-24.,-24.,-30.,-40.,-40.,-40.,-45.,-45.,-45., + -0.,-24.,-24.,-24.,-24.,-30.,-40.,-40.,-45.,-45.,-45., }; static int _psy_ehmer_bandlimit[11]={ @@ -629,7 +629,7 @@ static float ATH_Bark_dB[][27]={ }; /* stereo ****************/ -static int _psy_stereo_point_dB_44[11]={4, 3, 2, 2, 1, 0, 0, 0, 0, 0, 0}; +static int _psy_stereo_point_dB_44[11]={3, 3, 2, 2, 1, 0, 0, 0, 0, 0, 0}; static double _psy_stereo_point_kHz_44[2][11]={ {4., 6., 6., 6., 10., 6., 6., 4., 4., 4., 4.}, {6., 6., 6., 10., 10., 6., 6., 4., 4., 4., 4.} diff --git a/lib/modes/residue_44.h b/lib/modes/residue_44.h new file mode 100644 index 00000000..b6cd8db3 --- /dev/null +++ b/lib/modes/residue_44.h @@ -0,0 +1,1406 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * 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/ * + * * +v ******************************************************************** + + function: toplevel residue templates for 32/44.1/48kHz + last mod: $Id: residue_44.h,v 1.4.2.1 2001/12/18 23:49:23 xiphmont Exp $ + + ********************************************************************/ + +#include "vorbis/codec.h" +#include "backends.h" + +static bitrate_manager_info _bm_44_default={ + /* progressive coding and bitrate controls */ + 2.,.5, + 2., 0, 0, + 0, 0, + + 4.0, 0., -1., .05, + -.05, .05, + 3.5,5.0, + -10.f,+2.f +}; + +/***** residue backends *********************************************/ + +/* the books used depend on stereo-or-not, but the residue setup below + can apply to coupled or not. These templates are for a first pass; + a last pass is mechanically added in vorbisenc for residue backfill + at 1/3 and 1/9, as well as an optional middle pass for stereo + backfill */ + +/* 0 1 2 4 26 1 2 4 26 + + 0 0 0 0 + + 0 1 2 3 4 5 6 7 8 9 + 1 . . . + 2 . . . + 4 . . . . . . . + + 0 4 4 4 3 4 4 4 3 7 */ +static vorbis_info_residue0 _residue_44_low={ + 0,-1, -1, 8,-1, + {0}, + {-1}, + {9999, 9999, 9999, 9999, 9999, 9999, 9999}, + { .5, 1.5, 2.5, 4.5, 26.5, 1.5, 4.5}, + {0}, + { 99, -1, -1, -1, -1, 99, 99} +}; +/* 26 doesn't cascade well; use 28 instead */ +static vorbis_info_residue0 _residue_44_low_un={ + 0,-1, -1, 8,-1, + {0}, + {-1}, + {9999, 9999, 9999, 9999, 9999, 9999, 9999}, + { .5, 1.5, 2.5, 4.5, 28.5, 1.5, 4.5}, + {0}, + { 99, -1, -1, -1, -1, 99, 99} +}; + +/* 0 1 2 4 1 2 4 16 42 + + 0 0 0 + + 0 1 2 3 4 5 6 7 8 9 + 1 . . . + 2 . . . + 4 . . . . . . . + + 0 4 4 4 4 4 4 3 3 7 */ +static vorbis_info_residue0 _residue_44_mid={ + 0,-1, -1, 10,-1, + /* 0 1 2 3 4 5 6 7 8 9 */ + {0}, + {-1}, + {9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999}, + { .5, 1.5, 1.5, 2.5, 2.5, 4.5, 4.5, 16.5, 42.5}, + {0}, + { 99, -1, 99, -1, 99, -1, 99, 99, 99} +}; + + +/* 0 8 42 1 2 4 8 16 56 + + 0 0 0 + + 0 1 2 3 4 5 6 7 8 9 + 1 . . . . + 2 . . . . + 4 . . . . . . + + 0 4 3 4 4 4 4 3 3 7 */ +static vorbis_info_residue0 _residue_44_high={ + 0,-1, -1, 10,-1, + /* 0 1 2 3 4 5 6 7 8 9 */ + {0}, + {-1}, + {9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999}, + { .5, 8.5, 42.5, 1.5, 2.5, 4.5, 8.5, 16.5, 56.5}, + {0}, + { 99, -1, -1, 99, 99, 99, 99, 99, 99} +}; +/* 56 doesn't cascade well; use 59 */ +static vorbis_info_residue0 _residue_44_high_un={ + 0,-1, -1, 10,-1, + /* 0 1 2 3 4 5 6 7 8 9 */ + {0}, + {-1}, + {9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999, 9999}, + { .5, 8.5, 42.5, 1.5, 2.5, 4.5, 8.5, 16.5, 59.5}, + {0}, + { 99, -1, -1, 99, 99, 99, 99, 99, 99} +}; + +#include "books/coupled/_44c0_short.vqh" +#include "books/coupled/_44c0_long.vqh" + +#include "books/coupled/_44c0_s0_p1_0.vqh" +#include "books/coupled/_44c0_s0_p2_0.vqh" +#include "books/coupled/_44c0_s0_p3_0.vqh" +#include "books/coupled/_44c0_s0_p4_0.vqh" +#include "books/coupled/_44c0_s0_p4_1.vqh" +#include "books/coupled/_44c0_s0_p5_0.vqh" +#include "books/coupled/_44c0_s1_p5_0.vqh" +#include "books/coupled/_44c0_s0_p6_0.vqh" +#include "books/coupled/_44c0_s1_p6_0.vqh" +#include "books/coupled/_44c0_s2_p6_0.vqh" +#include "books/coupled/_44c0_s0_p7_0.vqh" +#include "books/coupled/_44c0_s0_p7_1.vqh" +#include "books/coupled/_44c0_s0_p7_2.vqh" +#include "books/coupled/_44c0_s1_p7_0.vqh" +#include "books/coupled/_44c0_s1_p7_1.vqh" +#include "books/coupled/_44c0_s1_p7_2.vqh" +#include "books/coupled/_44c0_s2_p7_0.vqh" +#include "books/coupled/_44c0_s2_p7_1.vqh" +#include "books/coupled/_44c0_s2_p7_2.vqh" +#include "books/coupled/_44c0_s3_p7_0.vqh" +#include "books/coupled/_44c0_s3_p7_1.vqh" +#include "books/coupled/_44c0_s3_p7_2.vqh" + +#include "books/coupled/_44c0_s1_p5_s0.vqh" +#include "books/coupled/_44c0_s1_p6_s0.vqh" +#include "books/coupled/_44c0_s1_p7_s0.vqh" +#include "books/coupled/_44c0_s2_p6_s0.vqh" +#include "books/coupled/_44c0_s2_p7_s0.vqh" +#include "books/coupled/_44c0_s3_p7_s0.vqh" + +#include "books/coupled/_44c0_s0_p0_r0.vqh" +#include "books/coupled/_44c0_s0_pN_r0.vqh" +#include "books/coupled/_44c0_s1_pS_r0.vqh" +#include "books/coupled/_44c0_s0_p0_r1.vqh" +#include "books/coupled/_44c0_s0_pN_r1.vqh" +#include "books/coupled/_44c0_s1_pS_r1.vqh" + +#include "books/coupled/_44c1_short.vqh" +#include "books/coupled/_44c1_long.vqh" + +#include "books/coupled/_44c1_s0_p1_0.vqh" +#include "books/coupled/_44c1_s0_p2_0.vqh" +#include "books/coupled/_44c1_s0_p3_0.vqh" +#include "books/coupled/_44c1_s0_p4_0.vqh" +#include "books/coupled/_44c1_s0_p4_1.vqh" +#include "books/coupled/_44c1_s0_p5_0.vqh" +#include "books/coupled/_44c1_s1_p5_0.vqh" +#include "books/coupled/_44c1_s0_p6_0.vqh" +#include "books/coupled/_44c1_s1_p6_0.vqh" +#include "books/coupled/_44c1_s2_p6_0.vqh" +#include "books/coupled/_44c1_s0_p7_0.vqh" +#include "books/coupled/_44c1_s0_p7_1.vqh" +#include "books/coupled/_44c1_s0_p7_2.vqh" +#include "books/coupled/_44c1_s1_p7_0.vqh" +#include "books/coupled/_44c1_s1_p7_1.vqh" +#include "books/coupled/_44c1_s1_p7_2.vqh" +#include "books/coupled/_44c1_s2_p7_0.vqh" +#include "books/coupled/_44c1_s2_p7_1.vqh" +#include "books/coupled/_44c1_s2_p7_2.vqh" +#include "books/coupled/_44c1_s3_p7_0.vqh" +#include "books/coupled/_44c1_s3_p7_1.vqh" +#include "books/coupled/_44c1_s3_p7_2.vqh" + +#include "books/coupled/_44c2_short.vqh" +#include "books/coupled/_44c2_long.vqh" + +#include "books/coupled/_44c2_s0_p1_0.vqh" +#include "books/coupled/_44c2_s0_p2_0.vqh" +#include "books/coupled/_44c2_s0_p3_0.vqh" +#include "books/coupled/_44c2_s0_p4_0.vqh" +#include "books/coupled/_44c2_s0_p4_1.vqh" +#include "books/coupled/_44c2_s0_p5_0.vqh" +#include "books/coupled/_44c2_s1_p5_0.vqh" +#include "books/coupled/_44c2_s0_p6_0.vqh" +#include "books/coupled/_44c2_s1_p6_0.vqh" +#include "books/coupled/_44c2_s2_p6_0.vqh" +#include "books/coupled/_44c2_s0_p7_0.vqh" +#include "books/coupled/_44c2_s0_p7_1.vqh" +#include "books/coupled/_44c2_s0_p7_2.vqh" +#include "books/coupled/_44c2_s1_p7_0.vqh" +#include "books/coupled/_44c2_s1_p7_1.vqh" +#include "books/coupled/_44c2_s1_p7_2.vqh" +#include "books/coupled/_44c2_s2_p7_0.vqh" +#include "books/coupled/_44c2_s2_p7_1.vqh" +#include "books/coupled/_44c2_s2_p7_2.vqh" +#include "books/coupled/_44c2_s3_p7_0.vqh" +#include "books/coupled/_44c2_s3_p7_1.vqh" +#include "books/coupled/_44c2_s3_p7_2.vqh" + + +#include "books/coupled/_44c3_short.vqh" +#include "books/coupled/_44c3_long.vqh" + +#include "books/coupled/_44c3_s0_p1_0.vqh" +#include "books/coupled/_44c3_s0_p2_0.vqh" +#include "books/coupled/_44c3_s0_p3_0.vqh" +#include "books/coupled/_44c3_s0_p4_0.vqh" +#include "books/coupled/_44c3_s0_p4_1.vqh" +#include "books/coupled/_44c3_s0_p5_0.vqh" +#include "books/coupled/_44c3_s1_p5_0.vqh" +#include "books/coupled/_44c3_s0_p6_0.vqh" +#include "books/coupled/_44c3_s1_p6_0.vqh" +#include "books/coupled/_44c3_s2_p6_0.vqh" +#include "books/coupled/_44c3_s0_p7_0.vqh" +#include "books/coupled/_44c3_s0_p7_1.vqh" +#include "books/coupled/_44c3_s0_p7_2.vqh" +#include "books/coupled/_44c3_s1_p7_0.vqh" +#include "books/coupled/_44c3_s1_p7_1.vqh" +#include "books/coupled/_44c3_s1_p7_2.vqh" +#include "books/coupled/_44c3_s2_p7_0.vqh" +#include "books/coupled/_44c3_s2_p7_1.vqh" +#include "books/coupled/_44c3_s2_p7_2.vqh" +#include "books/coupled/_44c3_s3_p7_0.vqh" +#include "books/coupled/_44c3_s3_p7_1.vqh" +#include "books/coupled/_44c3_s3_p7_2.vqh" + +#include "books/coupled/_44c4_short.vqh" +#include "books/coupled/_44c4_long.vqh" + +#include "books/coupled/_44c4_s0_p1_0.vqh" +#include "books/coupled/_44c4_s0_p2_0.vqh" +#include "books/coupled/_44c4_s1_p2_0.vqh" +#include "books/coupled/_44c4_s0_p3_0.vqh" +#include "books/coupled/_44c4_s0_p4_0.vqh" +#include "books/coupled/_44c4_s1_p4_0.vqh" +#include "books/coupled/_44c4_s0_p5_0.vqh" +#include "books/coupled/_44c4_s0_p6_0.vqh" +#include "books/coupled/_44c4_s1_p6_0.vqh" +#include "books/coupled/_44c4_s2_p6_0.vqh" +#include "books/coupled/_44c4_s0_p7_0.vqh" +#include "books/coupled/_44c4_s0_p7_1.vqh" +#include "books/coupled/_44c4_s1_p7_0.vqh" +#include "books/coupled/_44c4_s1_p7_1.vqh" +#include "books/coupled/_44c4_s2_p7_0.vqh" +#include "books/coupled/_44c4_s2_p7_1.vqh" +#include "books/coupled/_44c4_s3_p7_0.vqh" +#include "books/coupled/_44c4_s3_p7_1.vqh" +#include "books/coupled/_44c4_s0_p8_0.vqh" +#include "books/coupled/_44c4_s0_p8_1.vqh" +#include "books/coupled/_44c4_s1_p8_0.vqh" +#include "books/coupled/_44c4_s1_p8_1.vqh" +#include "books/coupled/_44c4_s2_p8_0.vqh" +#include "books/coupled/_44c4_s2_p8_1.vqh" +#include "books/coupled/_44c4_s3_p8_0.vqh" +#include "books/coupled/_44c4_s3_p8_1.vqh" +#include "books/coupled/_44c4_s0_p9_0.vqh" +#include "books/coupled/_44c4_s0_p9_1.vqh" +#include "books/coupled/_44c4_s0_p9_2.vqh" +#include "books/coupled/_44c4_s1_p9_0.vqh" +#include "books/coupled/_44c4_s1_p9_1.vqh" +#include "books/coupled/_44c4_s1_p9_2.vqh" +#include "books/coupled/_44c4_s2_p9_0.vqh" +#include "books/coupled/_44c4_s2_p9_1.vqh" +#include "books/coupled/_44c4_s2_p9_2.vqh" +#include "books/coupled/_44c4_s3_p9_0.vqh" +#include "books/coupled/_44c4_s3_p9_1.vqh" +#include "books/coupled/_44c4_s3_p9_2.vqh" + +#include "books/coupled/_44c4_s1_p2_s0.vqh" +#include "books/coupled/_44c4_s1_p4_s0.vqh" +#include "books/coupled/_44c4_s1_p6_s0.vqh" +#include "books/coupled/_44c4_s1_p7_s0.vqh" +#include "books/coupled/_44c4_s1_p8_s0.vqh" +#include "books/coupled/_44c4_s1_p9_s0.vqh" + +#include "books/coupled/_44c4_s2_p6_s0.vqh" +#include "books/coupled/_44c4_s2_p7_s0.vqh" +#include "books/coupled/_44c4_s2_p8_s0.vqh" +#include "books/coupled/_44c4_s2_p9_s0.vqh" + +#include "books/coupled/_44c4_s3_p9_s0.vqh" + +#include "books/coupled/_44c4_s0_p0_r0.vqh" +#include "books/coupled/_44c4_s0_p0_r1.vqh" +#include "books/coupled/_44c4_s0_pN_r0.vqh" +#include "books/coupled/_44c4_s0_pN_r1.vqh" +#include "books/coupled/_44c4_s1_pS_r0.vqh" +#include "books/coupled/_44c4_s1_pS_r1.vqh" + +#include "books/coupled/_44c5_short.vqh" +#include "books/coupled/_44c5_long.vqh" + +#include "books/coupled/_44c5_s0_p1_0.vqh" +#include "books/coupled/_44c5_s0_p2_0.vqh" +#include "books/coupled/_44c5_s1_p2_0.vqh" +#include "books/coupled/_44c5_s0_p3_0.vqh" +#include "books/coupled/_44c5_s0_p4_0.vqh" +#include "books/coupled/_44c5_s1_p4_0.vqh" +#include "books/coupled/_44c5_s0_p5_0.vqh" +#include "books/coupled/_44c5_s0_p6_0.vqh" +#include "books/coupled/_44c5_s1_p6_0.vqh" +#include "books/coupled/_44c5_s2_p6_0.vqh" +#include "books/coupled/_44c5_s0_p7_0.vqh" +#include "books/coupled/_44c5_s0_p7_1.vqh" +#include "books/coupled/_44c5_s1_p7_0.vqh" +#include "books/coupled/_44c5_s1_p7_1.vqh" +#include "books/coupled/_44c5_s2_p7_0.vqh" +#include "books/coupled/_44c5_s2_p7_1.vqh" +#include "books/coupled/_44c5_s3_p7_0.vqh" +#include "books/coupled/_44c5_s3_p7_1.vqh" +#include "books/coupled/_44c5_s0_p8_0.vqh" +#include "books/coupled/_44c5_s0_p8_1.vqh" +#include "books/coupled/_44c5_s1_p8_0.vqh" +#include "books/coupled/_44c5_s1_p8_1.vqh" +#include "books/coupled/_44c5_s2_p8_0.vqh" +#include "books/coupled/_44c5_s2_p8_1.vqh" +#include "books/coupled/_44c5_s3_p8_0.vqh" +#include "books/coupled/_44c5_s3_p8_1.vqh" +#include "books/coupled/_44c5_s0_p9_0.vqh" +#include "books/coupled/_44c5_s0_p9_1.vqh" +#include "books/coupled/_44c5_s0_p9_2.vqh" +#include "books/coupled/_44c5_s1_p9_0.vqh" +#include "books/coupled/_44c5_s1_p9_1.vqh" +#include "books/coupled/_44c5_s1_p9_2.vqh" +#include "books/coupled/_44c5_s2_p9_0.vqh" +#include "books/coupled/_44c5_s2_p9_1.vqh" +#include "books/coupled/_44c5_s2_p9_2.vqh" +#include "books/coupled/_44c5_s3_p9_0.vqh" +#include "books/coupled/_44c5_s3_p9_1.vqh" +#include "books/coupled/_44c5_s3_p9_2.vqh" + +#include "books/coupled/_44c6_short.vqh" +#include "books/coupled/_44c6_long.vqh" + +#include "books/coupled/_44c6_s0_p1_0.vqh" +#include "books/coupled/_44c6_s0_p2_0.vqh" +#include "books/coupled/_44c6_s1_p2_0.vqh" +#include "books/coupled/_44c6_s0_p3_0.vqh" +#include "books/coupled/_44c6_s0_p4_0.vqh" +#include "books/coupled/_44c6_s1_p4_0.vqh" +#include "books/coupled/_44c6_s0_p5_0.vqh" +#include "books/coupled/_44c6_s0_p6_0.vqh" +#include "books/coupled/_44c6_s1_p6_0.vqh" +#include "books/coupled/_44c6_s2_p6_0.vqh" +#include "books/coupled/_44c6_s0_p7_0.vqh" +#include "books/coupled/_44c6_s0_p7_1.vqh" +#include "books/coupled/_44c6_s1_p7_0.vqh" +#include "books/coupled/_44c6_s1_p7_1.vqh" +#include "books/coupled/_44c6_s2_p7_0.vqh" +#include "books/coupled/_44c6_s2_p7_1.vqh" +#include "books/coupled/_44c6_s3_p7_0.vqh" +#include "books/coupled/_44c6_s3_p7_1.vqh" +#include "books/coupled/_44c6_s0_p8_0.vqh" +#include "books/coupled/_44c6_s0_p8_1.vqh" +#include "books/coupled/_44c6_s1_p8_0.vqh" +#include "books/coupled/_44c6_s1_p8_1.vqh" +#include "books/coupled/_44c6_s2_p8_0.vqh" +#include "books/coupled/_44c6_s2_p8_1.vqh" +#include "books/coupled/_44c6_s3_p8_0.vqh" +#include "books/coupled/_44c6_s3_p8_1.vqh" +#include "books/coupled/_44c6_s0_p9_0.vqh" +#include "books/coupled/_44c6_s0_p9_1.vqh" +#include "books/coupled/_44c6_s0_p9_2.vqh" +#include "books/coupled/_44c6_s1_p9_0.vqh" +#include "books/coupled/_44c6_s1_p9_1.vqh" +#include "books/coupled/_44c6_s1_p9_2.vqh" +#include "books/coupled/_44c6_s2_p9_0.vqh" +#include "books/coupled/_44c6_s2_p9_1.vqh" +#include "books/coupled/_44c6_s2_p9_2.vqh" +#include "books/coupled/_44c6_s3_p9_0.vqh" +#include "books/coupled/_44c6_s3_p9_1.vqh" +#include "books/coupled/_44c6_s3_p9_2.vqh" + +#include "books/coupled/_44c7_short.vqh" +#include "books/coupled/_44c7_long.vqh" + +#include "books/coupled/_44c7_s0_p1_0.vqh" +#include "books/coupled/_44c7_s0_p1_1.vqh" +#include "books/coupled/_44c7_s0_p2_0.vqh" +#include "books/coupled/_44c7_s0_p2_1.vqh" +#include "books/coupled/_44c7_s0_p3_0.vqh" +#include "books/coupled/_44c7_s0_p4_0.vqh" +#include "books/coupled/_44c7_s0_p5_0.vqh" +#include "books/coupled/_44c7_s0_p6_0.vqh" +#include "books/coupled/_44c7_s0_p6_1.vqh" +#include "books/coupled/_44c7_s0_p7_0.vqh" +#include "books/coupled/_44c7_s0_p7_1.vqh" +#include "books/coupled/_44c7_s0_p8_0.vqh" +#include "books/coupled/_44c7_s0_p8_1.vqh" +#include "books/coupled/_44c7_s0_p9_0.vqh" +#include "books/coupled/_44c7_s0_p9_1.vqh" +#include "books/coupled/_44c7_s0_p9_2.vqh" + +#include "books/coupled/_44c7_s0_p0_r0.vqh" +#include "books/coupled/_44c7_s0_p0_r1.vqh" +#include "books/coupled/_44c7_s0_pN_r0.vqh" +#include "books/coupled/_44c7_s0_pN_r1.vqh" + +#include "books/coupled/_44c8_short.vqh" +#include "books/coupled/_44c8_long.vqh" + +#include "books/coupled/_44c8_s0_p1_0.vqh" +#include "books/coupled/_44c8_s0_p1_1.vqh" +#include "books/coupled/_44c8_s0_p2_0.vqh" +#include "books/coupled/_44c8_s0_p2_1.vqh" +#include "books/coupled/_44c8_s0_p3_0.vqh" +#include "books/coupled/_44c8_s0_p4_0.vqh" +#include "books/coupled/_44c8_s0_p5_0.vqh" +#include "books/coupled/_44c8_s0_p6_0.vqh" +#include "books/coupled/_44c8_s0_p6_1.vqh" +#include "books/coupled/_44c8_s0_p7_0.vqh" +#include "books/coupled/_44c8_s0_p7_1.vqh" +#include "books/coupled/_44c8_s0_p8_0.vqh" +#include "books/coupled/_44c8_s0_p8_1.vqh" +#include "books/coupled/_44c8_s0_p9_0.vqh" +#include "books/coupled/_44c8_s0_p9_1.vqh" +#include "books/coupled/_44c8_s0_p9_2.vqh" + +#include "books/coupled/_44c9_short.vqh" +#include "books/coupled/_44c9_long.vqh" + +#include "books/coupled/_44c9_s0_p1_0.vqh" +#include "books/coupled/_44c9_s0_p1_1.vqh" +#include "books/coupled/_44c9_s0_p2_0.vqh" +#include "books/coupled/_44c9_s0_p2_1.vqh" +#include "books/coupled/_44c9_s0_p3_0.vqh" +#include "books/coupled/_44c9_s0_p4_0.vqh" +#include "books/coupled/_44c9_s0_p5_0.vqh" +#include "books/coupled/_44c9_s0_p6_0.vqh" +#include "books/coupled/_44c9_s0_p6_1.vqh" +#include "books/coupled/_44c9_s0_p7_0.vqh" +#include "books/coupled/_44c9_s0_p7_1.vqh" +#include "books/coupled/_44c9_s0_p8_0.vqh" +#include "books/coupled/_44c9_s0_p8_1.vqh" +#include "books/coupled/_44c9_s0_p9_0.vqh" +#include "books/coupled/_44c9_s0_p9_1.vqh" +#include "books/coupled/_44c9_s0_p9_2.vqh" + +/* residue backfill is entered in the template array as if stereo + backfill is not in use. It's up to vorbisenc to make the + appropriate index adjustment */ +static vorbis_residue_template _residue_template_44_stereo[11]={ + /* mode 0; 64-ish */ + {{&_residue_44_low, &_residue_44_low}, + {&_huff_book__44c0_short,&_huff_book__44c0_long}, + /* mostly temporary entries pending training */ + { {{0},{0,0,&_44c0_s0_p1_0},{0,0,&_44c0_s0_p2_0},{0,0,&_44c0_s0_p3_0}, + {&_44c0_s0_p4_0,&_44c0_s0_p4_1},{0,0,&_44c0_s0_p5_0},{0,0,&_44c0_s0_p6_0}, + {&_44c0_s0_p7_0,&_44c0_s0_p7_1,&_44c0_s0_p7_2}}, /* lossless stereo */ + {{0},{0,0,&_44c0_s0_p1_0},{0,0,&_44c0_s0_p2_0},{0,0,&_44c0_s0_p3_0}, + {&_44c0_s0_p4_0,&_44c0_s0_p4_1},{0,0,&_44c0_s1_p5_0},{0,0,&_44c0_s1_p6_0}, + {&_44c0_s1_p7_0,&_44c0_s1_p7_1,&_44c0_s1_p7_2}}, /* 6dB (2.5) stereo */ + {{0},{0,0,&_44c0_s0_p1_0},{0,0,&_44c0_s0_p2_0},{0,0,&_44c0_s0_p3_0}, + {&_44c0_s0_p4_0,&_44c0_s0_p4_1},{0,0,&_44c0_s1_p5_0},{0,0,&_44c0_s2_p6_0}, + {&_44c0_s2_p7_0,&_44c0_s2_p7_1,&_44c0_s2_p7_2}}, /* 12dB (4.5) stereo */ + {{0},{0,0,&_44c0_s0_p1_0},{0,0,&_44c0_s0_p2_0},{0,0,&_44c0_s0_p3_0}, + {&_44c0_s0_p4_0,&_44c0_s0_p4_1},{0,0,&_44c0_s1_p5_0},{0,0,&_44c0_s2_p6_0}, + {&_44c0_s3_p7_0,&_44c0_s3_p7_1,&_44c0_s3_p7_2}}, /* 18dB (8.5) stereo */ + {{0}}, /* 24dB (16.5) stereo */ + }, + { {0}, /* lossless stereo */ + {0,0,0,0,0,&_44c0_s1_p5_s0,&_44c0_s1_p6_s0,&_44c0_s1_p7_s0}, /* 6dB (2.5) stereo */ + {0,0,0,0,0,0,&_44c0_s2_p6_s0,&_44c0_s2_p7_s0}, /* 12dB (4.5) stereo */ + {0,0,0,0,0,0,0,&_44c0_s3_p7_s0}, /* 18dB (8.5) stereo */ + {0}, + }, + { + {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* lossless stereo */ + {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 6dB (2.5) stereo */ + {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 12dB (4.5) stereo */ + {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 18dB (8.5) stereo */ + {{0}}, /* 24dB (16.5) stereo */ + }, + }, + /* mode 1; 80-ish */ + {{&_residue_44_low, &_residue_44_low}, + {&_huff_book__44c1_short,&_huff_book__44c1_long}, + /* mostly temporary entries pending training */ + { {{0},{0,0,&_44c1_s0_p1_0},{0,0,&_44c1_s0_p2_0},{0,0,&_44c1_s0_p3_0}, + {&_44c1_s0_p4_0,&_44c1_s0_p4_1},{0,0,&_44c1_s0_p5_0},{0,0,&_44c1_s0_p6_0}, + {&_44c1_s0_p7_0,&_44c1_s0_p7_1,&_44c1_s0_p7_2}}, /* lossless stereo */ + {{0},{0,0,&_44c1_s0_p1_0},{0,0,&_44c1_s0_p2_0},{0,0,&_44c1_s0_p3_0}, + {&_44c1_s0_p4_0,&_44c1_s0_p4_1},{0,0,&_44c1_s1_p5_0},{0,0,&_44c1_s1_p6_0}, + {&_44c1_s1_p7_0,&_44c1_s1_p7_1,&_44c1_s1_p7_2}}, /* 6dB (2.5) stereo */ + {{0},{0,0,&_44c1_s0_p1_0},{0,0,&_44c1_s0_p2_0},{0,0,&_44c1_s0_p3_0}, + {&_44c1_s0_p4_0,&_44c1_s0_p4_1},{0,0,&_44c1_s1_p5_0},{0,0,&_44c1_s2_p6_0}, + {&_44c1_s2_p7_0,&_44c1_s2_p7_1,&_44c1_s2_p7_2}}, /* 12dB (4.5) stereo */ + {{0},{0,0,&_44c1_s0_p1_0},{0,0,&_44c1_s0_p2_0},{0,0,&_44c1_s0_p3_0}, + {&_44c1_s0_p4_0,&_44c1_s0_p4_1},{0,0,&_44c1_s1_p5_0},{0,0,&_44c1_s2_p6_0}, + {&_44c1_s3_p7_0,&_44c1_s3_p7_1,&_44c1_s3_p7_2}}, /* 18dB (8.5) stereo */ + {{0}}, /* 24dB (16.5) stereo */ + }, + { {0}, /* lossless stereo */ + {0,0,0,0,0,&_44c0_s1_p5_s0,&_44c0_s1_p6_s0,&_44c0_s1_p7_s0}, /* 6dB (2.5) stereo */ + {0,0,0,0,0,0,&_44c0_s2_p6_s0,&_44c0_s2_p7_s0}, /* 12dB (4.5) stereo */ + {0,0,0,0,0,0,0,&_44c0_s3_p7_s0}, /* 18dB (8.5) stereo */ + {0}, + }, + { + {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* lossless stereo */ + {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 6dB (2.5) stereo */ + {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 12dB (4.5) stereo */ + {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 18dB (8.5) stereo */ + {{0}}, /* 24dB (16.5) stereo */ + }, + }, + /* mode 2; 96-ish */ + {{&_residue_44_low, &_residue_44_low}, + {&_huff_book__44c2_short,&_huff_book__44c2_long}, + /* mostly temporary entries pending training */ + { {{0},{0,0,&_44c2_s0_p1_0},{0,0,&_44c2_s0_p2_0},{0,0,&_44c2_s0_p3_0}, + {&_44c2_s0_p4_0,&_44c2_s0_p4_1},{0,0,&_44c2_s0_p5_0},{0,0,&_44c2_s0_p6_0}, + {&_44c2_s0_p7_0,&_44c2_s0_p7_1,&_44c2_s0_p7_2}}, /* lossless stereo */ + {{0},{0,0,&_44c2_s0_p1_0},{0,0,&_44c2_s0_p2_0},{0,0,&_44c2_s0_p3_0}, + {&_44c2_s0_p4_0,&_44c2_s0_p4_1},{0,0,&_44c2_s1_p5_0},{0,0,&_44c2_s1_p6_0}, + {&_44c2_s1_p7_0,&_44c2_s1_p7_1,&_44c2_s1_p7_2}}, /* 6dB (2.5) stereo */ + {{0},{0,0,&_44c2_s0_p1_0},{0,0,&_44c2_s0_p2_0},{0,0,&_44c2_s0_p3_0}, + {&_44c2_s0_p4_0,&_44c2_s0_p4_1},{0,0,&_44c2_s1_p5_0},{0,0,&_44c2_s2_p6_0}, + {&_44c2_s2_p7_0,&_44c2_s2_p7_1,&_44c2_s2_p7_2}}, /* 12dB (4.5) stereo */ + {{0},{0,0,&_44c2_s0_p1_0},{0,0,&_44c2_s0_p2_0},{0,0,&_44c2_s0_p3_0}, + {&_44c2_s0_p4_0,&_44c2_s0_p4_1},{0,0,&_44c2_s1_p5_0},{0,0,&_44c2_s2_p6_0}, + {&_44c2_s3_p7_0,&_44c2_s3_p7_1,&_44c2_s3_p7_2}}, /* 18dB (8.5) stereo */ + {{0}}, /* 24dB (16.5) stereo */ + }, + { {0}, /* lossless stereo */ + {0,0,0,0,0,&_44c0_s1_p5_s0,&_44c0_s1_p6_s0,&_44c0_s1_p7_s0}, /* 6dB (2.5) stereo */ + {0,0,0,0,0,0,&_44c0_s2_p6_s0,&_44c0_s2_p7_s0}, /* 12dB (4.5) stereo */ + {0,0,0,0,0,0,0,&_44c0_s3_p7_s0}, /* 18dB (8.5) stereo */ + {0}, + }, + { + {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* lossless stereo */ + {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 6dB (2.5) stereo */ + {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 12dB (4.5) stereo */ + {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 18dB (8.5) stereo */ + {{0}}, /* 24dB (16.5) stereo */ + }, + }, + /* mode 3; 112-ish */ + {{&_residue_44_low, &_residue_44_low}, + {&_huff_book__44c3_short,&_huff_book__44c3_long}, + /* mostly temporary entries pending training */ + { {{0},{0,0,&_44c3_s0_p1_0},{0,0,&_44c3_s0_p2_0},{0,0,&_44c3_s0_p3_0}, + {&_44c3_s0_p4_0,&_44c3_s0_p4_1},{0,0,&_44c3_s0_p5_0},{0,0,&_44c3_s0_p6_0}, + {&_44c3_s0_p7_0,&_44c3_s0_p7_1,&_44c3_s0_p7_2}}, /* lossless stereo */ + {{0},{0,0,&_44c3_s0_p1_0},{0,0,&_44c3_s0_p2_0},{0,0,&_44c3_s0_p3_0}, + {&_44c3_s0_p4_0,&_44c3_s0_p4_1},{0,0,&_44c3_s1_p5_0},{0,0,&_44c3_s1_p6_0}, + {&_44c3_s1_p7_0,&_44c3_s1_p7_1,&_44c3_s1_p7_2}}, /* 6dB (2.5) stereo */ + {{0},{0,0,&_44c3_s0_p1_0},{0,0,&_44c3_s0_p2_0},{0,0,&_44c3_s0_p3_0}, + {&_44c3_s0_p4_0,&_44c3_s0_p4_1},{0,0,&_44c3_s1_p5_0},{0,0,&_44c3_s2_p6_0}, + {&_44c3_s2_p7_0,&_44c3_s2_p7_1,&_44c3_s2_p7_2}}, /* 12dB (4.5) stereo */ + {{0},{0,0,&_44c3_s0_p1_0},{0,0,&_44c3_s0_p2_0},{0,0,&_44c3_s0_p3_0}, + {&_44c3_s0_p4_0,&_44c3_s0_p4_1},{0,0,&_44c3_s1_p5_0},{0,0,&_44c3_s2_p6_0}, + {&_44c3_s3_p7_0,&_44c3_s3_p7_1,&_44c3_s3_p7_2}}, /* 18dB (8.5) stereo */ + {{0}}, /* 24dB (16.5) stereo */ + }, + { {0}, /* lossless stereo */ + {0,0,0,0,0,&_44c0_s1_p5_s0,&_44c0_s1_p6_s0,&_44c0_s1_p7_s0}, /* 6dB (2.5) stereo */ + {0,0,0,0,0,0,&_44c0_s2_p6_s0,&_44c0_s2_p7_s0}, /* 12dB (4.5) stereo */ + {0,0,0,0,0,0,0,&_44c0_s3_p7_s0}, /* 18dB (8.5) stereo */ + {0}, + }, + { + {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* lossless stereo */ + {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 6dB (2.5) stereo */ + {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 12dB (4.5) stereo */ + {{&_44c0_s0_p0_r0,&_44c0_s0_p0_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s1_pS_r0,&_44c0_s1_pS_r1}, + {&_44c0_s0_pN_r0,&_44c0_s0_pN_r1}}, /* 18dB (8.5) stereo */ + {{0}}, /* 24dB (16.5) stereo */ + }, + }, + + /* mode 4; 128-ish */ + {{&_residue_44_mid, &_residue_44_mid}, + {&_huff_book__44c4_short,&_huff_book__44c4_long}, + { + {{0},{0,0,&_44c4_s0_p1_0},{0,0,&_44c4_s0_p2_0},{0,0,&_44c4_s0_p3_0}, + {0,0,&_44c4_s0_p4_0},{0,0,&_44c4_s0_p5_0},{0,0,&_44c4_s0_p6_0}, + {&_44c4_s0_p7_0,&_44c4_s0_p7_1},{&_44c4_s0_p8_0,&_44c4_s0_p8_1}, + {&_44c4_s0_p9_0,&_44c4_s0_p9_1,&_44c4_s0_p9_2}}, + {{0},{0,0,&_44c4_s0_p1_0},{0,0,&_44c4_s1_p2_0},{0,0,&_44c4_s0_p3_0}, + {0,0,&_44c4_s1_p4_0},{0,0,&_44c4_s0_p5_0},{0,0,&_44c4_s1_p6_0}, + {&_44c4_s1_p7_0,&_44c4_s1_p7_1},{&_44c4_s1_p8_0,&_44c4_s1_p8_1}, + {&_44c4_s1_p9_0,&_44c4_s1_p9_1,&_44c4_s1_p9_2}}, + {{0},{0,0,&_44c4_s0_p1_0},{0,0,&_44c4_s1_p2_0},{0,0,&_44c4_s0_p3_0}, + {0,0,&_44c4_s1_p4_0},{0,0,&_44c4_s0_p5_0},{0,0,&_44c4_s2_p6_0}, + {&_44c4_s2_p7_0,&_44c4_s2_p7_1},{&_44c4_s2_p8_0,&_44c4_s2_p8_1}, + {&_44c4_s2_p9_0,&_44c4_s2_p9_1,&_44c4_s2_p9_2}}, + {{0},{0,0,&_44c4_s0_p1_0},{0,0,&_44c4_s1_p2_0},{0,0,&_44c4_s0_p3_0}, + {0,0,&_44c4_s1_p4_0},{0,0,&_44c4_s0_p5_0},{0,0,&_44c4_s2_p6_0}, + {&_44c4_s3_p7_0,&_44c4_s3_p7_1},{&_44c4_s3_p8_0,&_44c4_s3_p8_1}, + {&_44c4_s3_p9_0,&_44c4_s3_p9_1,&_44c4_s3_p9_2}}, + {{0}}, /* 24dB (16.5) stereo */ + }, + + { {0}, /* lossless stereo */ + {0,0,&_44c4_s1_p2_s0,0,&_44c4_s1_p4_s0,0,&_44c4_s1_p6_s0,&_44c4_s1_p7_s0, + &_44c4_s1_p8_s0,&_44c4_s1_p9_s0}, /* (2.5) stereo */ + {0,0,0,0,0,0,&_44c4_s2_p6_s0,&_44c4_s2_p7_s0,&_44c4_s2_p8_s0, + &_44c4_s2_p9_s0}, /* (4.5) stereo */ + {0,0,0,0,0,0,0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0}, /* (8.5) stereo */ + {0}, + }, + { + {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* lossless stereo */ + {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 6dB stereo */ + {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 12dB stereo */ + {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 18dB stereo */ + {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 24dB stereo */ + }, + }, + /* mode 5; 160-ish */ + {{&_residue_44_mid, &_residue_44_mid}, + {&_huff_book__44c5_short,&_huff_book__44c5_long}, + { + {{0},{0,0,&_44c5_s0_p1_0},{0,0,&_44c5_s0_p2_0},{0,0,&_44c5_s0_p3_0}, + {0,0,&_44c5_s0_p4_0},{0,0,&_44c5_s0_p5_0},{0,0,&_44c5_s0_p6_0}, + {&_44c5_s0_p7_0,&_44c5_s0_p7_1},{&_44c5_s0_p8_0,&_44c5_s0_p8_1}, + {&_44c5_s0_p9_0,&_44c5_s0_p9_1,&_44c5_s0_p9_2}}, + {{0},{0,0,&_44c5_s0_p1_0},{0,0,&_44c5_s1_p2_0},{0,0,&_44c5_s0_p3_0}, + {0,0,&_44c5_s1_p4_0},{0,0,&_44c5_s0_p5_0},{0,0,&_44c5_s1_p6_0}, + {&_44c5_s1_p7_0,&_44c5_s1_p7_1},{&_44c5_s1_p8_0,&_44c5_s1_p8_1}, + {&_44c5_s1_p9_0,&_44c5_s1_p9_1,&_44c5_s1_p9_2}}, + {{0},{0,0,&_44c5_s0_p1_0},{0,0,&_44c5_s1_p2_0},{0,0,&_44c5_s0_p3_0}, + {0,0,&_44c5_s1_p4_0},{0,0,&_44c5_s0_p5_0},{0,0,&_44c5_s2_p6_0}, + {&_44c5_s2_p7_0,&_44c5_s2_p7_1},{&_44c5_s2_p8_0,&_44c5_s2_p8_1}, + {&_44c5_s2_p9_0,&_44c5_s2_p9_1,&_44c5_s2_p9_2}}, + {{0},{0,0,&_44c5_s0_p1_0},{0,0,&_44c5_s1_p2_0},{0,0,&_44c5_s0_p3_0}, + {0,0,&_44c5_s1_p4_0},{0,0,&_44c5_s0_p5_0},{0,0,&_44c5_s2_p6_0}, + {&_44c5_s3_p7_0,&_44c5_s3_p7_1},{&_44c5_s3_p8_0,&_44c5_s3_p8_1}, + {&_44c5_s3_p9_0,&_44c5_s3_p9_1,&_44c5_s3_p9_2}}, + {{0}}, /* 24dB (16.5) stereo */ + }, + + { {0}, /* lossless stereo */ + {0,0,&_44c4_s1_p2_s0,0,&_44c4_s1_p4_s0,0,&_44c4_s1_p6_s0,&_44c4_s1_p7_s0, + &_44c4_s1_p8_s0,&_44c4_s1_p9_s0}, /* (2.5) stereo */ + {0,0,0,0,0,0,&_44c4_s2_p6_s0,&_44c4_s2_p7_s0,&_44c4_s2_p8_s0, + &_44c4_s2_p9_s0}, /* (4.5) stereo */ + {0,0,0,0,0,0,0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0}, /* (8.5) stereo */ + {0}, + }, + { + {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* lossless stereo */ + {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 6dB stereo */ + {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 12dB stereo */ + {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 18dB stereo */ + {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 24dB stereo */ + }, + }, + /* mode 6; 192-ish */ + {{&_residue_44_mid, &_residue_44_mid}, + {&_huff_book__44c6_short,&_huff_book__44c6_long}, + { + {{0},{0,0,&_44c6_s0_p1_0},{0,0,&_44c6_s0_p2_0},{0,0,&_44c6_s0_p3_0}, + {0,0,&_44c6_s0_p4_0},{0,0,&_44c6_s0_p5_0},{0,0,&_44c6_s0_p6_0}, + {&_44c6_s0_p7_0,&_44c6_s0_p7_1},{&_44c6_s0_p8_0,&_44c6_s0_p8_1}, + {&_44c6_s0_p9_0,&_44c6_s0_p9_1,&_44c6_s0_p9_2}}, + {{0},{0,0,&_44c6_s0_p1_0},{0,0,&_44c6_s1_p2_0},{0,0,&_44c6_s0_p3_0}, + {0,0,&_44c6_s1_p4_0},{0,0,&_44c6_s0_p5_0},{0,0,&_44c6_s1_p6_0}, + {&_44c6_s1_p7_0,&_44c6_s1_p7_1},{&_44c6_s1_p8_0,&_44c6_s1_p8_1}, + {&_44c6_s1_p9_0,&_44c6_s1_p9_1,&_44c6_s1_p9_2}}, + {{0},{0,0,&_44c6_s0_p1_0},{0,0,&_44c6_s1_p2_0},{0,0,&_44c6_s0_p3_0}, + {0,0,&_44c6_s1_p4_0},{0,0,&_44c6_s0_p5_0},{0,0,&_44c6_s2_p6_0}, + {&_44c6_s2_p7_0,&_44c6_s2_p7_1},{&_44c6_s2_p8_0,&_44c6_s2_p8_1}, + {&_44c6_s2_p9_0,&_44c6_s2_p9_1,&_44c6_s2_p9_2}}, + {{0},{0,0,&_44c6_s0_p1_0},{0,0,&_44c6_s1_p2_0},{0,0,&_44c6_s0_p3_0}, + {0,0,&_44c6_s1_p4_0},{0,0,&_44c6_s0_p5_0},{0,0,&_44c6_s2_p6_0}, + {&_44c6_s3_p7_0,&_44c6_s3_p7_1},{&_44c6_s3_p8_0,&_44c6_s3_p8_1}, + {&_44c6_s3_p9_0,&_44c6_s3_p9_1,&_44c6_s3_p9_2}}, + {{0}}, /* 24dB (16.5) stereo */ + }, + + { {0}, /* lossless stereo */ + {0,0,&_44c4_s1_p2_s0,0,&_44c4_s1_p4_s0,0,&_44c4_s1_p6_s0,&_44c4_s1_p7_s0, + &_44c4_s1_p8_s0,&_44c4_s1_p9_s0}, /* (2.5) stereo */ + {0,0,0,0,0,0,&_44c4_s2_p6_s0,&_44c4_s2_p7_s0,&_44c4_s2_p8_s0, + &_44c4_s2_p9_s0}, /* (4.5) stereo */ + {0,0,0,0,0,0,0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0,&_44c4_s3_p9_s0}, /* (8.5) stereo */ + {0}, + }, + { + {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* lossless stereo */ + {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 6dB stereo */ + {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 12dB stereo */ + {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 18dB stereo */ + {{&_44c4_s0_p0_r0,&_44c4_s0_p0_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s1_pS_r0,&_44c4_s1_pS_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}, + {&_44c4_s0_pN_r0,&_44c4_s0_pN_r1}}, /* 24dB stereo */ + }, + }, + + /* mode 7; 224-ish */ + {{&_residue_44_high, &_residue_44_high}, + {&_huff_book__44c7_short,&_huff_book__44c7_long}, + { {{0},{&_44c7_s0_p1_0,&_44c7_s0_p1_1}, + {&_44c7_s0_p2_0,&_44c7_s0_p2_1}, + {0,0,&_44c7_s0_p3_0},{0,0,&_44c7_s0_p4_0},{0,0,&_44c7_s0_p5_0}, + {&_44c7_s0_p6_0,&_44c7_s0_p6_1}, + {&_44c7_s0_p7_0,&_44c7_s0_p7_1}, + {&_44c7_s0_p8_0,&_44c7_s0_p8_1}, + {&_44c7_s0_p9_0,&_44c7_s0_p9_1,&_44c7_s0_p9_2}}, + {{0}}, /* 6dB (2.5) stereo */ + {{0}}, /* 12dB (4.5) stereo */ + {{0}}, /* 18dB (8.5) stereo */ + {{0}}, /* 24dB (16.5) stereo */ + }, + { {0}, /* lossless stereo */ + {0}, /* 6dB (2.5) stereo */ + {0}, /* 12dB (4.5) stereo */ + {0}, /* 18dB (8.5) stereo */ + {0}, + //{0,0,0,0,0,0,0,0,&44c0_s4_s8,&44c0_s4_s9},/* 24dB (16.5) stereo */ + }, + { + {{&_44c7_s0_p0_r0,&_44c7_s0_p0_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}}, /* lossless stereo */ + {{0}}, /* 6dB (2.5) stereo */ + {{0}}, /* 12dB (4.5) stereo */ + {{0}}, /* 18dB (8.5) stereo */ + //{{&44c0_s0_r0_0,&44c0_s0_r0_1},{&44c0_s0_r1_0,&44c0_s0_r1_1}, + // {&44c0_s0_r2_0,&44c0_s0_r2_1},{&44c0_s0_r3_0,&44c0_s0_r3_1}, + // {&44c0_s0_r4_0,&44c0_s0_r4_1},{&44c0_s1_r5_0,&44c0_s1_r5_1}, + // {&44c0_s1_r6_0,&44c0_s1_r6_1},{&44c0_s2_r7_0,&44c0_s2_r7_1}, + // {&44c0_s4_r8_0,&44c0_s3_r8_1},{&44c0_s4_r9_0,&44c0_s3_r9_1}}, /* 18dB (8.5) stereo */ + {{0}}, /* 24dB (16.5) stereo */ + }, + }, + + /* mode 8; 256-ish */ + {{&_residue_44_high, &_residue_44_high}, + {&_huff_book__44c8_short,&_huff_book__44c8_long}, + { {{0},{&_44c8_s0_p1_0,&_44c8_s0_p1_1}, + {&_44c8_s0_p2_0,&_44c8_s0_p2_1}, + {0,0,&_44c8_s0_p3_0},{0,0,&_44c8_s0_p4_0},{0,0,&_44c8_s0_p5_0}, + {&_44c8_s0_p6_0,&_44c8_s0_p6_1}, + {&_44c8_s0_p7_0,&_44c8_s0_p7_1}, + {&_44c8_s0_p8_0,&_44c8_s0_p8_1}, + {&_44c8_s0_p9_0,&_44c8_s0_p9_1,&_44c8_s0_p9_2}}, + {{0}}, /* 6dB (2.5) stereo */ + {{0}}, /* 12dB (4.5) stereo */ + {{0}}, /* 18dB (8.5) stereo */ + {{0}}, /* 24dB (16.5) stereo */ + }, + { {0}, /* lossless stereo */ + {0}, /* 6dB (2.5) stereo */ + {0}, /* 12dB (4.5) stereo */ + {0}, /* 18dB (8.5) stereo */ + {0}, + //{0,0,0,0,0,0,0,0,&44c0_s4_s8,&44c0_s4_s9},/* 24dB (16.5) stereo */ + }, + { + {{&_44c7_s0_p0_r0,&_44c7_s0_p0_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}}, /* lossless stereo */ + {{0}}, /* 6dB (2.5) stereo */ + {{0}}, /* 12dB (4.5) stereo */ + {{0}}, /* 18dB (8.5) stereo */ + //{{&44c0_s0_r0_0,&44c0_s0_r0_1},{&44c0_s0_r1_0,&44c0_s0_r1_1}, + // {&44c0_s0_r2_0,&44c0_s0_r2_1},{&44c0_s0_r3_0,&44c0_s0_r3_1}, + // {&44c0_s0_r4_0,&44c0_s0_r4_1},{&44c0_s1_r5_0,&44c0_s1_r5_1}, + // {&44c0_s1_r6_0,&44c0_s1_r6_1},{&44c0_s2_r7_0,&44c0_s2_r7_1}, + // {&44c0_s4_r8_0,&44c0_s3_r8_1},{&44c0_s4_r9_0,&44c0_s3_r9_1}}, /* 18dB (8.5) stereo */ + {{0}}, /* 24dB (16.5) stereo */ + }, + }, + /* mode 9; 320-ish */ + {{&_residue_44_high, &_residue_44_high}, + {&_huff_book__44c9_short,&_huff_book__44c9_long}, + { {{0},{&_44c9_s0_p1_0,&_44c9_s0_p1_1}, + {&_44c9_s0_p2_0,&_44c9_s0_p2_1}, + {0,0,&_44c9_s0_p3_0},{0,0,&_44c9_s0_p4_0},{0,0,&_44c9_s0_p5_0}, + {&_44c9_s0_p6_0,&_44c9_s0_p6_1}, + {&_44c9_s0_p7_0,&_44c9_s0_p7_1}, + {&_44c9_s0_p8_0,&_44c9_s0_p8_1}, + {&_44c9_s0_p9_0,&_44c9_s0_p9_1,&_44c9_s0_p9_2}}, + {{0}}, /* 6dB (2.5) stereo */ + {{0}}, /* 12dB (4.5) stereo */ + {{0}}, /* 18dB (8.5) stereo */ + {{0}}, /* 24dB (16.5) stereo */ + }, + { {0}, /* lossless stereo */ + {0}, /* 6dB (2.5) stereo */ + {0}, /* 12dB (4.5) stereo */ + {0}, /* 18dB (8.5) stereo */ + {0}, + //{0,0,0,0,0,0,0,0,&44c0_s4_s8,&44c0_s4_s9},/* 24dB (16.5) stereo */ + }, + { + {{&_44c7_s0_p0_r0,&_44c7_s0_p0_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}, + {&_44c7_s0_pN_r0,&_44c7_s0_pN_r1}}, /* lossless stereo */ + {{0}}, /* 6dB (2.5) stereo */ + {{0}}, /* 12dB (4.5) stereo */ + {{0}}, /* 18dB (8.5) stereo */ + //{{&44c0_s0_r0_0,&44c0_s0_r0_1},{&44c0_s0_r1_0,&44c0_s0_r1_1}, + // {&44c0_s0_r2_0,&44c0_s0_r2_1},{&44c0_s0_r3_0,&44c0_s0_r3_1}, + // {&44c0_s0_r4_0,&44c0_s0_r4_1},{&44c0_s1_r5_0,&44c0_s1_r5_1}, + // {&44c0_s1_r6_0,&44c0_s1_r6_1},{&44c0_s2_r7_0,&44c0_s2_r7_1}, + // {&44c0_s4_r8_0,&44c0_s3_r8_1},{&44c0_s4_r9_0,&44c0_s3_r9_1}}, /* 18dB (8.5) stereo */ + {{0}}, /* 24dB (16.5) stereo */ + }, + } + +}; + +#include "books/uncoupled/_44u0_p1_0.vqh" +#include "books/uncoupled/_44u0_p2_0.vqh" +#include "books/uncoupled/_44u0_p3_0.vqh" +#include "books/uncoupled/_44u0_p4_0.vqh" +#include "books/uncoupled/_44u0_p4_1.vqh" +#include "books/uncoupled/_44u0_p5_0.vqh" +#include "books/uncoupled/_44u0_p6_0.vqh" +#include "books/uncoupled/_44u0_p7_0.vqh" +#include "books/uncoupled/_44u0_p7_1.vqh" +#include "books/uncoupled/_44u0_p7_2.vqh" + +#include "books/uncoupled/_44u0_p0_r0.vqh" +#include "books/uncoupled/_44u0_p1_r0.vqh" + +#include "books/uncoupled/_44u0_p0_r1.vqh" +#include "books/uncoupled/_44u0_p1_r1.vqh" + +#include "books/uncoupled/_44u4_p1_0.vqh" +#include "books/uncoupled/_44u4_p2_0.vqh" +#include "books/uncoupled/_44u4_p3_0.vqh" +#include "books/uncoupled/_44u4_p4_0.vqh" +#include "books/uncoupled/_44u4_p5_0.vqh" +#include "books/uncoupled/_44u4_p6_0.vqh" +#include "books/uncoupled/_44u4_p7_0.vqh" +#include "books/uncoupled/_44u4_p7_1.vqh" +#include "books/uncoupled/_44u4_p8_0.vqh" +#include "books/uncoupled/_44u4_p8_1.vqh" +#include "books/uncoupled/_44u4_p9_0.vqh" +#include "books/uncoupled/_44u4_p9_1.vqh" +#include "books/uncoupled/_44u4_p9_2.vqh" + +#include "books/uncoupled/_44u4_p0_r0.vqh" +#include "books/uncoupled/_44u4_p1_r0.vqh" + +#include "books/uncoupled/_44u4_p0_r1.vqh" +#include "books/uncoupled/_44u4_p1_r1.vqh" + +#include "books/uncoupled/_44u7_p1_0.vqh" +#include "books/uncoupled/_44u7_p2_0.vqh" +#include "books/uncoupled/_44u7_p2_1.vqh" +#include "books/uncoupled/_44u7_p3_0.vqh" +#include "books/uncoupled/_44u7_p4_0.vqh" +#include "books/uncoupled/_44u7_p5_0.vqh" +#include "books/uncoupled/_44u7_p6_0.vqh" +#include "books/uncoupled/_44u7_p7_0.vqh" +#include "books/uncoupled/_44u7_p7_1.vqh" +#include "books/uncoupled/_44u7_p8_0.vqh" +#include "books/uncoupled/_44u7_p8_1.vqh" +#include "books/uncoupled/_44u7_p9_0.vqh" +#include "books/uncoupled/_44u7_p9_1.vqh" +#include "books/uncoupled/_44u7_p9_2.vqh" + +#include "books/uncoupled/_44u7_p0_r0.vqh" +#include "books/uncoupled/_44u7_p1_r0.vqh" + +#include "books/uncoupled/_44u7_p0_r1.vqh" +#include "books/uncoupled/_44u7_p1_r1.vqh" + + +static vorbis_residue_template _residue_template_44_uncoupled[11]={ + /* mode 0; 40/c-ish */ + {{&_residue_44_low_un, &_residue_44_low_un}, + {&_huff_book__44c0_short,&_huff_book__44c0_long}, + { {{0}, + {0,0,&_44u0_p1_0}, + {0,0,&_44u0_p2_0}, + {0,0,&_44u0_p3_0}, + {&_44u0_p4_0,&_44u0_p4_1}, + {0,0,&_44u0_p5_0}, + {0,0,&_44u0_p6_0}, + {&_44u0_p7_0,&_44u0_p7_1,&_44u0_p7_2}}, + }, + { {0} }, /* no stereo backfill in uncoupled modes */ + { {{&_44u0_p0_r0,&_44u0_p0_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}}, + } + }, + /* mode 1; 50-ish */ + {{&_residue_44_low_un, &_residue_44_low_un}, + {&_huff_book__44c1_short,&_huff_book__44c1_long}, + { {{0}, + {0,0,&_44u0_p1_0}, + {0,0,&_44u0_p2_0}, + {0,0,&_44u0_p3_0}, + {&_44u0_p4_0,&_44u0_p4_1}, + {0,0,&_44u0_p5_0}, + {0,0,&_44u0_p6_0}, + {&_44u0_p7_0,&_44u0_p7_1,&_44u0_p7_2}}, + }, + { {0} }, /* no stereo backfill in uncoupled modes */ + { {{&_44u0_p0_r0,&_44u0_p0_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}}, + } + }, + /* mode 2; 60-ish */ + {{&_residue_44_low_un, &_residue_44_low_un}, + {&_huff_book__44c2_short,&_huff_book__44c2_long}, + { {{0}, + {0,0,&_44u0_p1_0}, + {0,0,&_44u0_p2_0}, + {0,0,&_44u0_p3_0}, + {&_44u0_p4_0,&_44u0_p4_1}, + {0,0,&_44u0_p5_0}, + {0,0,&_44u0_p6_0}, + {&_44u0_p7_0,&_44u0_p7_1,&_44u0_p7_2}}, + }, + { {0} }, /* no stereo backfill in uncoupled modes */ + { {{&_44u0_p0_r0,&_44u0_p0_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}}, + } + }, + /* mode 3; 70-ish */ + {{&_residue_44_low_un, &_residue_44_low_un}, + {&_huff_book__44c3_short,&_huff_book__44c3_long}, + { {{0}, + {0,0,&_44u0_p1_0}, + {0,0,&_44u0_p2_0}, + {0,0,&_44u0_p3_0}, + {&_44u0_p4_0,&_44u0_p4_1}, + {0,0,&_44u0_p5_0}, + {0,0,&_44u0_p6_0}, + {&_44u0_p7_0,&_44u0_p7_1,&_44u0_p7_2}}, + }, + { {0} }, /* no stereo backfill in uncoupled modes */ + { {{&_44u0_p0_r0,&_44u0_p0_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}, + {&_44u0_p1_r0,&_44u0_p1_r1}}, + } + }, + /* mode 4; 80-ish */ + {{&_residue_44_mid, &_residue_44_mid}, + {&_huff_book__44c4_short,&_huff_book__44c4_long}, + { {{0}, + {0,0,&_44u4_p1_0}, + {0,0,&_44u4_p2_0}, + {0,0,&_44u4_p3_0}, + {0,0,&_44u4_p4_0}, + {0,0,&_44u4_p5_0}, + {0,0,&_44u4_p6_0}, + {&_44u4_p7_0,&_44u4_p7_1}, + {&_44u4_p8_0,&_44u4_p8_1}, + {&_44u4_p9_0,&_44u4_p9_1,&_44u4_p9_2}}, + }, + { {0} }, /* no stereo backfill in uncoupled modes */ + { {{&_44u4_p0_r0,&_44u4_p0_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}}, + } + }, + /* mode 5; 90-ish */ + {{&_residue_44_mid, &_residue_44_mid}, + {&_huff_book__44c5_short,&_huff_book__44c5_long}, + { {{0}, + {0,0,&_44u4_p1_0}, + {0,0,&_44u4_p2_0}, + {0,0,&_44u4_p3_0}, + {0,0,&_44u4_p4_0}, + {0,0,&_44u4_p5_0}, + {0,0,&_44u4_p6_0}, + {&_44u4_p7_0,&_44u4_p7_1}, + {&_44u4_p8_0,&_44u4_p8_1}, + {&_44u4_p9_0,&_44u4_p9_1,&_44u4_p9_2}}, + }, + { {0} }, /* no stereo backfill in uncoupled modes */ + { {{&_44u4_p0_r0,&_44u4_p0_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}}, + } + }, + /* mode 6; 100-ish */ + {{&_residue_44_mid, &_residue_44_mid}, + {&_huff_book__44c6_short,&_huff_book__44c6_long}, + { {{0}, + {0,0,&_44u4_p1_0}, + {0,0,&_44u4_p2_0}, + {0,0,&_44u4_p3_0}, + {0,0,&_44u4_p4_0}, + {0,0,&_44u4_p5_0}, + {0,0,&_44u4_p6_0}, + {&_44u4_p7_0,&_44u4_p7_1}, + {&_44u4_p8_0,&_44u4_p8_1}, + {&_44u4_p9_0,&_44u4_p9_1,&_44u4_p9_2}}, + }, + { {0} }, /* no stereo backfill in uncoupled modes */ + { {{&_44u4_p0_r0,&_44u4_p0_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}, + {&_44u4_p1_r0,&_44u4_p1_r1}}, + } + }, + /* mode 7 */ + {{&_residue_44_high_un, &_residue_44_high_un}, + {&_huff_book__44c7_short,&_huff_book__44c7_long}, + { {{0}, + {0,0,&_44u7_p1_0}, + {&_44u7_p2_0,&_44u7_p2_1}, + {0,0,&_44u7_p3_0}, + {0,0,&_44u7_p4_0}, + {0,0,&_44u7_p5_0}, + {0,0,&_44u7_p6_0}, + {&_44u7_p7_0,&_44u7_p7_1}, + {&_44u7_p8_0,&_44u7_p8_1}, + {&_44u7_p9_0,&_44u7_p9_1,&_44u7_p9_2}}, + }, + { {0} }, /* no stereo backfill in uncoupled modes */ + { {{&_44u7_p0_r0,&_44u7_p0_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}}, + } + }, + /* mode 8 */ + {{&_residue_44_high_un, &_residue_44_high_un}, + {&_huff_book__44c8_short,&_huff_book__44c8_long}, + { {{0}, + {0,0,&_44u7_p1_0}, + {&_44u7_p2_0,&_44u7_p2_1}, + {0,0,&_44u7_p3_0}, + {0,0,&_44u7_p4_0}, + {0,0,&_44u7_p5_0}, + {0,0,&_44u7_p6_0}, + {&_44u7_p7_0,&_44u7_p7_1}, + {&_44u7_p8_0,&_44u7_p8_1}, + {&_44u7_p9_0,&_44u7_p9_1,&_44u7_p9_2}}, + }, + { {0} }, /* no stereo backfill in uncoupled modes */ + { {{&_44u7_p0_r0,&_44u7_p0_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}}, + } + }, + /* mode 9 */ + {{&_residue_44_high_un, &_residue_44_high_un}, + {&_huff_book__44c9_short,&_huff_book__44c9_long}, + { {{0}, + {0,0,&_44u7_p1_0}, + {&_44u7_p2_0,&_44u7_p2_1}, + {0,0,&_44u7_p3_0}, + {0,0,&_44u7_p4_0}, + {0,0,&_44u7_p5_0}, + {0,0,&_44u7_p6_0}, + {&_44u7_p7_0,&_44u7_p7_1}, + {&_44u7_p8_0,&_44u7_p8_1}, + {&_44u7_p9_0,&_44u7_p9_1,&_44u7_p9_2}}, + }, + { {0} }, /* no stereo backfill in uncoupled modes */ + { {{&_44u7_p0_r0,&_44u7_p0_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}, + {&_44u7_p1_r0,&_44u7_p1_r1}}, + } + }, +}; + + + + + diff --git a/lib/psy.c b/lib/psy.c new file mode 100644 index 00000000..20b81e32 --- /dev/null +++ b/lib/psy.c @@ -0,0 +1,1021 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * 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/ * + * * + ******************************************************************** + + function: psychoacoustics not including preecho + last mod: $Id: psy.c,v 1.57.2.1 2001/12/18 23:49:16 xiphmont Exp $ + + ********************************************************************/ + +#include <stdlib.h> +#include <math.h> +#include <string.h> +#include "vorbis/codec.h" +#include "codec_internal.h" + +#include "masking.h" +#include "psy.h" +#include "os.h" +#include "lpc.h" +#include "smallft.h" +#include "scales.h" +#include "misc.h" + +#define NEGINF -9999.f + +/* Why Bark scale for encoding but not masking computation? Because + masking has a strong harmonic dependency */ + +vorbis_look_psy_global *_vp_global_look(vorbis_info *vi){ + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy_global *gi=&ci->psy_g_param; + vorbis_look_psy_global *look=_ogg_calloc(1,sizeof(*look)); + + look->channels=vi->channels; + + look->ampmax=-9999.; + look->gi=gi; + return(look); +} + +void _vp_global_free(vorbis_look_psy_global *look){ + if(look){ + memset(look,0,sizeof(*look)); + _ogg_free(look); + } +} + +void _vi_gpsy_free(vorbis_info_psy_global *i){ + if(i){ + memset(i,0,sizeof(*i)); + _ogg_free(i); + } +} + +void _vi_psy_free(vorbis_info_psy *i){ + if(i){ + memset(i,0,sizeof(*i)); + _ogg_free(i); + } +} + +vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i){ + vorbis_info_psy *ret=_ogg_malloc(sizeof(*ret)); + memcpy(ret,i,sizeof(*ret)); + return(ret); +} + +/* Set up decibel threshold slopes on a Bark frequency scale */ +/* ATH is the only bit left on a Bark scale. No reason to change it + right now */ +static void set_curve(float *ref,float *c,int n, float crate){ + int i,j=0; + + for(i=0;i<MAX_BARK-1;i++){ + int endpos=rint(fromBARK(i+1)*2*n/crate); + float base=ref[i]; + if(j<endpos){ + float delta=(ref[i+1]-base)/(endpos-j); + for(;j<endpos && j<n;j++){ + c[j]=base; + base+=delta; + } + } + } +} + +static void min_curve(float *c, + float *c2){ + int i; + for(i=0;i<EHMER_MAX;i++)if(c2[i]<c[i])c[i]=c2[i]; +} +static void max_curve(float *c, + float *c2){ + int i; + for(i=0;i<EHMER_MAX;i++)if(c2[i]>c[i])c[i]=c2[i]; +} + +static void attenuate_curve(float *c,float att){ + int i; + for(i=0;i<EHMER_MAX;i++) + c[i]+=att; +} + +static void interp_curve(float *c,float *c1,float *c2,float del){ + int i; + for(i=0;i<EHMER_MAX;i++) + c[i]=c2[i]*del+c1[i]*(1.f-del); +} + +extern int analysis_noisy; +static void setup_curve(float **c, + int band, + float *curveatt_dB){ + int i,j; + float ath[EHMER_MAX]; + float tempc[P_LEVELS][EHMER_MAX]; + float *ATH=ATH_Bark_dB_lspconservative; /* just for limiting here */ + + memcpy(c[0]+2,c[4]+2,sizeof(*c[0])*EHMER_MAX); + memcpy(c[2]+2,c[4]+2,sizeof(*c[2])*EHMER_MAX); + + /* we add back in the ATH to avoid low level curves falling off to + -infinity and unnecessarily cutting off high level curves in the + curve limiting (last step). But again, remember... a half-band's + settings must be valid over the whole band, and it's better to + mask too little than too much, so be pessimistical. */ + + for(i=0;i<EHMER_MAX;i++){ + float oc_min=band*.5+(i-EHMER_OFFSET)*.125; + float oc_max=band*.5+(i-EHMER_OFFSET+1)*.125; + float bark=toBARK(fromOC(oc_min)); + int ibark=floor(bark); + float del=bark-ibark; + float ath_min,ath_max; + + if(ibark<26) + ath_min=ATH[ibark]*(1.f-del)+ATH[ibark+1]*del; + else + ath_min=ATH[25]; + + bark=toBARK(fromOC(oc_max)); + ibark=floor(bark); + del=bark-ibark; + + if(ibark<26) + ath_max=ATH[ibark]*(1.f-del)+ATH[ibark+1]*del; + else + ath_max=ATH[25]; + + ath[i]=min(ath_min,ath_max); + } + + /* The c array comes in as dB curves at 20 40 60 80 100 dB. + interpolate intermediate dB curves */ + for(i=1;i<P_LEVELS;i+=2){ + interp_curve(c[i]+2,c[i-1]+2,c[i+1]+2,.5); + } + + /* normalize curves so the driving amplitude is 0dB */ + /* make temp curves with the ATH overlayed */ + for(i=0;i<P_LEVELS;i++){ + attenuate_curve(c[i]+2,curveatt_dB[i]); + memcpy(tempc[i],ath,EHMER_MAX*sizeof(*tempc[i])); + attenuate_curve(tempc[i],-i*10.f); + max_curve(tempc[i],c[i]+2); + } + + /* Now limit the louder curves. + + the idea is this: We don't know what the playback attenuation + will be; 0dB SL moves every time the user twiddles the volume + knob. So that means we have to use a single 'most pessimal' curve + for all masking amplitudes, right? Wrong. The *loudest* sound + can be in (we assume) a range of ...+100dB] SL. However, sounds + 20dB down will be in a range ...+80], 40dB down is from ...+60], + etc... */ + + for(j=1;j<P_LEVELS;j++){ + min_curve(tempc[j],tempc[j-1]); + min_curve(c[j]+2,tempc[j]); + } + + /* add fenceposts */ + for(j=0;j<P_LEVELS;j++){ + + for(i=0;i<EHMER_OFFSET;i++) + if(c[j][i+2]>-200.f)break; + c[j][0]=i; + + for(i=EHMER_MAX-1;i>EHMER_OFFSET+1;i--) + if(c[j][i+2]>-200.f) + break; + c[j][1]=i; + + } +} + +void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi, + vorbis_info_psy_global *gi,int n,long rate){ + long i,j,k,lo=-99,hi=0; + long maxoc; + memset(p,0,sizeof(*p)); + + + p->eighth_octave_lines=gi->eighth_octave_lines; + p->shiftoc=rint(log(gi->eighth_octave_lines*8)/log(2))-1; + + p->firstoc=toOC(.25f*rate/n)*(1<<(p->shiftoc+1))-gi->eighth_octave_lines; + maxoc=toOC((n*.5f-.25f)*rate/n)*(1<<(p->shiftoc+1))+.5f; + p->total_octave_lines=maxoc-p->firstoc+1; + + if(vi->ath) + p->ath=_ogg_malloc(n*sizeof(*p->ath)); + p->octave=_ogg_malloc(n*sizeof(*p->octave)); + p->bark=_ogg_malloc(n*sizeof(*p->bark)); + p->vi=vi; + p->n=n; + p->rate=rate; + + /* set up the lookups for a given blocksize and sample rate */ + if(vi->ath) + set_curve(vi->ath, p->ath,n,rate); + for(i=0;i<n;i++){ + float bark=toBARK(rate/(2*n)*i); + + for(;lo+vi->noisewindowlomin<i && + toBARK(rate/(2*n)*lo)<(bark-vi->noisewindowlo);lo++); + + for(;hi<n && (hi<i+vi->noisewindowhimin || + toBARK(rate/(2*n)*hi)<(bark+vi->noisewindowhi));hi++); + + p->bark[i]=(lo<<16)+hi; + + } + + for(i=0;i<n;i++) + p->octave[i]=toOC((i*.5f+.25f)*rate/n)*(1<<(p->shiftoc+1))+.5f; + + p->tonecurves=_ogg_malloc(P_BANDS*sizeof(*p->tonecurves)); + p->noisethresh=_ogg_malloc(n*sizeof(*p->noisethresh)); + p->noiseoffset=_ogg_malloc(n*sizeof(*p->noiseoffset)); + for(i=0;i<P_BANDS;i++) + p->tonecurves[i]=_ogg_malloc(P_LEVELS*sizeof(*p->tonecurves[i])); + + for(i=0;i<P_BANDS;i++) + for(j=0;j<P_LEVELS;j++) + p->tonecurves[i][j]=_ogg_malloc((EHMER_MAX+2)*sizeof(*p->tonecurves[i][j])); + + + /* OK, yeah, this was a silly way to do it */ + memcpy(p->tonecurves[0][4]+2,tone_125_40dB_SL,sizeof(*p->tonecurves[0][4])*EHMER_MAX); + memcpy(p->tonecurves[0][6]+2,tone_125_60dB_SL,sizeof(*p->tonecurves[0][6])*EHMER_MAX); + memcpy(p->tonecurves[0][8]+2,tone_125_80dB_SL,sizeof(*p->tonecurves[0][8])*EHMER_MAX); + memcpy(p->tonecurves[0][10]+2,tone_125_100dB_SL,sizeof(*p->tonecurves[0][10])*EHMER_MAX); + + memcpy(p->tonecurves[2][4]+2,tone_125_40dB_SL,sizeof(*p->tonecurves[2][4])*EHMER_MAX); + memcpy(p->tonecurves[2][6]+2,tone_125_60dB_SL,sizeof(*p->tonecurves[2][6])*EHMER_MAX); + memcpy(p->tonecurves[2][8]+2,tone_125_80dB_SL,sizeof(*p->tonecurves[2][8])*EHMER_MAX); + memcpy(p->tonecurves[2][10]+2,tone_125_100dB_SL,sizeof(*p->tonecurves[2][10])*EHMER_MAX); + + memcpy(p->tonecurves[4][4]+2,tone_250_40dB_SL,sizeof(*p->tonecurves[4][4])*EHMER_MAX); + memcpy(p->tonecurves[4][6]+2,tone_250_60dB_SL,sizeof(*p->tonecurves[4][6])*EHMER_MAX); + memcpy(p->tonecurves[4][8]+2,tone_250_80dB_SL,sizeof(*p->tonecurves[4][8])*EHMER_MAX); + memcpy(p->tonecurves[4][10]+2,tone_250_100dB_SL,sizeof(*p->tonecurves[4][10])*EHMER_MAX); + + memcpy(p->tonecurves[6][4]+2,tone_500_40dB_SL,sizeof(*p->tonecurves[6][4])*EHMER_MAX); + memcpy(p->tonecurves[6][6]+2,tone_500_60dB_SL,sizeof(*p->tonecurves[6][6])*EHMER_MAX); + memcpy(p->tonecurves[6][8]+2,tone_500_80dB_SL,sizeof(*p->tonecurves[6][8])*EHMER_MAX); + memcpy(p->tonecurves[6][10]+2,tone_500_100dB_SL,sizeof(*p->tonecurves[6][10])*EHMER_MAX); + + memcpy(p->tonecurves[8][4]+2,tone_1000_40dB_SL,sizeof(*p->tonecurves[8][4])*EHMER_MAX); + memcpy(p->tonecurves[8][6]+2,tone_1000_60dB_SL,sizeof(*p->tonecurves[8][6])*EHMER_MAX); + memcpy(p->tonecurves[8][8]+2,tone_1000_80dB_SL,sizeof(*p->tonecurves[8][8])*EHMER_MAX); + memcpy(p->tonecurves[8][10]+2,tone_1000_100dB_SL,sizeof(*p->tonecurves[8][10])*EHMER_MAX); + + memcpy(p->tonecurves[10][4]+2,tone_2000_40dB_SL,sizeof(*p->tonecurves[10][4])*EHMER_MAX); + memcpy(p->tonecurves[10][6]+2,tone_2000_60dB_SL,sizeof(*p->tonecurves[10][6])*EHMER_MAX); + memcpy(p->tonecurves[10][8]+2,tone_2000_80dB_SL,sizeof(*p->tonecurves[10][8])*EHMER_MAX); + memcpy(p->tonecurves[10][10]+2,tone_2000_100dB_SL,sizeof(*p->tonecurves[10][10])*EHMER_MAX); + + memcpy(p->tonecurves[12][4]+2,tone_4000_40dB_SL,sizeof(*p->tonecurves[12][4])*EHMER_MAX); + memcpy(p->tonecurves[12][6]+2,tone_4000_60dB_SL,sizeof(*p->tonecurves[12][6])*EHMER_MAX); + memcpy(p->tonecurves[12][8]+2,tone_4000_80dB_SL,sizeof(*p->tonecurves[12][8])*EHMER_MAX); + memcpy(p->tonecurves[12][10]+2,tone_4000_100dB_SL,sizeof(*p->tonecurves[12][10])*EHMER_MAX); + + memcpy(p->tonecurves[14][4]+2,tone_8000_40dB_SL,sizeof(*p->tonecurves[14][4])*EHMER_MAX); + memcpy(p->tonecurves[14][6]+2,tone_8000_60dB_SL,sizeof(*p->tonecurves[14][6])*EHMER_MAX); + memcpy(p->tonecurves[14][8]+2,tone_8000_80dB_SL,sizeof(*p->tonecurves[14][8])*EHMER_MAX); + memcpy(p->tonecurves[14][10]+2,tone_8000_100dB_SL,sizeof(*p->tonecurves[14][10])*EHMER_MAX); + + memcpy(p->tonecurves[16][4]+2,tone_8000_40dB_SL,sizeof(*p->tonecurves[16][4])*EHMER_MAX); + memcpy(p->tonecurves[16][6]+2,tone_8000_60dB_SL,sizeof(*p->tonecurves[16][6])*EHMER_MAX); + memcpy(p->tonecurves[16][8]+2,tone_8000_80dB_SL,sizeof(*p->tonecurves[16][8])*EHMER_MAX); + memcpy(p->tonecurves[16][10]+2,tone_8000_100dB_SL,sizeof(*p->tonecurves[16][10])*EHMER_MAX); + + for(i=0;i<P_BANDS;i+=2) + for(j=4;j<P_LEVELS;j+=2) + for(k=2;k<EHMER_MAX+2;k++) + p->tonecurves[i][j][k]+=vi->tone_masteratt; + + /* interpolate curves between */ + for(i=1;i<P_BANDS;i+=2) + for(j=4;j<P_LEVELS;j+=2){ + memcpy(p->tonecurves[i][j]+2,p->tonecurves[i-1][j]+2,EHMER_MAX*sizeof(*p->tonecurves[i][j])); + /*interp_curve(p->tonecurves[i][j], + p->tonecurves[i-1][j], + p->tonecurves[i+1][j],.5);*/ + min_curve(p->tonecurves[i][j]+2,p->tonecurves[i+1][j]+2); + } + + /* set up the final curves */ + for(i=0;i<P_BANDS;i++) + setup_curve(p->tonecurves[i],i,vi->toneatt.block[i]); + + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_63Hz",i,p->tonecurves[0][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_88Hz",i,p->tonecurves[1][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_125Hz",i,p->tonecurves[2][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_170Hz",i,p->tonecurves[3][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_250Hz",i,p->tonecurves[4][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_350Hz",i,p->tonecurves[5][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_500Hz",i,p->tonecurves[6][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_700Hz",i,p->tonecurves[7][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_1kHz",i,p->tonecurves[8][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_1.4Hz",i,p->tonecurves[9][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_2kHz",i,p->tonecurves[10][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_2.4kHz",i,p->tonecurves[11][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_4kHz",i,p->tonecurves[12][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_5.6kHz",i,p->tonecurves[13][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_8kHz",i,p->tonecurves[14][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_11.5kHz",i,p->tonecurves[15][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("curve_16kHz",i,p->tonecurves[16][i]+2,EHMER_MAX,0,0); + + if(vi->curvelimitp){ + /* value limit the tonal masking curves; the peakatt not only + optionally specifies maximum dynamic depth, but also + limits the masking curves to a minimum depth */ + for(i=0;i<P_BANDS;i++) + for(j=0;j<P_LEVELS;j++){ + for(k=2;k<EHMER_OFFSET+2+vi->curvelimitp;k++) + if(p->tonecurves[i][j][k]> vi->peakatt.block[i][j]) + p->tonecurves[i][j][k]= vi->peakatt.block[i][j]; + else + break; + } + } + + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_63Hz",i,p->tonecurves[0][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_88Hz",i,p->tonecurves[1][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_125Hz",i,p->tonecurves[2][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_170Hz",i,p->tonecurves[3][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_250Hz",i,p->tonecurves[4][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_350Hz",i,p->tonecurves[5][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_500Hz",i,p->tonecurves[6][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_700Hz",i,p->tonecurves[7][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_1kHz",i,p->tonecurves[8][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_1.4Hz",i,p->tonecurves[9][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_2kHz",i,p->tonecurves[10][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_2.4kHz",i,p->tonecurves[11][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_4kHz",i,p->tonecurves[12][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_5.6kHz",i,p->tonecurves[13][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_8kHz",i,p->tonecurves[14][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_11.5kHz",i,p->tonecurves[15][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("licurve_16kHz",i,p->tonecurves[16][i]+2,EHMER_MAX,0,0); + + if(vi->peakattp) /* we limit maximum depth only optionally */ + for(i=0;i<P_BANDS;i++) + for(j=0;j<P_LEVELS;j++) + if(p->tonecurves[i][j][EHMER_OFFSET+2]< vi->peakatt.block[i][j]) + p->tonecurves[i][j][EHMER_OFFSET+2]= vi->peakatt.block[i][j]; + + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_63Hz",i,p->tonecurves[0][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_88Hz",i,p->tonecurves[1][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_125Hz",i,p->tonecurves[2][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_170Hz",i,p->tonecurves[3][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_250Hz",i,p->tonecurves[4][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_350Hz",i,p->tonecurves[5][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_500Hz",i,p->tonecurves[6][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_700Hz",i,p->tonecurves[7][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_1kHz",i,p->tonecurves[8][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_1.4Hz",i,p->tonecurves[9][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_2kHz",i,p->tonecurves[10][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_2.4kHz",i,p->tonecurves[11][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_4kHz",i,p->tonecurves[12][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_5.6kHz",i,p->tonecurves[13][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_8kHz",i,p->tonecurves[14][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_11.5kHz",i,p->tonecurves[15][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("pcurve_16kHz",i,p->tonecurves[16][i]+2,EHMER_MAX,0,0); + + /* but guarding is mandatory */ + for(i=0;i<P_BANDS;i++) + for(j=0;j<P_LEVELS;j++) + if(p->tonecurves[i][j][EHMER_OFFSET+2]< vi->tone_guard) + p->tonecurves[i][j][EHMER_OFFSET+2]= vi->tone_guard; + + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_63Hz",i,p->tonecurves[0][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_88Hz",i,p->tonecurves[1][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_125Hz",i,p->tonecurves[2][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_170Hz",i,p->tonecurves[3][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_250Hz",i,p->tonecurves[4][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_350Hz",i,p->tonecurves[5][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_500Hz",i,p->tonecurves[6][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_700Hz",i,p->tonecurves[7][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_1kHz",i,p->tonecurves[8][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_1.4Hz",i,p->tonecurves[9][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_2kHz",i,p->tonecurves[10][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_2.4kHz",i,p->tonecurves[11][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_4kHz",i,p->tonecurves[12][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_5.6kHz",i,p->tonecurves[13][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_8kHz",i,p->tonecurves[14][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_11.5kHz",i,p->tonecurves[15][i]+2,EHMER_MAX,0,0); + for(i=0;i<P_LEVELS;i++) + _analysis_output("fcurve_16kHz",i,p->tonecurves[16][i]+2,EHMER_MAX,0,0); + + /* set up rolling noise median */ + for(i=0;i<n;i++){ + float halfoc=toOC((i+.5)*rate/(2.*n))*2.; + int inthalfoc; + float del; + + if(halfoc<0)halfoc=0; + if(halfoc>=P_BANDS-1)halfoc=P_BANDS-1; + inthalfoc=(int)halfoc; + del=halfoc-inthalfoc; + p->noiseoffset[i]= + p->vi->noiseoff[inthalfoc]*(1.-del) + + p->vi->noiseoff[inthalfoc+1]*del; + } + + analysis_noisy=1; + _analysis_output("noiseoff",0,p->noiseoffset,n,1,0); + _analysis_output("noisethresh",0,p->noisethresh,n,1,0); + analysis_noisy=1; + +} + +void _vp_psy_clear(vorbis_look_psy *p){ + int i,j; + if(p){ + if(p->ath)_ogg_free(p->ath); + if(p->octave)_ogg_free(p->octave); + if(p->bark)_ogg_free(p->bark); + if(p->tonecurves){ + for(i=0;i<P_BANDS;i++){ + for(j=0;j<P_LEVELS;j++){ + _ogg_free(p->tonecurves[i][j]); + } + _ogg_free(p->tonecurves[i]); + } + _ogg_free(p->tonecurves); + } + _ogg_free(p->noiseoffset); + _ogg_free(p->noisethresh); + memset(p,0,sizeof(*p)); + } +} + +/* octave/(8*eighth_octave_lines) x scale and dB y scale */ +static void seed_curve(float *seed, + const float **curves, + float amp, + int oc, int n, + int linesper,float dBoffset){ + int i,post1; + int seedptr; + const float *posts,*curve; + + int choice=(int)((amp+dBoffset)*.1f); + choice=max(choice,0); + choice=min(choice,P_LEVELS-1); + posts=curves[choice]; + curve=posts+2; + post1=(int)posts[1]; + seedptr=oc+(posts[0]-16)*linesper-(linesper>>1); + + for(i=posts[0];i<post1;i++){ + if(seedptr>0){ + float lin=amp+curve[i]; + if(seed[seedptr]<lin)seed[seedptr]=lin; + } + seedptr+=linesper; + if(seedptr>=n)break; + } +} + +static void seed_loop(vorbis_look_psy *p, + const float ***curves, + const float *f, + const float *flr, + float *seed, + float specmax){ + vorbis_info_psy *vi=p->vi; + long n=p->n,i; + float dBoffset=vi->max_curve_dB-specmax; + + /* prime the working vector with peak values */ + + for(i=0;i<n;i++){ + float max=f[i]; + long oc=p->octave[i]; + while(i+1<n && p->octave[i+1]==oc){ + i++; + if(f[i]>max)max=f[i]; + } + + if(max+6.f>flr[i]){ + oc=oc>>p->shiftoc; + if(oc>=P_BANDS)oc=P_BANDS-1; + if(oc<0)oc=0; + seed_curve(seed, + curves[oc], + max, + p->octave[i]-p->firstoc, + p->total_octave_lines, + p->eighth_octave_lines, + dBoffset); + } + } +} + +static void seed_chase(float *seeds, int linesper, long n){ + long *posstack=alloca(n*sizeof(*posstack)); + float *ampstack=alloca(n*sizeof(*ampstack)); + long stack=0; + long pos=0; + long i; + + for(i=0;i<n;i++){ + if(stack<2){ + posstack[stack]=i; + ampstack[stack++]=seeds[i]; + }else{ + while(1){ + if(seeds[i]<ampstack[stack-1]){ + posstack[stack]=i; + ampstack[stack++]=seeds[i]; + break; + }else{ + if(i<posstack[stack-1]+linesper){ + if(stack>1 && ampstack[stack-1]<=ampstack[stack-2] && + i<posstack[stack-2]+linesper){ + /* we completely overlap, making stack-1 irrelevant. pop it */ + stack--; + continue; + } + } + posstack[stack]=i; + ampstack[stack++]=seeds[i]; + break; + + } + } + } + } + + /* the stack now contains only the positions that are relevant. Scan + 'em straight through */ + + for(i=0;i<stack;i++){ + long endpos; + if(i<stack-1 && ampstack[i+1]>ampstack[i]){ + endpos=posstack[i+1]; + }else{ + endpos=posstack[i]+linesper+1; /* +1 is important, else bin 0 is + discarded in short frames */ + } + if(endpos>n)endpos=n; + for(;pos<endpos;pos++) + seeds[pos]=ampstack[i]; + } + + /* there. Linear time. I now remember this was on a problem set I + had in Grad Skool... I didn't solve it at the time ;-) */ + +} + +/* bleaugh, this is more complicated than it needs to be */ +static void max_seeds(vorbis_look_psy *p, + float *seed, + float *flr){ + long n=p->total_octave_lines; + int linesper=p->eighth_octave_lines; + long linpos=0; + long pos; + + seed_chase(seed,linesper,n); /* for masking */ + + pos=p->octave[0]-p->firstoc-(linesper>>1); + while(linpos+1<p->n){ + float minV=seed[pos]; + long end=((p->octave[linpos]+p->octave[linpos+1])>>1)-p->firstoc; + if(minV>p->vi->tone_abs_limit)minV=p->vi->tone_abs_limit; + while(pos+1<=end){ + pos++; + if((seed[pos]>NEGINF && seed[pos]<minV) || minV==NEGINF) + minV=seed[pos]; + } + + /* seed scale is log. Floor is linear. Map back to it */ + end=pos+p->firstoc; + for(;linpos<p->n && p->octave[linpos]<=end;linpos++) + if(flr[linpos]<minV)flr[linpos]=minV; + } + + { + float minV=seed[p->total_octave_lines-1]; + for(;linpos<p->n;linpos++) + if(flr[linpos]<minV)flr[linpos]=minV; + } + +} + +static void bark_noise_hybridmp(int n,const long *b, + const float *f, + float *noise, + const float offset, + const int fixed){ + long i,hi=b[0]>>16,lo=b[0]>>16,hif=0,lof=0; + double xa=0,xb=0; + double ya=0,yb=0; + double x2a=0,x2b=0; + double y2a=0,y2b=0; + double xya=0,xyb=0; + double na=0,nb=0; + + for(i=0;i<n;i++){ + if(hi<n){ + /* find new lo/hi */ + int bi=b[i]&0xffffL; + for(;hi<bi;hi++){ + int ii=(hi<0?-hi:hi); + double bin=(f[ii]<-offset?1.:f[ii]+offset); + double nn= bin*bin; + na += nn; + xa += hi*nn; + ya += bin*nn; + x2a += hi*hi*nn; + y2a += bin*bin*nn; + xya += hi*bin*nn; + } + bi=b[i]>>16; + for(;lo<bi;lo++){ + int ii=(lo<0?-lo:lo); + double bin=(f[ii]<-offset?1.:f[ii]+offset); + double nn= bin*bin; + na -= nn; + xa -= lo*nn; + ya -= bin*nn; + x2a -= lo*lo*nn; + y2a -= bin*bin*nn; + xya -= lo*bin*nn; + } + } + + if(hif<n && fixed>0){ + int bi=i+fixed/2; + if(bi>n)bi=n; + + for(;hif<bi;hif++){ + int ii=(hif<0?-hif:hif); + double bin=(f[ii]<-offset?1.:f[ii]+offset); + double nn= bin*bin; + nb += nn; + xb += hif*nn; + yb += bin*nn; + x2b += hif*hif*nn; + y2b += bin*bin*nn; + xyb += hif*bin*nn; + } + bi=i-(fixed+1)/2; + for(;lof<bi;lof++){ + int ii=(lof<0?-lof:lof); + double bin=(f[ii]<-offset?1.:f[ii]+offset); + double nn= bin*bin; + nb -= nn; + xb -= lof*nn; + yb -= bin*nn; + x2b -= lof*lof*nn; + y2b -= bin*bin*nn; + xyb -= lof*bin*nn; + } + } + + { + double va=0.f; + + if(na>2){ + double denom=1./(na*x2a-xa*xa); + double a=(ya*x2a-xya*xa)*denom; + double b=(na*xya-xa*ya)*denom; + va=a+b*i; + } + if(va<0.)va=0.; + + if(fixed>0){ + double vb=0.f; + + if(nb>2){ + double denomf=1./(nb*x2b-xb*xb); + double af=(yb*x2b-xyb*xb)*denomf; + double bf=(nb*xyb-xb*yb)*denomf; + vb=af+bf*i; + } + if(vb<0.)vb=0.; + if(va>vb && vb>0.)va=vb; + + } + + noise[i]=va-offset; + } + } +} + + +void _vp_remove_floor(vorbis_look_psy *p, + float *mdct, + float *codedflr, + float *residue){ + int i,n=p->n; + + for(i=0;i<n;i++) + if(mdct[i]!=0.f) + residue[i]=mdct[i]/codedflr[i]; + else + residue[i]=0.f; +} + + +void _vp_compute_mask(vorbis_look_psy *p, + float *logfft, + float *logmdct, + float *logmask, + float global_specmax, + float local_specmax, + float bitrate_noise_offset){ + int i,n=p->n; + static int seq=0; + + float *seed=alloca(sizeof(*seed)*p->total_octave_lines); + for(i=0;i<p->total_octave_lines;i++)seed[i]=NEGINF; + + /* noise masking */ + if(p->vi->noisemaskp){ + float *work=alloca(n*sizeof(*work)); + + bark_noise_hybridmp(n,p->bark,logmdct,logmask, + 140.,-1); + + for(i=0;i<n;i++)work[i]=logmdct[i]-logmask[i]; + + bark_noise_hybridmp(n,p->bark,work,logmask,0., + p->vi->noisewindowfixed); + + for(i=0;i<n;i++)work[i]=logmdct[i]-work[i]; + + /* work[i] holds the median line (.5), logmask holds the upper + envelope line (1.) */ + _analysis_output("noisemedian",seq,work,n,1,0); + + for(i=0;i<n;i++)logmask[i]+=work[i]; + _analysis_output("noiseenvelope",seq,logmask,n,1,0); + for(i=0;i<n;i++)logmask[i]-=work[i]; + + for(i=0;i<n;i++){ + int dB=logmask[i]+.5; + if(dB>=NOISE_COMPAND_LEVELS)dB=NOISE_COMPAND_LEVELS-1; + logmask[i]= work[i]+p->vi->noisecompand[dB]+p->noiseoffset[i]+bitrate_noise_offset; + if(logmask[i]>p->vi->noisemaxsupp)logmask[i]=p->vi->noisemaxsupp; + } + _analysis_output("noise",seq,logmask,n,1,0); + + }else{ + for(i=0;i<n;i++)logmask[i]=NEGINF; + } + + /* set the ATH (floating below localmax, not global max by a + specified att) */ + if(p->vi->ath){ + float att=local_specmax+p->vi->ath_adjatt; + if(att<p->vi->ath_maxatt)att=p->vi->ath_maxatt; + + for(i=0;i<n;i++){ + float av=p->ath[i]+att; + if(av>logmask[i])logmask[i]=av; + } + } + + /* tone masking */ + seed_loop(p,(const float ***)p->tonecurves,logfft,logmask,seed,global_specmax); + max_seeds(p,seed,logmask); + + /* doing this here is clean, but we need to find a faster way to do + it than to just tack it on */ + + for(i=0;i<n;i++)if(logmdct[i]>=logmask[i])break; + if(i==n) + for(i=0;i<n;i++)logmask[i]=NEGINF; + else + for(i=0;i<n;i++) + logfft[i]=max(logmdct[i],logfft[i]); + + seq++; + +} + +float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd){ + vorbis_info *vi=vd->vi; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy_global *gi=&ci->psy_g_param; + + int n=ci->blocksizes[vd->W]/2; + float secs=(float)n/vi->rate; + + amp+=secs*gi->ampmax_att_per_sec; + if(amp<-9999)amp=-9999; + return(amp); +} + +static void couple_lossless(float A, float B, + float granule,float igranule, + float *mag, float *ang, + int flip_p){ + + if(fabs(A)>fabs(B)){ + A=rint(A*igranule)*granule; /* must be done *after* the comparison */ + B=rint(B*igranule)*granule; + + *mag=A; *ang=(A>0.f?A-B:B-A); + }else{ + A=rint(A*igranule)*granule; + B=rint(B*igranule)*granule; + + *mag=B; *ang=(B>0.f?A-B:B-A); + } + + if(flip_p && *ang>fabs(*mag)*1.9999f){ + *ang= -fabs(*mag)*2.f; + *mag= -*mag; + } +} + +static void couple_point(float A, float B, float fA, float fB, + float granule,float igranule, + float fmag, float *mag, float *ang){ + + float origmag=FAST_HYPOT(A*fA,B*fB),corr; + + if(fmag!=0.f){ + //float phase=rint((A-B)*.5/fmag); + + if(fabs(A)>fabs(B)){ + *mag=A;//phase=(A>0?phase:-phase); + }else{ + *mag=B;//phase=(B>0?phase:-phase); + } + + //switch((int)phase){ + //case 0: + corr=origmag/FAST_HYPOT(fmag*fA,fmag*fB); + *mag=rint(*mag*corr*igranule)*granule; + *ang=0.f; + //break; + //default: + //*mag=0.f; + //*ang=0.f; + //break; + //} + }else{ + *mag=0.f; + *ang=0.f; + } +} + + +void _vp_quantize_couple(vorbis_look_psy *p, + vorbis_info_mapping0 *vi, + float **pcm, + float **sofar, + float **quantized, + int *nonzero, + int passno){ + + int i,j,k,n=p->n; + vorbis_info_psy *info=p->vi; + + /* perform any requested channel coupling */ + for(i=0;i<vi->coupling_steps;i++){ + float granulem=info->couple_pass[passno].granulem; + float igranulem=info->couple_pass[passno].igranulem; + + /* make sure coupling a zero and a nonzero channel results in two + nonzero channels. */ + if(nonzero[vi->coupling_mag[i]] || + nonzero[vi->coupling_ang[i]]){ + + float *pcmM=pcm[vi->coupling_mag[i]]; + float *pcmA=pcm[vi->coupling_ang[i]]; + float *floorM=pcm[vi->coupling_mag[i]]+n; + float *floorA=pcm[vi->coupling_ang[i]]+n; + float *sofarM=sofar[vi->coupling_mag[i]]; + float *sofarA=sofar[vi->coupling_ang[i]]; + float *qM=quantized[vi->coupling_mag[i]]; + float *qA=quantized[vi->coupling_ang[i]]; + + nonzero[vi->coupling_mag[i]]=1; + nonzero[vi->coupling_ang[i]]=1; + + for(j=0,k=0;j<n;k++){ + vp_couple *part=info->couple_pass[passno].couple_pass+k; + float rqlimit=part->outofphase_requant_limit; + float flip_p=part->outofphase_redundant_flip_p; + + for(;j<part->limit && j<p->n;j++){ + /* partition by partition; k is our by-location partition + class counter */ + float ang,mag,fmag=max(fabs(pcmM[j]),fabs(pcmA[j])); + + if(fmag<part->amppost_point){ + couple_point(pcmM[j],pcmA[j],floorM[j],floorA[j], + granulem,igranulem,fmag,&mag,&ang); + + }else{ + couple_lossless(pcmM[j],pcmA[j], + granulem,igranulem,&mag,&ang,flip_p); + } + + /* executive decision time: when requantizing and recoupling + residue in order to progressively encode at finer + resolution, an out of phase component that originally + quntized to 2*mag can flip flop magnitude/angle if it + requantizes to not-quite out of phase. If that happens, + we opt not to fill in additional resolution (in order to + simplify the iterative codebook design and + efficiency). */ + + qM[j]=mag-sofarM[j]; + qA[j]=ang-sofarA[j]; + + if(qA[j]<-rqlimit || qA[j]>rqlimit){ + qM[j]=0.f; + qA[j]=0.f; + } + } + } + } + } +} @@ -11,7 +11,7 @@ ******************************************************************** function: random psychoacoustics (not including preecho) - last mod: $Id: psy.h,v 1.25.2.1 2001/12/17 05:39:24 xiphmont Exp $ + last mod: $Id: psy.h,v 1.25.2.2 2001/12/18 23:49:17 xiphmont Exp $ ********************************************************************/ @@ -134,22 +134,16 @@ extern void _vi_psy_free(vorbis_info_psy *i); extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i); extern void _vp_remove_floor(vorbis_look_psy *p, - vorbis_look_psy_global *g, - float *logmdct, float *mdct, float *codedflr, - float *residue, - float local_specmax); + float *residue); extern void _vp_compute_mask(vorbis_look_psy *p, - vorbis_look_psy_global *g, - int channel, float *fft, float *mdct, float *mask, float global_specmax, float local_specmax, - int lastsize, float bitrate_noise_offset); extern void _vp_quantize_couple(vorbis_look_psy *p, diff --git a/lib/res0.c b/lib/res0.c new file mode 100644 index 00000000..1bb3047e --- /dev/null +++ b/lib/res0.c @@ -0,0 +1,958 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * 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/ * + * * + ******************************************************************** + + function: residue backend 0, 1 and 2 implementation + last mod: $Id: res0.c,v 1.39.2.1 2001/12/18 23:49:17 xiphmont Exp $ + + ********************************************************************/ + +/* Slow, slow, slow, simpleminded and did I mention it was slow? The + encode/decode loops are coded for clarity and performance is not + yet even a nagging little idea lurking in the shadows. Oh and BTW, + it's slow. */ + +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include <ogg/ogg.h> +#include "vorbis/codec.h" +#include "codec_internal.h" +#include "registry.h" +#include "codebook.h" +#include "misc.h" +#include "os.h" + +#ifdef TRAIN_RES +#include <stdio.h> +#endif + +typedef struct { + vorbis_info_residue0 *info; + int map; + + int parts; + int stages; + codebook *fullbooks; + codebook *phrasebook; + codebook ***partbooks; + + int partvals; + int **decodemap; + + long postbits; + long phrasebits; + long frames; + + int qoffsets[BITTRACK_DIVISOR+1]; + +#ifdef TRAIN_RES + long *training_data[8][64]; + float training_max[8][64]; + float training_min[8][64]; + int longp; + float tmin; + float tmax; +#endif + +} vorbis_look_residue0; + +vorbis_info_residue *res0_copy_info(vorbis_info_residue *vr){ + vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr; + vorbis_info_residue0 *ret=_ogg_malloc(sizeof(*ret)); + memcpy(ret,info,sizeof(*ret)); + return(ret); +} + +void res0_free_info(vorbis_info_residue *i){ + vorbis_info_residue0 *info=(vorbis_info_residue0 *)i; + if(info){ + memset(info,0,sizeof(*info)); + _ogg_free(info); + } +} + +void res0_free_look(vorbis_look_residue *i){ + int j; + if(i){ + + vorbis_look_residue0 *look=(vorbis_look_residue0 *)i; + +#ifdef TRAIN_RES + { + int j,k,l; + for(j=0;j<look->parts;j++){ + fprintf(stderr,"partition %d: ",j); + for(k=0;k<8;k++) + if(look->training_data[k][j]){ + char buffer[80]; + FILE *of; + codebook *statebook=look->partbooks[j][k]; + + /* long and short into the same bucket by current convention */ + sprintf(buffer,"res_part%d_pass%d.vqd",j,k); + of=fopen(buffer,"a"); + + for(l=0;l<statebook->entries;l++) + fprintf(of,"%d:%ld\n",l,look->training_data[k][j][l]); + + fclose(of); + + fprintf(stderr,"%d(%.2f|%.2f) ",k,look->training_min[k][j],look->training_max[k][j]); + + _ogg_free(look->training_data[k][j]); + } + fprintf(stderr,"\n"); + } + } + fprintf(stderr,"min/max residue: %g::%g\n",look->tmin,look->tmax); + + fprintf(stderr,"residue bit usage %f:%f (%f total)\n", + (float)look->phrasebits/look->frames, + (float)look->postbits/look->frames, + (float)(look->postbits+look->phrasebits)/look->frames); +#endif + + + /*vorbis_info_residue0 *info=look->info; + + fprintf(stderr, + "%ld frames encoded in %ld phrasebits and %ld residue bits " + "(%g/frame) \n",look->frames,look->phrasebits, + look->resbitsflat, + (look->phrasebits+look->resbitsflat)/(float)look->frames); + + for(j=0;j<look->parts;j++){ + long acc=0; + fprintf(stderr,"\t[%d] == ",j); + for(k=0;k<look->stages;k++) + if((info->secondstages[j]>>k)&1){ + fprintf(stderr,"%ld,",look->resbits[j][k]); + acc+=look->resbits[j][k]; + } + + fprintf(stderr,":: (%ld vals) %1.2fbits/sample\n",look->resvals[j], + acc?(float)acc/(look->resvals[j]*info->grouping):0); + } + fprintf(stderr,"\n");*/ + + for(j=0;j<look->parts;j++) + if(look->partbooks[j])_ogg_free(look->partbooks[j]); + _ogg_free(look->partbooks); + for(j=0;j<look->partvals;j++) + _ogg_free(look->decodemap[j]); + _ogg_free(look->decodemap); + + memset(look,0,sizeof(*look)); + _ogg_free(look); + } +} + +static int ilog(unsigned int v){ + int ret=0; + while(v){ + ret++; + v>>=1; + } + return(ret); +} + +static int icount(unsigned int v){ + int ret=0; + while(v){ + ret+=v&1; + v>>=1; + } + return(ret); +} + + +void res0_pack(vorbis_info_residue *vr,oggpack_buffer *opb){ + vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr; + int j,acc=0; + oggpack_write(opb,info->begin,24); + oggpack_write(opb,info->end,24); + + oggpack_write(opb,info->grouping-1,24); /* residue vectors to group and + code with a partitioned book */ + oggpack_write(opb,info->partitions-1,6); /* possible partition choices */ + oggpack_write(opb,info->groupbook,8); /* group huffman book */ + + /* secondstages is a bitmask; as encoding progresses pass by pass, a + bitmask of one indicates this partition class has bits to write + this pass */ + for(j=0;j<info->partitions;j++){ + if(ilog(info->secondstages[j])>3){ + /* yes, this is a minor hack due to not thinking ahead */ + oggpack_write(opb,info->secondstages[j],3); + oggpack_write(opb,1,1); + oggpack_write(opb,info->secondstages[j]>>3,5); + }else + oggpack_write(opb,info->secondstages[j],4); /* trailing zero */ + acc+=icount(info->secondstages[j]); + } + for(j=0;j<acc;j++) + oggpack_write(opb,info->booklist[j],8); + +} + +/* vorbis_info is for range checking */ +vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){ + int j,acc=0; + vorbis_info_residue0 *info=_ogg_calloc(1,sizeof(*info)); + codec_setup_info *ci=vi->codec_setup; + + info->begin=oggpack_read(opb,24); + info->end=oggpack_read(opb,24); + info->grouping=oggpack_read(opb,24)+1; + info->partitions=oggpack_read(opb,6)+1; + info->groupbook=oggpack_read(opb,8); + + for(j=0;j<info->partitions;j++){ + int cascade=oggpack_read(opb,3); + if(oggpack_read(opb,1)) + cascade|=(oggpack_read(opb,5)<<3); + info->secondstages[j]=cascade; + + acc+=icount(cascade); + } + for(j=0;j<acc;j++) + info->booklist[j]=oggpack_read(opb,8); + + if(info->groupbook>=ci->books)goto errout; + for(j=0;j<acc;j++) + if(info->booklist[j]>=ci->books)goto errout; + + return(info); + errout: + res0_free_info(info); + return(NULL); +} + +vorbis_look_residue *res0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm, + vorbis_info_residue *vr){ + vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr; + vorbis_look_residue0 *look=_ogg_calloc(1,sizeof(*look)); + backend_lookup_state *be=vd->backend_state; + + int j,k,acc=0; + int dim; + int maxstage=0; + look->info=info; + look->map=vm->mapping; + + look->parts=info->partitions; + look->fullbooks=be->fullbooks; + look->phrasebook=be->fullbooks+info->groupbook; + dim=look->phrasebook->dim; + + look->partbooks=_ogg_calloc(look->parts,sizeof(*look->partbooks)); + + for(j=0;j<look->parts;j++){ + int stages=ilog(info->secondstages[j]); + if(stages){ + if(stages>maxstage)maxstage=stages; + look->partbooks[j]=_ogg_calloc(stages,sizeof(*look->partbooks[j])); + for(k=0;k<stages;k++) + if(info->secondstages[j]&(1<<k)){ + look->partbooks[j][k]=be->fullbooks+info->booklist[acc++]; +#ifdef TRAIN_RES + look->training_data[k][j]=calloc(look->partbooks[j][k]->entries, + sizeof(***look->training_data)); +#endif + } + } + } + + look->partvals=rint(pow(look->parts,dim)); + look->stages=maxstage; + look->decodemap=_ogg_malloc(look->partvals*sizeof(*look->decodemap)); + for(j=0;j<look->partvals;j++){ + long val=j; + long mult=look->partvals/look->parts; + look->decodemap[j]=_ogg_malloc(dim*sizeof(*look->decodemap[j])); + for(k=0;k<dim;k++){ + long deco=val/mult; + val-=deco*mult; + mult/=look->parts; + look->decodemap[j][k]=deco; + } + } + + { + int samples_per_partition=info->grouping; + int n=info->end-info->begin,i; + int partvals=n/samples_per_partition; + + for(i=0;i<BITTRACK_DIVISOR;i++) + look->qoffsets[i]=partvals*(i+1)/BITTRACK_DIVISOR; + + look->qoffsets[i]=9999999; + } + + return(look); +} + + +/* does not guard against invalid settings; eg, a subn of 16 and a + subgroup request of 32. Max subn of 128 */ +static int _interleaved_testhack(float *vec,int n,vorbis_look_residue0 *look, + int auxparts,int auxpartnum){ + vorbis_info_residue0 *info=look->info; + int i,j=0; + float max,localmax=0.f; + float temp[128]; + float entropy[8]; + + /* setup */ + for(i=0;i<n;i++)temp[i]=fabs(vec[i]); + + /* handle case subgrp==1 outside */ + for(i=0;i<n;i++) + if(temp[i]>localmax)localmax=temp[i]; + max=localmax; + + for(i=0;i<n;i++)temp[i]=rint(temp[i]); + + while(1){ + entropy[j]=localmax; + n>>=1; + if(!n)break; + j++; + + for(i=0;i<n;i++){ + temp[i]+=temp[i+n]; + } + localmax=0.f; + for(i=0;i<n;i++) + if(temp[i]>localmax)localmax=temp[i]; + } + + for(i=0;i<auxparts-1;i++) + if(auxpartnum<info->blimit[i] && + entropy[info->subgrp[i]]<=info->entmax[i] && + max<=info->ampmax[i]) + break; + + return(i); +} + +static int _testhack(float *vec,int n,vorbis_look_residue0 *look, + int auxparts,int auxpartnum){ + vorbis_info_residue0 *info=look->info; + int i; + float max=0.f; + float temp[128]; + float entropy=0.f; + + /* setup */ + for(i=0;i<n;i++)temp[i]=fabs(vec[i]); + + for(i=0;i<n;i++) + if(temp[i]>max)max=temp[i]; + + for(i=0;i<n;i++)temp[i]=rint(temp[i]); + + for(i=0;i<n;i++) + entropy+=temp[i]; + + for(i=0;i<auxparts-1;i++) + if(auxpartnum<info->blimit[i] && + entropy<=info->entmax[i] && + max<=info->ampmax[i]) + break; + + return(i); +} + +static int _interleaved_encodepart(oggpack_buffer *opb,float *vec, int n, + codebook *book,long *acc){ + int i,bits=0; + int dim=book->dim; + int step=n/dim; + + for(i=0;i<step;i++){ + int entry=vorbis_book_besterror(book,vec+i,step,0); + +#ifdef TRAIN_RES + acc[entry]++; +#endif + + bits+=vorbis_book_encode(book,entry,opb); + } + + return(bits); +} + +static int _encodepart(oggpack_buffer *opb,float *vec, int n, + codebook *book,long *acc){ + int i,bits=0; + int dim=book->dim; + int step=n/dim; + + for(i=0;i<step;i++){ + int entry=vorbis_book_besterror(book,vec+i*dim,1,0); + +#ifdef TRAIN_RES + acc[entry]++; +#endif + + bits+=vorbis_book_encode(book,entry,opb); + } + + return(bits); +} + +static long **_01class(vorbis_block *vb,vorbis_look_residue *vl, + float **in,int ch, + int (*classify)(float *,int,vorbis_look_residue0 *, + int,int)){ + long i,j; + vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl; + vorbis_info_residue0 *info=look->info; + + /* move all this setup out later */ + int samples_per_partition=info->grouping; + int possible_partitions=info->partitions; + int n=info->end-info->begin; + + int partvals=n/samples_per_partition; + long **partword=_vorbis_block_alloc(vb,ch*sizeof(*partword)); + + /* we find the partition type for each partition of each + channel. We'll go back and do the interleaved encoding in a + bit. For now, clarity */ + + for(i=0;i<ch;i++){ + partword[i]=_vorbis_block_alloc(vb,n/samples_per_partition*sizeof(*partword[i])); + memset(partword[i],0,n/samples_per_partition*sizeof(*partword[i])); + } + + for(i=0;i<partvals;i++){ + for(j=0;j<ch;j++) + /* do the partition decision based on the 'entropy' + int the block */ + partword[j][i]= + classify(in[j]+i*samples_per_partition+info->begin, + samples_per_partition,look,possible_partitions,i); + + } + +#ifdef TRAIN_RES + look->longp=vb->W; + { + FILE *of; + char buffer[80]; + + for(i=0;i<ch;i++){ + sprintf(buffer,"resaux_%s.vqd",(vb->mode?"long":"short")); + of=fopen(buffer,"a"); + for(j=0;j<partvals;j++) + fprintf(of,"%ld, ",partword[i][j]); + fprintf(of,"\n"); + fclose(of); + } + } +#endif + look->frames++; + + return(partword); +} + +static long **_2class(vorbis_block *vb,vorbis_look_residue *vl, + float **in,int ch, + int (*classify)(float *,int,vorbis_look_residue0 *, + int,int)){ + long i,j,k,l; + vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl; + vorbis_info_residue0 *info=look->info; + + /* move all this setup out later */ + int samples_per_partition=info->grouping; + int possible_partitions=info->partitions; + int n=info->end-info->begin; + + int partvals=n/samples_per_partition; + long **partword=_vorbis_block_alloc(vb,sizeof(*partword)); + float *work=alloca(sizeof(*work)*samples_per_partition); + +#ifdef TRAIN_RES + FILE *of; + char buffer[80]; +#endif + + partword[0]=_vorbis_block_alloc(vb,n*ch/samples_per_partition*sizeof(*partword[0])); + memset(partword[0],0,n*ch/samples_per_partition*sizeof(*partword[0])); + + for(i=0,j=0,k=0,l=info->begin;i<partvals;i++){ + for(k=0;k<samples_per_partition;k++){ + work[k]=in[j][l]; + j++; + if(j>=ch){ + j=0; + l++; + } + } + + partword[0][i]= + classify(work,samples_per_partition,look,possible_partitions,i); + + + } + +#ifdef TRAIN_RES + look->longp=vb->W; + sprintf(buffer,"resaux_%s.vqd",(vb->mode?"long":"short")); + of=fopen(buffer,"a"); + for(i=0;i<partvals;i++) + fprintf(of,"%ld, ",partword[0][i]); + fprintf(of,"\n"); + fclose(of); +#endif + + look->frames++; + + return(partword); +} + +static int _01forward(vorbis_block *vb,vorbis_look_residue *vl, + float **in,int ch, + int pass,long **partword, + int (*encode)(oggpack_buffer *,float *,int, + codebook *,long *), + ogg_uint32_t *stats){ + long i,j,k,s; + vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl; + vorbis_info_residue0 *info=look->info; + + vorbis_dsp_state *vd=vb->vd; + vorbis_info *vi=vd->vi; + codec_setup_info *ci=vi->codec_setup; + + + /* move all this setup out later */ + int samples_per_partition=info->grouping; + int possible_partitions=info->partitions; + int partitions_per_word=look->phrasebook->dim; + int n=info->end-info->begin; + + int partvals=n/samples_per_partition; + long resbits[128]; + long resvals[128]; + +#ifdef TRAIN_RES + for(i=0;i<ch;i++) + for(j=info->begin;j<info->end;j++){ + if(in[i][j]>look->tmax)look->tmax=in[i][j]; + if(in[i][j]<look->tmin)look->tmin=in[i][j]; + } +#endif + + memset(resbits,0,sizeof(resbits)); + memset(resvals,0,sizeof(resvals)); + + /* we code the partition words for each channel, then the residual + words for a partition per channel until we've written all the + residual words for that partition word. Then write the next + partition channel words... */ + + for(s=(pass==0?0:ci->passlimit[pass-1]);s<ci->passlimit[pass];s++){ + int bin=0; + ogg_uint32_t *qptr=NULL; + if(stats)qptr=stats+s*BITTRACK_DIVISOR; + + for(i=0;i<partvals;){ + + /* first we encode a partition codeword for each channel */ + if(s==0){ + for(j=0;j<ch;j++){ + long val=partword[j][i]; + long ret; + for(k=1;k<partitions_per_word;k++){ + val*=possible_partitions; + if(i+k<partvals) + val+=partword[j][i+k]; + } + + /* training hack */ + if(val<look->phrasebook->entries) + ret=vorbis_book_encode(look->phrasebook,val,&vb->opb); +#ifdef TRAIN_RES + else + fprintf(stderr,"!"); +#endif + look->phrasebits+=ret; + + } + } + + /* now we encode interleaved residual values for the partitions */ + for(k=0;k<partitions_per_word && i<partvals;k++,i++){ + long offset=i*samples_per_partition+info->begin; + + if(qptr)while(i>=look->qoffsets[bin]) + qptr[bin++]=oggpack_bits(&vb->opb); + + for(j=0;j<ch;j++){ + if(s==0)resvals[partword[j][i]]+=samples_per_partition; + if(info->secondstages[partword[j][i]]&(1<<s)){ + codebook *statebook=look->partbooks[partword[j][i]][s]; + if(statebook){ + int ret; + long *accumulator=NULL; + +#ifdef TRAIN_RES + accumulator=look->training_data[s][partword[j][i]]; + { + int l; + float *samples=in[j]+offset; + for(l=0;l<samples_per_partition;l++){ + if(samples[l]<look->training_min[s][partword[j][i]]) + look->training_min[s][partword[j][i]]=samples[l]; + if(samples[l]>look->training_max[s][partword[j][i]]) + look->training_max[s][partword[j][i]]=samples[l]; + } + } +#endif + + ret=encode(&vb->opb,in[j]+offset,samples_per_partition, + statebook,accumulator); + + look->postbits+=ret; + resbits[partword[j][i]]+=ret; + } + } + } + } + if(qptr)while(i>=look->qoffsets[bin]) + qptr[bin++]=oggpack_bits(&vb->opb); + } + } + + /*{ + long total=0; + long totalbits=0; + fprintf(stderr,"%d :: ",vb->mode); + for(k=0;k<possible_partitions;k++){ + fprintf(stderr,"%ld/%1.2g, ",resvals[k],(float)resbits[k]/resvals[k]); + total+=resvals[k]; + totalbits+=resbits[k]; + } + + fprintf(stderr,":: %ld:%1.2g\n",total,(double)totalbits/total); + }*/ + return(0); +} + +/* a truncated packet here just means 'stop working'; it's not an error */ +static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl, + float **in,int ch, + long (*decodepart)(codebook *, float *, + oggpack_buffer *,int)){ + + long i,j,k,l,s; + vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl; + vorbis_info_residue0 *info=look->info; + + /* move all this setup out later */ + int samples_per_partition=info->grouping; + int partitions_per_word=look->phrasebook->dim; + int n=info->end-info->begin; + + int partvals=n/samples_per_partition; + int partwords=(partvals+partitions_per_word-1)/partitions_per_word; + int ***partword=alloca(ch*sizeof(*partword)); + + for(j=0;j<ch;j++) + partword[j]=_vorbis_block_alloc(vb,partwords*sizeof(*partword[j])); + + for(s=0;s<look->stages;s++){ + + /* each loop decodes on partition codeword containing + partitions_pre_word partitions */ + for(i=0,l=0;i<partvals;l++){ + if(s==0){ + /* fetch the partition word for each channel */ + for(j=0;j<ch;j++){ + int temp=vorbis_book_decode(look->phrasebook,&vb->opb); + if(temp==-1)goto eopbreak; + partword[j][l]=look->decodemap[temp]; + if(partword[j][l]==NULL)goto errout; + } + } + + /* now we decode residual values for the partitions */ + for(k=0;k<partitions_per_word && i<partvals;k++,i++) + for(j=0;j<ch;j++){ + long offset=info->begin+i*samples_per_partition; + if(info->secondstages[partword[j][l][k]]&(1<<s)){ + codebook *stagebook=look->partbooks[partword[j][l][k]][s]; + if(stagebook){ + if(decodepart(stagebook,in[j]+offset,&vb->opb, + samples_per_partition)==-1)goto eopbreak; + } + } + } + } + } + + errout: + eopbreak: + return(0); +} + +/* residue 0 and 1 are just slight variants of one another. 0 is + interleaved, 1 is not */ +long **res0_class(vorbis_block *vb,vorbis_look_residue *vl, + float **in,int *nonzero,int ch){ + /* we encode only the nonzero parts of a bundle */ + int i,used=0; + for(i=0;i<ch;i++) + if(nonzero[i]) + in[used++]=in[i]; + if(used) + /*return(_01class(vb,vl,in,used,_interleaved_testhack));*/ + return(_01class(vb,vl,in,used,_testhack)); + else + return(0); +} + +int res0_forward(vorbis_block *vb,vorbis_look_residue *vl, + float **in,float **out,int *nonzero,int ch, + int pass, long **partword,ogg_uint32_t *stats){ + /* we encode only the nonzero parts of a bundle */ + int i,j,used=0,n=vb->pcmend/2; + for(i=0;i<ch;i++) + if(nonzero[i]){ + for(j=0;j<n;j++) + out[i][j]+=in[i][j]; + in[used++]=in[i]; + } + if(used){ + int ret=_01forward(vb,vl,in,used,pass,partword, + _interleaved_encodepart,stats); + used=0; + for(i=0;i<ch;i++) + if(nonzero[i]){ + for(j=0;j<n;j++) + out[i][j]-=in[used][j]; + used++; + } + return(ret); + }else{ + for(i=0;i<vorbis_bitrate_maxmarkers();i++) + stats[i]=oggpack_bits(&vb->opb); + + return(0); + } +} + +int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl, + float **in,int *nonzero,int ch){ + int i,used=0; + for(i=0;i<ch;i++) + if(nonzero[i]) + in[used++]=in[i]; + if(used) + return(_01inverse(vb,vl,in,used,vorbis_book_decodevs_add)); + else + return(0); +} + +int res1_forward(vorbis_block *vb,vorbis_look_residue *vl, + float **in,float **out,int *nonzero,int ch, + int pass, long **partword, ogg_uint32_t *stats){ + int i,j,used=0,n=vb->pcmend/2; + for(i=0;i<ch;i++) + if(nonzero[i]){ + for(j=0;j<n;j++) + out[i][j]+=in[i][j]; + in[used++]=in[i]; + } + + if(used){ + int ret=_01forward(vb,vl,in,used,pass,partword,_encodepart,stats); + used=0; + for(i=0;i<ch;i++) + if(nonzero[i]){ + for(j=0;j<n;j++) + out[i][j]-=in[used][j]; + used++; + } + return(ret); + }else{ + for(i=0;i<vorbis_bitrate_maxmarkers();i++) + stats[i]=oggpack_bits(&vb->opb); + + return(0); + } +} + +long **res1_class(vorbis_block *vb,vorbis_look_residue *vl, + float **in,int *nonzero,int ch){ + int i,used=0; + for(i=0;i<ch;i++) + if(nonzero[i]) + in[used++]=in[i]; + if(used) + return(_01class(vb,vl,in,used,_testhack)); + else + return(0); +} + +int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl, + float **in,int *nonzero,int ch){ + int i,used=0; + for(i=0;i<ch;i++) + if(nonzero[i]) + in[used++]=in[i]; + if(used) + return(_01inverse(vb,vl,in,used,vorbis_book_decodev_add)); + else + return(0); +} + +long **res2_class(vorbis_block *vb,vorbis_look_residue *vl, + float **in,int *nonzero,int ch){ + int i,used=0; + for(i=0;i<ch;i++) + if(nonzero[i]) + in[used++]=in[i]; + if(used) + return(_2class(vb,vl,in,used,_testhack)); + else + return(0); +} + +/* res2 is slightly more different; all the channels are interleaved + into a single vector and encoded. */ + +int res2_forward(vorbis_block *vb,vorbis_look_residue *vl, + float **in,float **out,int *nonzero,int ch, + int pass,long **partword,ogg_uint32_t *stats){ + long i,j,k,n=vb->pcmend/2,used=0; + + /* don't duplicate the code; use a working vector hack for now and + reshape ourselves into a single channel res1 */ + /* ugly; reallocs for each coupling pass :-( */ + float *work=_vorbis_block_alloc(vb,ch*n*sizeof(*work)); + for(i=0;i<ch;i++){ + float *pcm=in[i]; + if(nonzero[i])used++; + for(j=0,k=i;j<n;j++,k+=ch) + work[k]=pcm[j]; + } + + if(used){ + int ret=_01forward(vb,vl,&work,1,pass,partword,_encodepart,stats); + /* update the sofar vector */ + for(i=0;i<ch;i++){ + float *pcm=in[i]; + float *sofar=out[i]; + for(j=0,k=i;j<n;j++,k+=ch) + sofar[j]+=pcm[j]-work[k]; + + } + return(ret); + }else{ + for(i=0;i<vorbis_bitrate_maxmarkers();i++) + stats[i]=oggpack_bits(&vb->opb); + + return(0); + } +} + +/* duplicate code here as speed is somewhat more important */ +int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl, + float **in,int *nonzero,int ch){ + long i,k,l,s; + vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl; + vorbis_info_residue0 *info=look->info; + + /* move all this setup out later */ + int samples_per_partition=info->grouping; + int partitions_per_word=look->phrasebook->dim; + int n=info->end-info->begin; + + int partvals=n/samples_per_partition; + int partwords=(partvals+partitions_per_word-1)/partitions_per_word; + int **partword=_vorbis_block_alloc(vb,partwords*sizeof(*partword)); + + for(i=0;i<ch;i++)if(nonzero[i])break; + if(i==ch)return(0); /* no nonzero vectors */ + + for(s=0;s<look->stages;s++){ + for(i=0,l=0;i<partvals;l++){ + + if(s==0){ + /* fetch the partition word */ + int temp=vorbis_book_decode(look->phrasebook,&vb->opb); + if(temp==-1)goto eopbreak; + partword[l]=look->decodemap[temp]; + if(partword[l]==NULL)goto errout; + } + + /* now we decode residual values for the partitions */ + for(k=0;k<partitions_per_word && i<partvals;k++,i++) + if(info->secondstages[partword[l][k]]&(1<<s)){ + codebook *stagebook=look->partbooks[partword[l][k]][s]; + + if(stagebook){ + if(vorbis_book_decodevv_add(stagebook,in, + i*samples_per_partition+info->begin,ch, + &vb->opb,samples_per_partition)==-1) + goto eopbreak; + } + } + } + } + + errout: + eopbreak: + return(0); +} + + +vorbis_func_residue residue0_exportbundle={ + &res0_pack, + &res0_unpack, + &res0_look, + &res0_copy_info, + &res0_free_info, + &res0_free_look, + &res0_class, + &res0_forward, + &res0_inverse +}; + +vorbis_func_residue residue1_exportbundle={ + &res0_pack, + &res0_unpack, + &res0_look, + &res0_copy_info, + &res0_free_info, + &res0_free_look, + &res1_class, + &res1_forward, + &res1_inverse +}; + +vorbis_func_residue residue2_exportbundle={ + &res0_pack, + &res0_unpack, + &res0_look, + &res0_copy_info, + &res0_free_info, + &res0_free_look, + &res2_class, + &res2_forward, + &res2_inverse +}; diff --git a/lib/vorbisenc.c b/lib/vorbisenc.c index 44e1dc18..317f582b 100644 --- a/lib/vorbisenc.c +++ b/lib/vorbisenc.c @@ -11,7 +11,7 @@ ******************************************************************** function: simple programmatic interface for encoder mode setup - last mod: $Id: vorbisenc.c,v 1.23.2.1 2001/12/17 05:39:24 xiphmont Exp $ + last mod: $Id: vorbisenc.c,v 1.23.2.2 2001/12/18 23:49:17 xiphmont Exp $ ********************************************************************/ @@ -471,12 +471,12 @@ static int vorbis_encode_residue_setup(vorbis_info *vi,double q,int block, if(stereo_backfill_p && amplitude_select){ memcpy(psy->couple_pass+iterations,psy->couple_pass+iterations-1, sizeof(*psy->couple_pass)); - amplitude_select=amplitude_select-1; psy->couple_pass[1].couple_pass[1].amppost_point=stereo_threshholds[amplitude_select-1]; ci->passlimit[1]=4; for(i=0;i<r->partitions;i++) - if(in[iq].books_stereo_backfill[amplitude_select-1][i]) + if(in[iq].books_stereo_backfill[amplitude_select][i]) r->secondstages[i]|=8; + amplitude_select=amplitude_select-1; iterations++; } @@ -485,6 +485,8 @@ static int vorbis_encode_residue_setup(vorbis_info *vi,double q,int block, sizeof(*psy->couple_pass)); psy->couple_pass[iterations].granulem=.333333333; psy->couple_pass[iterations].igranulem=3.; + psy->couple_pass[iterations].couple_pass[0].outofphase_requant_limit=1.; + psy->couple_pass[iterations].couple_pass[1].outofphase_requant_limit=1.; for(i=0;i<r->partitions;i++) if(in[iq].books_residue_backfill[amplitude_select][i][0]) r->secondstages[i]|=(1<<(iterations+2)); @@ -495,6 +497,8 @@ static int vorbis_encode_residue_setup(vorbis_info *vi,double q,int block, sizeof(*psy->couple_pass)); psy->couple_pass[iterations].granulem=.1111111111; psy->couple_pass[iterations].igranulem=9.; + psy->couple_pass[iterations].couple_pass[0].outofphase_requant_limit=.3; + psy->couple_pass[iterations].couple_pass[1].outofphase_requant_limit=.3; for(i=0;i<r->partitions;i++) if(in[iq].books_residue_backfill[amplitude_select][i][1]) r->secondstages[i]|=(1<<(iterations+2)); @@ -521,7 +525,7 @@ static int vorbis_encode_residue_setup(vorbis_info *vi,double q,int block, memcpy(&ci->psy_param[block*2+1]->couple_pass, &ci->psy_param[block*2]->couple_pass, - sizeof(psy->couple_pass[0])); + sizeof(psy->couple_pass)); /* fill in all the books */ { @@ -588,10 +592,10 @@ static int vorbis_encode_lowpass_setup(vorbis_info *vi,double q,int block){ here to next boundary, or the vorbis spec will round it *down* to previous boundary in encode/decode */ if(ci->residue_type[block]==2) - r->end=((freq/nyq*blocksize*2)/r->grouping+.9)* /* round up only if we're well past */ + r->end=(int)((freq/nyq*blocksize*2)/r->grouping+.9)* /* round up only if we're well past */ r->grouping; else - r->end=((freq/nyq*blocksize)/r->grouping+.9)* /* round up only if we're well past */ + r->end=(int)((freq/nyq*blocksize)/r->grouping+.9)* /* round up only if we're well past */ r->grouping; return(0); } @@ -815,7 +819,15 @@ int vorbis_encode_init_vbr(vorbis_info *vi, ){ int ret=0; - ret=vorbis_encode_setup_vbr(vi,channels,rate,base_quality); + ret=vorbis_encode_setup_vbr(vi,channels,rate,1.); + + { + codec_setup_info *ci=vi->codec_setup; + highlevel_encode_setup *hi=&ci->hi; + hi->stereo_couple_p=0; + hi->residue_backfill_p=1; + } + if(ret){ vorbis_info_clear(vi); return ret; diff --git a/vq/44c0.vqs b/vq/44c0.vqs index 0431071e..59aebe12 100644 --- a/vq/44c0.vqs +++ b/vq/44c0.vqs @@ -1,32 +1,3 @@ -huffbuild 44l/line_128x7_class1.vqd 0-64 -huffbuild 44l/line_128x7_class2.vqd 0-64 - -huffbuild 44l/line_128x7_0sub0.vqd 0-64 -huffbuild 44l/line_128x7_1sub1.vqd 1-9 -huffbuild 44l/line_128x7_1sub2.vqd 9-25 -huffbuild 44l/line_128x7_1sub3.vqd 25-64 -huffbuild 44l/line_128x7_2sub1.vqd 1-9 -huffbuild 44l/line_128x7_2sub2.vqd 9-25 -huffbuild 44l/line_128x7_2sub3.vqd 25-64 - -huffbuild 44l/line_1024x31_class0.vqd 0-8 -huffbuild 44l/line_1024x31_class1.vqd 0-16 -huffbuild 44l/line_1024x31_class2.vqd 0-64 -huffbuild 44l/line_1024x31_class3.vqd 0-64 - -huffbuild 44l/line_1024x31_0sub0.vqd 0-32 -huffbuild 44l/line_1024x31_0sub1.vqd 32-128 - -huffbuild 44l/line_1024x31_1sub0.vqd 0-32 -huffbuild 44l/line_1024x31_1sub1.vqd 32-128 - -huffbuild 44l/line_1024x31_2sub1.vqd 1-18 -huffbuild 44l/line_1024x31_2sub2.vqd 18-50 -huffbuild 44l/line_1024x31_2sub3.vqd 50-128 -huffbuild 44l/line_1024x31_3sub1.vqd 1-18 -huffbuild 44l/line_1024x31_3sub2.vqd 18-50 -huffbuild 44l/line_1024x31_3sub3.vqd 50-128 - cp 44c0_s0/resaux_short.vqd _44c0_short.vqd cp 44c0_s0/resaux_long.vqd _44c0_long.vqd @@ -97,7 +68,7 @@ haux _44c0_long.vqd 0,44,2 #iter 3 (residue backfill) -:_s0_p0_r0 44cL_s0/res_part0_r1.vqd, 2, nonseq, 0 +- .111111111 .222222222 -:_s0_pN_r0 44cL_s0/res_partN_r1.vqd, 2, nonseq, 0 +- .111111111 .222222222 -:_s1_pS_r0 44cL_s1/res_partS_r1.vqd, 2, nonseq, 0 +- .111111111 +:_s0_p0_r1 44cL_s0/res_part0_r1.vqd, 2, nonseq, 0 +- .111111111 .222222222 +:_s0_pN_r1 44cL_s0/res_partN_r1.vqd, 2, nonseq, 0 +- .111111111 .222222222 +:_s1_pS_r1 44cL_s1/res_partS_r1.vqd, 2, nonseq, 0 +- .111111111 diff --git a/vq/44c1.vqs b/vq/44c1.vqs index fca8436b..a90001ee 100644 --- a/vq/44c1.vqs +++ b/vq/44c1.vqs @@ -1,14 +1,3 @@ -huffbuild 44l/line_128x9_class1.vqd 0-256 -huffbuild 44l/line_128x9_class2.vqd 0-256 - -huffbuild 44l/line_128x9_0sub0.vqd 0-64 -huffbuild 44l/line_128x9_1sub1.vqd 1-9 -huffbuild 44l/line_128x9_1sub2.vqd 9-25 -huffbuild 44l/line_128x9_1sub3.vqd 25-64 -huffbuild 44l/line_128x9_2sub1.vqd 1-9 -huffbuild 44l/line_128x9_2sub2.vqd 9-25 -huffbuild 44l/line_128x9_2sub3.vqd 25-64 - cp 44c1_s0/resaux_short.vqd _44c1_short.vqd cp 44c1_s0/resaux_long.vqd _44c1_long.vqd diff --git a/vq/44c3.vqs b/vq/44c3.vqs index 6c25dd71..e0232c83 100644 --- a/vq/44c3.vqs +++ b/vq/44c3.vqs @@ -1,14 +1,3 @@ -huffbuild 44l/line_128x19_class1.vqd 0-64 -huffbuild 44l/line_128x19_class2.vqd 0-64 - -huffbuild 44l/line_128x19_0sub0.vqd 0-128 -huffbuild 44l/line_128x19_1sub1.vqd 1-25 -huffbuild 44l/line_128x19_1sub2.vqd 18-50 -huffbuild 44l/line_128x19_1sub3.vqd 50-128 -huffbuild 44l/line_128x19_2sub1.vqd 1-18 -huffbuild 44l/line_128x19_2sub2.vqd 18-50 -huffbuild 44l/line_128x19_2sub3.vqd 50-128 - cp 44c3_s0/resaux_short.vqd _44c3_short.vqd cp 44c3_s0/resaux_long.vqd _44c3_long.vqd diff --git a/vq/44c4.vqs b/vq/44c4.vqs index cc53c8b1..717700c3 100644 --- a/vq/44c4.vqs +++ b/vq/44c4.vqs @@ -76,19 +76,19 @@ haux _44c4_long.vqd 0,64,2 # 2 . . . # 4 . . . . . . . -:_s1_p2_s0 44c4_s1/res_part2_pass4.vqd, 2, nonseq, 0 +- 1 2 -:_s1_p4_s0 44c4_s1/res_part4_pass4.vqd, 2, nonseq, 0 +- 1 2 3 4 -:_s1_p6_s0 44c4_s1/res_part6_pass4.vqd, 2, nonseq, 0 +- 1 2 3 4 -:_s1_p7_s0 44c4_s1/res_part7_pass4.vqd, 2, nonseq, 0 +- 1 2 3 4 -:_s1_p8_s0 44c4_s1/res_part8_pass4.vqd, 2, nonseq, 0 +- 1 2 3 4 -:_s1_p9_s0 44c4_s1/res_part9_pass4.vqd, 2, nonseq, 0 +- 1 2 3 4 - -:_s2_p6_s0 44c4_s2/res_part6_pass4.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 -:_s2_p7_s0 44c4_s2/res_part7_pass4.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 -:_s2_p8_s0 44c4_s2/res_part8_pass4.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 -:_s2_p9_s0 44c4_s2/res_part9_pass4.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 - -:_s3_p9_s0 44c4_s3/res_part789_pass4.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 +:_s1_p2_s0 44cM_s1/res_part2_pass3.vqd, 2, nonseq, 0 +- 1 2 +:_s1_p4_s0 44cM_s1/res_part4_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 +:_s1_p6_s0 44cM_s1/res_part6_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 +:_s1_p7_s0 44cM_s1/res_part7_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 +:_s1_p8_s0 44cM_s1/res_part8_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 +:_s1_p9_s0 44cM_s1/res_part9_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 + +:_s2_p6_s0 44cM_s2/res_part6_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 +:_s2_p7_s0 44cM_s2/res_part7_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 +:_s2_p8_s0 44cM_s2/res_part8_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 +:_s2_p9_s0 44cM_s2/res_part9_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 + +:_s3_p9_s0 44cM_s3/res_part789_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #iter 2 (residue backfill) shared for all 'mid' modes diff --git a/vq/44c5.vqs b/vq/44c5.vqs index 9f75447d..27ce7480 100644 --- a/vq/44c5.vqs +++ b/vq/44c5.vqs @@ -53,15 +53,15 @@ haux _44c5_long.vqd 0,64,2 :_s3_p8_0 44c5_s3/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 13 26 39 52 65 78 :_s3_p8_1 44c5_s3/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 -:_s0_p9_0 44c5_s0/res_part9_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1005 1226 1447 +:_s0_p9_0 44c5_s0/res_part9_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1105 1326 1547 :_s0_p9_1 44c5_s0/res_part9_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78 91 104 :_s0_p9_2 44c5_s0/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 -:_s1_p9_0 44c5_s1/res_part9_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1005 1226 1447 +:_s1_p9_0 44c5_s1/res_part9_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1105 1326 1547 :_s1_p9_1 44c5_s1/res_part9_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78 91 104 :_s1_p9_2 44c5_s1/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 -:_s2_p9_0 44c5_s2/res_part9_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1005 1226 1447 +:_s2_p9_0 44c5_s2/res_part9_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1105 1326 1547 :_s2_p9_1 44c5_s2/res_part9_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78 91 104 :_s2_p9_2 44c5_s2/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 -:_s3_p9_0 44c5_s3/res_part9_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1005 1226 1447 +:_s3_p9_0 44c5_s3/res_part9_pass0.vqd, 2, nonseq, 0 +- 221 442 663 884 1105 1326 1547 :_s3_p9_1 44c5_s3/res_part9_pass1.vqd, 2, nonseq, 0 +- 13 26 39 52 65 78 91 104 :_s3_p9_2 44c5_s3/res_part9_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 diff --git a/vq/44u0.vqs b/vq/44u0.vqs new file mode 100644 index 00000000..8d4761ea --- /dev/null +++ b/vq/44u0.vqs @@ -0,0 +1,36 @@ + +GO + +>_44u0 noninterleaved + +#iter 0 + +# 0 1 2 4 26 1 4 + +# 0 0 0 0 +# +# 0 1 2 3 4 5 6 7 +# 1 . . +# 2 . . +# 4 . . . . . . + +:_p1_0 44u0/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1 +:_p2_0 44u0/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 2 +:_p3_0 44u0/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 +:_p4_0 44u0/res_part4_pass0.vqd, 2, nonseq , 0 +- 3 6 9 12 15 18 21 24 27 +:_p4_1 44u0/res_part4_pass1.vqd, 4, nonseq cull, 0 +- 1 +:_p5_0 44u0/res_part5_pass2.vqd, 4, nonseq cull, 0 +- 1 +:_p6_0 44u0/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 + +:_p7_0 44u0/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 +:_p7_1 44u0/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33 +:_p7_2 44u0/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 + +#iter 1 + +:_p0_r0 44u0/res_part0_pass3.vqd, 2, nonseq cull, 0 +- .33333333 +:_p1_r0 44u0/res_partN_pass3.vqd, 2, nonseq cull, 0 +- .33333333 + +#iter 2 + +:_p0_r1 44u0/res_part0_pass4.vqd, 2, nonseq cull, 0 +- .11111111 +:_p1_r1 44u0/res_partN_pass4.vqd, 2, nonseq cull, 0 +- .11111111 diff --git a/vq/44u4.vqs b/vq/44u4.vqs new file mode 100644 index 00000000..b955c004 --- /dev/null +++ b/vq/44u4.vqs @@ -0,0 +1,37 @@ +GO + +>_44u4 noninterleaved + + +#iter 0 + +# 0 1 1 2 2 4 4 16 42 + +# 0 0 0 + +# 0 1 2 3 4 5 6 7 8 9 +# 1 . . . +# 2 . . . +# 4 . . . . . . . + +:_p1_0 44u4/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1 +:_p2_0 44u4/res_part2_pass2.vqd, 4, nonseq cull, 0 +- 1 +:_p3_0 44u4/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 2 +:_p4_0 44u4/res_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2 +:_p5_0 44u4/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 +:_p6_0 44u4/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 +:_p7_0 44u4/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 3 6 9 12 15 +:_p7_1 44u4/res_part7_pass1.vqd, 4, nonseq cull, 0 +- 1 +:_p8_0 44u4/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30 35 40 +:_p8_1 44u4/res_part8_pass1.vqd, 4, nonseq cull, 0 +- 1 2 +:_p9_0 44u4/res_part9_pass0.vqd, 2, nonseq, 0 +- 637 1274 1911 +:_p9_1 44u4/res_part9_pass1.vqd, 2, nonseq, 0 +- 49 98 147 196 245 294 +:_p9_2 44u4/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 +#iter 1 + +:_p0_r0 44u4/res_part0_pass3.vqd, 2, nonseq cull, 0 +- .33333333 +:_p1_r0 44u4/res_partN_pass3.vqd, 2, nonseq cull, 0 +- .33333333 + +#iter 2 + +:_p0_r1 44u4/res_part0_pass4.vqd, 2, nonseq cull, 0 +- .11111111 +:_p1_r1 44u4/res_partN_pass4.vqd, 2, nonseq cull, 0 +- .11111111 diff --git a/vq/44u7.vqs b/vq/44u7.vqs new file mode 100644 index 00000000..65303ac9 --- /dev/null +++ b/vq/44u7.vqs @@ -0,0 +1,40 @@ +GO + +>_44u7 noninterleaved + +# 0 8 42 1 2 4 8 16 59 + +# 0 0 0 + +# 0 1 2 3 4 5 6 7 8 9 +# 1 . . . . +# 2 . . . . +# 4 . . . . . . + +:_p1_0 44u7/res_part1_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 +:_p2_0 44u7/res_part2_pass0.vqd, 2, nonseq cull, 0 +- 5 10 15 20 25 30 35 40 +:_p2_1 44u7/res_part2_pass1.vqd, 4, nonseq cull, 0 +- 1 2 + +:_p3_0 44u7/res_part3_pass2.vqd, 4, nonseq cull, 0 +- 1 +:_p4_0 44u7/res_part4_pass2.vqd, 4, nonseq cull, 0 +- 1 2 +:_p5_0 44u7/res_part5_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 +:_p6_0 44u7/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 +:_p7_0 44u7/res_part7_pass0.vqd, 2, nonseq cull, 0 +- 3 6 9 12 15 +:_p7_1 44u7/res_part7_pass1.vqd, 4, nonseq cull, 0 +- 1 + +:_p8_0 44u7/res_part8_pass0.vqd, 2, nonseq cull, 0 +- 7 14 21 28 35 42 49 56 +:_p8_1 44u7/res_part8_pass1.vqd, 2, nonseq cull, 0 +- 1 2 3 + + +:_p9_0 44u7/res_part9_pass0.vqd, 2, nonseq, 0 +- 1863 3726 5589 7452 9315 11178 13041 +:_p9_1 44u7/res_part9_pass1.vqd, 2, nonseq, 0 +- 81 162 243 324 405 486 567 648 729 810 891 +:_p9_2 44u7/res_part9_pass2.vqd, 1, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 + +#iter 1 + +:_p0_r0 44u7/res_part0_pass3.vqd, 2, nonseq cull, 0 +- .33333333 +:_p1_r0 44u7/res_partN_pass3.vqd, 2, nonseq cull, 0 +- .33333333 + +#iter 2 + +:_p0_r1 44u7/res_part0_pass4.vqd, 2, nonseq cull, 0 +- .11111111 +:_p1_r1 44u7/res_partN_pass4.vqd, 2, nonseq cull, 0 +- .11111111 |