diff options
author | Monty <xiphmont@xiph.org> | 2002-01-01 02:27:45 +0000 |
---|---|---|
committer | Monty <xiphmont@xiph.org> | 2002-01-01 02:27:45 +0000 |
commit | 95bc15947bb07b533e285615e02c7c887a6bbd95 (patch) | |
tree | 377fa122a8e999ed1041b7153880f8f9c2d7fd5c | |
parent | deca1363841784e4737b16f6138d2f379c6e3fb3 (diff) | |
download | libvorbis-git-monty_branch_rc4.tar.gz |
this commit is broken, but I want no chance of losing changes.monty_branch_rc4
Incremental to CVS
svn path=/branches/monty_branch_rc4/vorbis/; revision=2932
40 files changed, 10470 insertions, 65 deletions
diff --git a/examples/encoder_example.c b/examples/encoder_example.c new file mode 100644 index 00000000..67b54d56 --- /dev/null +++ b/examples/encoder_example.c @@ -0,0 +1,220 @@ +/******************************************************************** + * * + * 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.34.2.1 2002/01/01 02:27:20 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 */ + /* (quality mode .4: 44kHz stereo coupled, roughly 128kbps VBR) */ + vorbis_info_init(&vi); + + vorbis_encode_init_vbr(&vi,2,44100,.0); + //vorbis_encode_init(&vi,2,44100,84000,96000,-1); + + /* add a comment */ + vorbis_comment_init(&vc); + vorbis_comment_add_tag(&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/include/vorbis/vorbisenc.h b/include/vorbis/vorbisenc.h new file mode 100644 index 00000000..28a7dd7d --- /dev/null +++ b/include/vorbis/vorbisenc.h @@ -0,0 +1,143 @@ +/******************************************************************** + * * + * 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: vorbis encode-engine setup + last mod: $Id: vorbisenc.h,v 1.8.2.1 2002/01/01 02:27:21 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _OV_ENC_H_ +#define _OV_ENC_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +#include "codec.h" + +extern int vorbis_encode_init(vorbis_info *vi, + long channels, + long rate, + + long max_bitrate, + long nominal_bitrate, + long min_bitrate); + +extern int vorbis_encode_setup_managed(vorbis_info *vi, + long channels, + long rate, + + long max_bitrate, + long nominal_bitrate, + long min_bitrate); + +extern int vorbis_encode_setup_vbr(vorbis_info *vi, + long channels, + long rate, + + float /* quality level from 0. (lo) to 1. (hi) */ + ); + +extern int vorbis_encode_init_vbr(vorbis_info *vi, + long channels, + long rate, + + float base_quality /* quality level from 0. (lo) to 1. (hi) */ + ); + +extern int vorbis_encode_setup_init(vorbis_info *vi); + +extern int vorbis_encode_ctl(vorbis_info *vi,int number,int setp,void *arg); + + typedef struct { + int short_block_p; + int long_block_p; + int impulse_block_p; + } vectl_block_arg; + +#define VECTL_BLOCK 0x1 + + typedef struct { + double short_lowpass_kHz; + double long_lowpass_kHz; + } vectl_lowpass_arg; + +#define VECTL_PSY_LOWPASS 0x2 + + typedef struct { + int stereo_couple_p; + int stereo_point_dB_mode; + double stereo_point_kHz_short; + double stereo_point_kHz_long; + } vectl_stereo_arg; + +#define VECTL_PSY_STEREO 0x3 + + typedef struct { + double ath_float_dB; + double ath_fixed_dB; + } vectl_ath_arg; + +#define VECTL_PSY_ATH 0x4 + + typedef struct { + double maxdB_track_decay; + } vectl_amp_arg; + +#define VECTL_PSY_AMPTRACK 0x5 + + typedef struct { + double trigger_q; + double tonemask_q[4]; + double tonepeak_q[4]; + double noise_q[4]; + } vectl_mask_arg; + +#define VECTL_PSY_MASK_Q 0x6 + + typedef struct { + int noise_normalize_p; + double noise_normalize_weight; + double noise_normalize_thresh; + } vectl_noisenorm_arg; + +#define VECTL_PSY_NOISENORM 0x7 + +typedef struct { + double avg_min; + double avg_max; + double avg_window_time; + double avg_window_center; + double avg_slew_downmax; + double avg_slew_upmax; + int avg_noisetrack_p; + + double limit_min; + double limit_max; + double limit_window_time; + + int stereo_backfill_p; + int residue_backfill_p; + +} vectl_bitrate_arg; + +#define VECTL_BITRATE 0x100 + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif + + diff --git a/lib/backends.h b/lib/backends.h new file mode 100644 index 00000000..148db25a --- /dev/null +++ b/lib/backends.h @@ -0,0 +1,191 @@ +/******************************************************************** + * * + * 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: libvorbis backend and mapping structures; needed for + static mode headers + last mod: $Id: backends.h,v 1.12.2.1 2002/01/01 02:27:23 xiphmont Exp $ + + ********************************************************************/ + +/* this is exposed up here because we need it for static modes. + Lookups for each backend aren't exposed because there's no reason + to do so */ + +#ifndef _vorbis_backend_h_ +#define _vorbis_backend_h_ + +#include "codec_internal.h" + +/* this would all be simpler/shorter with templates, but.... */ +/* Transform backend generic *************************************/ + +/* only mdct right now. Flesh it out more if we ever transcend mdct + in the transform domain */ + +/* Time backend generic ******************************************/ +typedef struct{ + void (*pack) (vorbis_info_time *,oggpack_buffer *); + vorbis_info_time *(*unpack)(vorbis_info *,oggpack_buffer *); + vorbis_look_time *(*look) (vorbis_dsp_state *,vorbis_info_mode *, + vorbis_info_time *); + vorbis_info_time *(*copy_info)(vorbis_info_time *); + + void (*free_info) (vorbis_info_time *); + void (*free_look) (vorbis_look_time *); + int (*forward) (struct vorbis_block *,vorbis_look_time *, + float *,float *); + int (*inverse) (struct vorbis_block *,vorbis_look_time *, + float *,float *); +} vorbis_func_time; + +typedef struct{ + int dummy; +} vorbis_info_time0; + +/* Floor backend generic *****************************************/ +typedef struct{ + void (*pack) (vorbis_info_floor *,oggpack_buffer *); + vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *); + vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_mode *, + vorbis_info_floor *); + vorbis_info_floor *(*copy_info)(vorbis_info_floor *); + void (*free_info) (vorbis_info_floor *); + void (*free_look) (vorbis_look_floor *); + int (*forward) (struct vorbis_block *,vorbis_look_floor *, + float *, const float *, /* in */ + const float *, const float *, /* in */ + float *); /* out */ + void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *); + int (*inverse2) (struct vorbis_block *,vorbis_look_floor *, + void *buffer,float *); +} vorbis_func_floor; + +typedef struct{ + int order; + long rate; + long barkmap; + + int ampbits; + int ampdB; + + int numbooks; /* <= 16 */ + int books[16]; + + float lessthan; /* encode-only config setting hacks for libvorbis */ + float greaterthan; /* encode-only config setting hacks for libvorbis */ + +} vorbis_info_floor0; + +#define VIF_POSIT 63 +#define VIF_CLASS 16 +#define VIF_PARTS 31 +typedef struct{ + int partitions; /* 0 to 31 */ + int partitionclass[VIF_PARTS]; /* 0 to 15 */ + + int class_dim[VIF_CLASS]; /* 1 to 8 */ + int class_subs[VIF_CLASS]; /* 0,1,2,3 (bits: 1<<n poss) */ + int class_book[VIF_CLASS]; /* subs ^ dim entries */ + int class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */ + + + int mult; /* 1 2 3 or 4 */ + int postlist[VIF_POSIT+2]; /* first two implicit */ + + + /* encode side analysis parameters */ + float maxover; + float maxunder; + float maxerr; + + int twofitminsize; + int twofitminused; + int twofitweight; + float twofitatten; + int unusedminsize; + int unusedmin_n; + + int n; + +} vorbis_info_floor1; + +/* Residue backend generic *****************************************/ +typedef struct{ + void (*pack) (vorbis_info_residue *,oggpack_buffer *); + vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *); + vorbis_look_residue *(*look) (vorbis_dsp_state *,vorbis_info_mode *, + vorbis_info_residue *); + vorbis_info_residue *(*copy_info)(vorbis_info_residue *); + void (*free_info) (vorbis_info_residue *); + void (*free_look) (vorbis_look_residue *); + long **(*class) (struct vorbis_block *,vorbis_look_residue *, + float **,float **,int *,int); + int (*forward) (struct vorbis_block *,vorbis_look_residue *, + float **,float **,int *,int,int,long **,ogg_uint32_t *); + int (*inverse) (struct vorbis_block *,vorbis_look_residue *, + float **,int *,int); +} vorbis_func_residue; + +typedef struct vorbis_info_residue0{ +/* block-partitioned VQ coded straight residue */ + long begin; + long end; + + /* first stage (lossless partitioning) */ + int grouping; /* group n vectors per partition */ + int partitions; /* possible codebooks for a partition */ + int groupbook; /* huffbook for partitioning */ + int secondstages[64]; /* expanded out to pointers in lookup */ + int booklist[256]; /* list of second stage books */ + + /* encode-only heuristic settings */ + float ampmax[64]; /* book amp threshholds*/ + int subgrp[64]; /* book heuristic subgroup size */ + int blimit[64]; /* subgroup position limits */ +} vorbis_info_residue0; + +/* Mapping backend generic *****************************************/ +typedef struct{ + void (*pack) (vorbis_info *,vorbis_info_mapping *, + oggpack_buffer *); + vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *); + vorbis_look_mapping *(*look) (vorbis_dsp_state *,vorbis_info_mode *, + vorbis_info_mapping *); + vorbis_info_mapping *(*copy_info)(vorbis_info_mapping *); + void (*free_info) (vorbis_info_mapping *); + void (*free_look) (vorbis_look_mapping *); + int (*forward) (struct vorbis_block *vb,vorbis_look_mapping *); + int (*inverse) (struct vorbis_block *vb,vorbis_look_mapping *); +} vorbis_func_mapping; + +typedef struct vorbis_info_mapping0{ + int submaps; /* <= 16 */ + int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */ + + int timesubmap[16]; /* [mux] */ + int floorsubmap[16]; /* [mux] submap to floors */ + int residuesubmap[16]; /* [mux] submap to residue */ + + int psy[2]; /* by blocktype; impulse/padding for short, + transition/normal for long */ + + int coupling_steps; + int coupling_mag[256]; + int coupling_ang[256]; +} vorbis_info_mapping0; + +#endif + + + + + diff --git a/lib/block.c b/lib/block.c new file mode 100644 index 00000000..68ec4f35 --- /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.55.2.1 2002/01/01 02:27:23 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 */ +#include<stdio.h> +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; + + }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; + fprintf(stderr,"-"); + }else{ + vbi->blocktype=BLOCKTYPE_LONG; + fprintf(stderr,"_"); + } + }else{ + if(_ve_envelope_mark(v)){ + vbi->blocktype=BLOCKTYPE_IMPULSE; + fprintf(stderr,"|"); + }else{ + vbi->blocktype=BLOCKTYPE_PADDING; + fprintf(stderr,"."); + } + } + + 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 */ + + /* 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; + + 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((int)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_long.vqh b/lib/books/coupled/_44c0_long.vqh new file mode 100644 index 00000000..9360dc64 --- /dev/null +++ b/lib/books/coupled/_44c0_long.vqh @@ -0,0 +1,40 @@ +/******************************************************************** + * * + * 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 huff/huffbuld + + ********************************************************************/ + +#ifndef _V__44c0_long_VQH_ +#define _V__44c0_long_VQH_ +#include "codebook.h" + +static long _huff_lengthlist__44c0_long[] = { + 4, 9,10,11,13, 6, 9,15, 8, 3, 6, 7, 9, 5, 9,13, + 8, 5, 6, 7, 8, 8,11,15, 9, 6, 6, 6, 8,12,12,15, + 10, 7, 7, 7, 5,16,16,10, 6,16,16,16,16, 1, 7,13, + 10,16,16,16,16, 7, 9,13,14,12,12,11, 6,13,14,11, +}; + +static static_codebook _huff_book__44c0_long = { + 2, 64, + _huff_lengthlist__44c0_long, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s0_p1_0.vqh b/lib/books/coupled/_44c0_s0_p1_0.vqh new file mode 100644 index 00000000..c71ae736 --- /dev/null +++ b/lib/books/coupled/_44c0_s0_p1_0.vqh @@ -0,0 +1,99 @@ +/******************************************************************** + * * + * 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_s0_p1_0_VQH_ +#define _V__44c0_s0_p1_0_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s0_p1_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c0_s0_p1_0[] = { + 1, 6, 6, 0, 0, 0, 5, 5, 0, 0, 0, 5, 5, 0, 0, 0, + 8, 8, 0, 0, 0, 0, 0, 0, 0, 6, 9, 8, 0, 0, 0, 9, + 8, 0, 0, 0, 9, 8, 0, 0, 0,12,11, 0, 0, 0, 0, 0, + 0, 0, 6, 8, 9, 0, 0, 0, 8, 9, 0, 0, 0, 8, 9, 0, + 0, 0,11,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 5, 9, 8, 0, 0, 0, 8, 7, 0, 0, + 0, 7, 8, 0, 0, 0,11, 9, 0, 0, 0, 0, 0, 0, 0, 5, + 8, 9, 0, 0, 0, 7, 8, 0, 0, 0, 8, 7, 0, 0, 0,10, + 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c0_s0_p1_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c0_s0_p1_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s0_p1_0 = { + _vq_quantthresh__44c0_s0_p1_0, + _vq_quantmap__44c0_s0_p1_0, + 5, + 5 +}; + +static static_codebook _44c0_s0_p1_0 = { + 4, 625, + _vq_lengthlist__44c0_s0_p1_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c0_s0_p1_0, + NULL, + &_vq_auxt__44c0_s0_p1_0, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s0_p2_0.vqh b/lib/books/coupled/_44c0_s0_p2_0.vqh new file mode 100644 index 00000000..213d5c1e --- /dev/null +++ b/lib/books/coupled/_44c0_s0_p2_0.vqh @@ -0,0 +1,70 @@ +/******************************************************************** + * * + * 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_s0_p2_0_VQH_ +#define _V__44c0_s0_p2_0_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s0_p2_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c0_s0_p2_0[] = { + 1, 4, 4, 7, 7, 0, 0, 0, 0, 0, 4, 4, 6, 7, 0, 0, + 0, 0, 0, 4, 4, 7, 7, 0, 0, 0, 0, 0, 6, 6, 7, 7, + 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, + 9, 9, 0, 0, 0, 0, 0, 0, 0,10, 9, 0, 0, 0, 0, 0, + 0, 0,11,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c0_s0_p2_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c0_s0_p2_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s0_p2_0 = { + _vq_quantthresh__44c0_s0_p2_0, + _vq_quantmap__44c0_s0_p2_0, + 9, + 9 +}; + +static static_codebook _44c0_s0_p2_0 = { + 2, 81, + _vq_lengthlist__44c0_s0_p2_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c0_s0_p2_0, + NULL, + &_vq_auxt__44c0_s0_p2_0, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s0_p3_0.vqh b/lib/books/coupled/_44c0_s0_p3_0.vqh new file mode 100644 index 00000000..e1177028 --- /dev/null +++ b/lib/books/coupled/_44c0_s0_p3_0.vqh @@ -0,0 +1,93 @@ +/******************************************************************** + * * + * 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_s0_p3_0_VQH_ +#define _V__44c0_s0_p3_0_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s0_p3_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c0_s0_p3_0[] = { + 1, 4, 4, 7, 7, 7, 7, 9, 9, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 5, 7, 7, 8, 7, 9, 9, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 4, 4, 7, 7, 8, 8, 9, 9, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 7, 8, 8, 8, 8, 9, 9, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 7, 7, 8, 8,10,10, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9,10,10, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9,10,10, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10,10,10,10,11,11, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10,10,11, + 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11,11, + 11,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11, + 11,12,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 12,11,12,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,12,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,12,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,13,13, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c0_s0_p3_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c0_s0_p3_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s0_p3_0 = { + _vq_quantthresh__44c0_s0_p3_0, + _vq_quantmap__44c0_s0_p3_0, + 17, + 17 +}; + +static static_codebook _44c0_s0_p3_0 = { + 2, 289, + _vq_lengthlist__44c0_s0_p3_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c0_s0_p3_0, + NULL, + &_vq_auxt__44c0_s0_p3_0, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s0_p4_0.vqh b/lib/books/coupled/_44c0_s0_p4_0.vqh new file mode 100644 index 00000000..75430af1 --- /dev/null +++ b/lib/books/coupled/_44c0_s0_p4_0.vqh @@ -0,0 +1,99 @@ +/******************************************************************** + * * + * 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_s0_p4_0_VQH_ +#define _V__44c0_s0_p4_0_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s0_p4_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c0_s0_p4_0[] = { + 1, 4, 4, 0, 0, 6, 6, 7, 0, 0, 6, 7, 6, 0, 0, 0, + 8,12, 0, 0, 0,13, 7, 0, 0, 4, 7, 6, 0, 0,10,10, + 9, 0, 0,10,10,10, 0, 0, 0, 0,12, 0, 0, 0,12,12, + 0, 0, 4, 7, 6, 0, 0,10, 9,10, 0, 0,11,10,10, 0, + 0, 0,13,14, 0, 0, 0,13,12, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,10,10, + 0, 0,10,13,11, 0, 0,10,11,11, 0, 0, 0,12, 0, 0, + 0, 0, 0,12, 0, 0, 7,10,10, 0, 0,13,11,11, 0, 0, + 11,10,11, 0, 0, 0,14, 0, 0, 0, 0,13,13, 0, 0, 7, + 10,10, 0, 0,12,12,11, 0, 0,11,10,11, 0, 0, 0,12, + 0, 0, 0, 0,12,12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6,10,10, 0, 0,10, + 11,11, 0, 0,10, 0,11, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 7,11,10, 0, 0,11,10,11, 0, 0,13,12,12, + 0, 0, 0,14,14, 0, 0, 0, 0, 0, 0, 0, 7,12,11, 0, + 0,10,10,11, 0, 0,11,12,12, 0, 0, 0,12,14, 0, 0, + 0,13,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 12,12,13, 0, 0,14,13,12, 0, 0, 0, 0,11, 0, 0, 0, + 0, 0, 0, 0, 0,14, 0, 0, 0,11,14,12, 0, 0,14,14, + 13, 0, 0, 0,12,14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,13,13, + 0, 0,14, 0,13, 0, 0,13,13, 0, 0, 0, 0,12,14, 0, + 0, 0, 0, 0, 0, 0,12,13, 0, 0, 0, 0,13,14, 0, 0, + 14,13,13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c0_s0_p4_0[] = { + -31.5, -10.5, 10.5, 31.5, +}; + +static long _vq_quantmap__44c0_s0_p4_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s0_p4_0 = { + _vq_quantthresh__44c0_s0_p4_0, + _vq_quantmap__44c0_s0_p4_0, + 5, + 5 +}; + +static static_codebook _44c0_s0_p4_0 = { + 4, 625, + _vq_lengthlist__44c0_s0_p4_0, + 1, -525008896, 1620377600, 3, 0, + _vq_quantlist__44c0_s0_p4_0, + NULL, + &_vq_auxt__44c0_s0_p4_0, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s0_p4_1.vqh b/lib/books/coupled/_44c0_s0_p4_1.vqh new file mode 100644 index 00000000..fce23bab --- /dev/null +++ b/lib/books/coupled/_44c0_s0_p4_1.vqh @@ -0,0 +1,107 @@ +/******************************************************************** + * * + * 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_s0_p4_1_VQH_ +#define _V__44c0_s0_p4_1_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s0_p4_1[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__44c0_s0_p4_1[] = { + 2, 4, 4, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9,10, + 10,10,10,10,10,13, 5, 5, 6, 6, 8, 8, 8, 8, 9, 9, + 9, 9,10,10,10,10,10,10,10,10,12, 5, 5, 6, 6, 8, + 7, 8, 8, 9, 8, 9, 9,10,10,10,10,10,10,10,10,14, + 7, 7, 7, 7, 8, 8, 9, 9, 9, 9,10,10,10,10,10,10, + 11,11,11,10,13,12,13, 7, 7, 8, 8, 9, 9, 9, 9,10, + 10,10,10,10,11,11,11,10,11,13,13,13, 8, 8, 8, 8, + 9, 9, 9, 9,10,10,10,10,11,10,11,11,11,11,14,13, + 13, 8, 8, 8, 9, 9, 9, 9,10,10,10,10,11,11,11,11, + 11,11,11,13,13,13, 9, 8, 9, 9, 9, 9,10,10,10,10, + 11,11,11,11,11,11,11,11,14,13,15,14,14, 9, 9,10, + 9,10,10,10,10,11,11,11,11,11,11,11,11,14,14,13, + 14,13, 9, 9,10,10,10,10,10,11,11,11,11,11,11,11, + 11,11,14,13,14,13,14, 9, 9,10,10,10,10,10,11,11, + 11,11,11,11,11,11,11,13,13,13,14,14,10,10,10,10, + 10,10,11,11,11,11,11,11,11,11,11,11,14,14,14,14, + 13,14,15,10,10,10,10,11,11,11,11,11,11,11,11,11, + 11,13,13,14,14,14,14,14,10,10,11,11,11,11,11,11, + 11,12,11,11,11,11,15,14,14,14,15,15,14,10, 9,10, + 10,11,11,11,11,11,11,11,11,11,11,14,13,14,14,14, + 13,14,10,11,11,11,11,11,11,11,11,11,12,11,12,11, + 14,14,14,14,15,14,15,14,14,11,10,11,11,11,11,11, + 11,11,11,11,11,14,14,15,14,15,14,14,14,14,11,11, + 12,11,11,11,11,11,11,12,12,12,14,14,14,14,14,14, + 14,15,14,11,11,11,11,11,11,11,11,11,12,11,11,15, + 15,14,15,15,14,15,14,14,11,12,11,11,11,11,11,11, + 11,11,12,11,14,14,14,14,15,14,14,14,14,14,14,11, + 11,11,11,11,11,11,11,12,11, +}; + +static float _vq_quantthresh__44c0_s0_p4_1[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__44c0_s0_p4_1[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s0_p4_1 = { + _vq_quantthresh__44c0_s0_p4_1, + _vq_quantmap__44c0_s0_p4_1, + 21, + 21 +}; + +static static_codebook _44c0_s0_p4_1 = { + 2, 441, + _vq_lengthlist__44c0_s0_p4_1, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__44c0_s0_p4_1, + NULL, + &_vq_auxt__44c0_s0_p4_1, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s0_p5_0.vqh b/lib/books/coupled/_44c0_s0_p5_0.vqh new file mode 100644 index 00000000..77a562d6 --- /dev/null +++ b/lib/books/coupled/_44c0_s0_p5_0.vqh @@ -0,0 +1,99 @@ +/******************************************************************** + * * + * 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_s0_p5_0_VQH_ +#define _V__44c0_s0_p5_0_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s0_p5_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c0_s0_p5_0[] = { + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10, 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, 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, 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, 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, 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, +}; + +static float _vq_quantthresh__44c0_s0_p5_0[] = { + -1.5, -0.5, 0.5, 1.5, +}; + +static long _vq_quantmap__44c0_s0_p5_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s0_p5_0 = { + _vq_quantthresh__44c0_s0_p5_0, + _vq_quantmap__44c0_s0_p5_0, + 5, + 5 +}; + +static static_codebook _44c0_s0_p5_0 = { + 4, 625, + _vq_lengthlist__44c0_s0_p5_0, + 1, -533725184, 1611661312, 3, 0, + _vq_quantlist__44c0_s0_p5_0, + NULL, + &_vq_auxt__44c0_s0_p5_0, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s0_p6_0.vqh b/lib/books/coupled/_44c0_s0_p6_0.vqh new file mode 100644 index 00000000..97486b4f --- /dev/null +++ b/lib/books/coupled/_44c0_s0_p6_0.vqh @@ -0,0 +1,93 @@ +/******************************************************************** + * * + * 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_s0_p6_0_VQH_ +#define _V__44c0_s0_p6_0_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s0_p6_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c0_s0_p6_0[] = { + 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, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, +}; + +static float _vq_quantthresh__44c0_s0_p6_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c0_s0_p6_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s0_p6_0 = { + _vq_quantthresh__44c0_s0_p6_0, + _vq_quantmap__44c0_s0_p6_0, + 17, + 17 +}; + +static static_codebook _44c0_s0_p6_0 = { + 2, 289, + _vq_lengthlist__44c0_s0_p6_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c0_s0_p6_0, + NULL, + &_vq_auxt__44c0_s0_p6_0, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s0_p7_0.vqh b/lib/books/coupled/_44c0_s0_p7_0.vqh new file mode 100644 index 00000000..92c025ac --- /dev/null +++ b/lib/books/coupled/_44c0_s0_p7_0.vqh @@ -0,0 +1,99 @@ +/******************************************************************** + * * + * 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_s0_p7_0_VQH_ +#define _V__44c0_s0_p7_0_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s0_p7_0[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c0_s0_p7_0[] = { + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10, 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, 9, 9, 9, 9, 9, 9, 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_s0_p7_0[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s0_p7_0 = { + _vq_quantthresh__44c0_s0_p7_0, + _vq_quantmap__44c0_s0_p7_0, + 5, + 5 +}; + +static static_codebook _44c0_s0_p7_0 = { + 4, 625, + _vq_lengthlist__44c0_s0_p7_0, + 1, -520470528, 1624915968, 3, 0, + _vq_quantlist__44c0_s0_p7_0, + NULL, + &_vq_auxt__44c0_s0_p7_0, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s0_p7_1.vqh b/lib/books/coupled/_44c0_s0_p7_1.vqh new file mode 100644 index 00000000..f3ccf826 --- /dev/null +++ b/lib/books/coupled/_44c0_s0_p7_1.vqh @@ -0,0 +1,99 @@ +/******************************************************************** + * * + * 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_s0_p7_1_VQH_ +#define _V__44c0_s0_p7_1_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s0_p7_1[] = { + 2, + 1, + 3, + 0, + 4, +}; + +static long _vq_lengthlist__44c0_s0_p7_1[] = { + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10, 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, 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, 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, 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, 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, +}; + +static float _vq_quantthresh__44c0_s0_p7_1[] = { + -31.5, -10.5, 10.5, 31.5, +}; + +static long _vq_quantmap__44c0_s0_p7_1[] = { + 3, 1, 0, 2, 4, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s0_p7_1 = { + _vq_quantthresh__44c0_s0_p7_1, + _vq_quantmap__44c0_s0_p7_1, + 5, + 5 +}; + +static static_codebook _44c0_s0_p7_1 = { + 4, 625, + _vq_lengthlist__44c0_s0_p7_1, + 1, -525008896, 1620377600, 3, 0, + _vq_quantlist__44c0_s0_p7_1, + NULL, + &_vq_auxt__44c0_s0_p7_1, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s0_p7_2.vqh b/lib/books/coupled/_44c0_s0_p7_2.vqh new file mode 100644 index 00000000..73df5134 --- /dev/null +++ b/lib/books/coupled/_44c0_s0_p7_2.vqh @@ -0,0 +1,107 @@ +/******************************************************************** + * * + * 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_s0_p7_2_VQH_ +#define _V__44c0_s0_p7_2_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s0_p7_2[] = { + 10, + 9, + 11, + 8, + 12, + 7, + 13, + 6, + 14, + 5, + 15, + 4, + 16, + 3, + 17, + 2, + 18, + 1, + 19, + 0, + 20, +}; + +static long _vq_lengthlist__44c0_s0_p7_2[] = { + 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, 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, 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, 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, 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, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, +}; + +static float _vq_quantthresh__44c0_s0_p7_2[] = { + -9.5, -8.5, -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, + -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, + 6.5, 7.5, 8.5, 9.5, +}; + +static long _vq_quantmap__44c0_s0_p7_2[] = { + 19, 17, 15, 13, 11, 9, 7, 5, + 3, 1, 0, 2, 4, 6, 8, 10, + 12, 14, 16, 18, 20, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s0_p7_2 = { + _vq_quantthresh__44c0_s0_p7_2, + _vq_quantmap__44c0_s0_p7_2, + 21, + 21 +}; + +static static_codebook _44c0_s0_p7_2 = { + 2, 441, + _vq_lengthlist__44c0_s0_p7_2, + 1, -529268736, 1611661312, 5, 0, + _vq_quantlist__44c0_s0_p7_2, + NULL, + &_vq_auxt__44c0_s0_p7_2, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s1_p5_0.vqh b/lib/books/coupled/_44c0_s1_p5_0.vqh new file mode 100644 index 00000000..84860250 --- /dev/null +++ b/lib/books/coupled/_44c0_s1_p5_0.vqh @@ -0,0 +1,468 @@ +/******************************************************************** + * * + * 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_p5_0_VQH_ +#define _V__44c0_s1_p5_0_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s1_p5_0[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c0_s1_p5_0[] = { + 1, 4, 4, 0, 0, 0, 0, 0, 0, 5, 7, 7, 0, 0, 0, 0, + 0, 0, 5, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0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+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c0_s1_p5_0[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44c0_s1_p5_0[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s1_p5_0 = { + _vq_quantthresh__44c0_s1_p5_0, + _vq_quantmap__44c0_s1_p5_0, + 3, + 3 +}; + +static static_codebook _44c0_s1_p5_0 = { + 8, 6561, + _vq_lengthlist__44c0_s1_p5_0, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44c0_s1_p5_0, + NULL, + &_vq_auxt__44c0_s1_p5_0, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s1_p6_0.vqh b/lib/books/coupled/_44c0_s1_p6_0.vqh new file mode 100644 index 00000000..14b3bca9 --- /dev/null +++ b/lib/books/coupled/_44c0_s1_p6_0.vqh @@ -0,0 +1,93 @@ +/******************************************************************** + * * + * 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_p6_0_VQH_ +#define _V__44c0_s1_p6_0_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s1_p6_0[] = { + 8, + 7, + 9, + 6, + 10, + 5, + 11, + 4, + 12, + 3, + 13, + 2, + 14, + 1, + 15, + 0, + 16, +}; + +static long _vq_lengthlist__44c0_s1_p6_0[] = { + 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, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, +}; + +static float _vq_quantthresh__44c0_s1_p6_0[] = { + -7.5, -6.5, -5.5, -4.5, -3.5, -2.5, -1.5, -0.5, + 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, +}; + +static long _vq_quantmap__44c0_s1_p6_0[] = { + 15, 13, 11, 9, 7, 5, 3, 1, + 0, 2, 4, 6, 8, 10, 12, 14, + 16, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s1_p6_0 = { + _vq_quantthresh__44c0_s1_p6_0, + _vq_quantmap__44c0_s1_p6_0, + 17, + 17 +}; + +static static_codebook _44c0_s1_p6_0 = { + 2, 289, + _vq_lengthlist__44c0_s1_p6_0, + 1, -529530880, 1611661312, 5, 0, + _vq_quantlist__44c0_s1_p6_0, + NULL, + &_vq_auxt__44c0_s1_p6_0, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s1_p7_0.vqh b/lib/books/coupled/_44c0_s1_p7_0.vqh new file mode 100644 index 00000000..c49be5ca --- /dev/null +++ b/lib/books/coupled/_44c0_s1_p7_0.vqh @@ -0,0 +1,65 @@ +/******************************************************************** + * * + * 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_p7_0_VQH_ +#define _V__44c0_s1_p7_0_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s1_p7_0[] = { + 3, + 2, + 4, + 1, + 5, + 0, + 6, +}; + +static long _vq_lengthlist__44c0_s1_p7_0[] = { + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, +}; + +static float _vq_quantthresh__44c0_s1_p7_0[] = { + -167.5, -100.5, -33.5, 33.5, 100.5, 167.5, +}; + +static long _vq_quantmap__44c0_s1_p7_0[] = { + 5, 3, 1, 0, 2, 4, 6, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s1_p7_0 = { + _vq_quantthresh__44c0_s1_p7_0, + _vq_quantmap__44c0_s1_p7_0, + 7, + 7 +}; + +static static_codebook _44c0_s1_p7_0 = { + 2, 49, + _vq_lengthlist__44c0_s1_p7_0, + 1, -520544256, 1624293376, 3, 0, + _vq_quantlist__44c0_s1_p7_0, + NULL, + &_vq_auxt__44c0_s1_p7_0, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s1_p7_1.vqh b/lib/books/coupled/_44c0_s1_p7_1.vqh new file mode 100644 index 00000000..7f8ca52c --- /dev/null +++ b/lib/books/coupled/_44c0_s1_p7_1.vqh @@ -0,0 +1,115 @@ +/******************************************************************** + * * + * 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_p7_1_VQH_ +#define _V__44c0_s1_p7_1_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s1_p7_1[] = { + 11, + 10, + 12, + 9, + 13, + 8, + 14, + 7, + 15, + 6, + 16, + 5, + 17, + 4, + 18, + 3, + 19, + 2, + 20, + 1, + 21, + 0, + 22, +}; + +static long _vq_lengthlist__44c0_s1_p7_1[] = { + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10, 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, 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, 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, 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, 2, 4, 6, 8, + 10, 12, 14, 16, 18, 20, 22, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s1_p7_1 = { + _vq_quantthresh__44c0_s1_p7_1, + _vq_quantmap__44c0_s1_p7_1, + 23, + 23 +}; + +static static_codebook _44c0_s1_p7_1 = { + 2, 529, + _vq_lengthlist__44c0_s1_p7_1, + 1, -525303808, 1614282752, 5, 0, + _vq_quantlist__44c0_s1_p7_1, + NULL, + &_vq_auxt__44c0_s1_p7_1, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s1_p7_2.vqh b/lib/books/coupled/_44c0_s1_p7_2.vqh new file mode 100644 index 00000000..02e8b7f6 --- /dev/null +++ b/lib/books/coupled/_44c0_s1_p7_2.vqh @@ -0,0 +1,63 @@ +/******************************************************************** + * * + * 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_p7_2_VQH_ +#define _V__44c0_s1_p7_2_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s1_p7_2[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c0_s1_p7_2[] = { + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, +}; + +static float _vq_quantthresh__44c0_s1_p7_2[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44c0_s1_p7_2[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s1_p7_2 = { + _vq_quantthresh__44c0_s1_p7_2, + _vq_quantmap__44c0_s1_p7_2, + 3, + 3 +}; + +static static_codebook _44c0_s1_p7_2 = { + 4, 81, + _vq_lengthlist__44c0_s1_p7_2, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44c0_s1_p7_2, + NULL, + &_vq_auxt__44c0_s1_p7_2, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s2_p6_0.vqh b/lib/books/coupled/_44c0_s2_p6_0.vqh new file mode 100644 index 00000000..1cf9c95b --- /dev/null +++ b/lib/books/coupled/_44c0_s2_p6_0.vqh @@ -0,0 +1,70 @@ +/******************************************************************** + * * + * 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_s2_p6_0_VQH_ +#define _V__44c0_s2_p6_0_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s2_p6_0[] = { + 4, + 3, + 5, + 2, + 6, + 1, + 7, + 0, + 8, +}; + +static long _vq_lengthlist__44c0_s2_p6_0[] = { + 1, 3, 2, 4, 5, 7, 6, 8, 8, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, +}; + +static float _vq_quantthresh__44c0_s2_p6_0[] = { + -3.5, -2.5, -1.5, -0.5, 0.5, 1.5, 2.5, 3.5, +}; + +static long _vq_quantmap__44c0_s2_p6_0[] = { + 7, 5, 3, 1, 0, 2, 4, 6, + 8, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s2_p6_0 = { + _vq_quantthresh__44c0_s2_p6_0, + _vq_quantmap__44c0_s2_p6_0, + 9, + 9 +}; + +static static_codebook _44c0_s2_p6_0 = { + 2, 81, + _vq_lengthlist__44c0_s2_p6_0, + 1, -531628032, 1611661312, 4, 0, + _vq_quantlist__44c0_s2_p6_0, + NULL, + &_vq_auxt__44c0_s2_p6_0, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s2_p7_0.vqh b/lib/books/coupled/_44c0_s2_p7_0.vqh new file mode 100644 index 00000000..669069bb --- /dev/null +++ b/lib/books/coupled/_44c0_s2_p7_0.vqh @@ -0,0 +1,65 @@ +/******************************************************************** + * * + * 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_s2_p7_0_VQH_ +#define _V__44c0_s2_p7_0_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s2_p7_0[] = { + 3, + 2, + 4, + 1, + 5, + 0, + 6, +}; + +static long _vq_lengthlist__44c0_s2_p7_0[] = { + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, +}; + +static float _vq_quantthresh__44c0_s2_p7_0[] = { + -167.5, -100.5, -33.5, 33.5, 100.5, 167.5, +}; + +static long _vq_quantmap__44c0_s2_p7_0[] = { + 5, 3, 1, 0, 2, 4, 6, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s2_p7_0 = { + _vq_quantthresh__44c0_s2_p7_0, + _vq_quantmap__44c0_s2_p7_0, + 7, + 7 +}; + +static static_codebook _44c0_s2_p7_0 = { + 2, 49, + _vq_lengthlist__44c0_s2_p7_0, + 1, -520544256, 1624293376, 3, 0, + _vq_quantlist__44c0_s2_p7_0, + NULL, + &_vq_auxt__44c0_s2_p7_0, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s2_p7_1.vqh b/lib/books/coupled/_44c0_s2_p7_1.vqh new file mode 100644 index 00000000..0387ea9f --- /dev/null +++ b/lib/books/coupled/_44c0_s2_p7_1.vqh @@ -0,0 +1,115 @@ +/******************************************************************** + * * + * 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_s2_p7_1_VQH_ +#define _V__44c0_s2_p7_1_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s2_p7_1[] = { + 11, + 10, + 12, + 9, + 13, + 8, + 14, + 7, + 15, + 6, + 16, + 5, + 17, + 4, + 18, + 3, + 19, + 2, + 20, + 1, + 21, + 0, + 22, +}; + +static long _vq_lengthlist__44c0_s2_p7_1[] = { + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, + 10,10, 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, 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, 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,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0, 2, 4, 6, 8, + 10, 12, 14, 16, 18, 20, 22, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s2_p7_1 = { + _vq_quantthresh__44c0_s2_p7_1, + _vq_quantmap__44c0_s2_p7_1, + 23, + 23 +}; + +static static_codebook _44c0_s2_p7_1 = { + 2, 529, + _vq_lengthlist__44c0_s2_p7_1, + 1, -525303808, 1614282752, 5, 0, + _vq_quantlist__44c0_s2_p7_1, + NULL, + &_vq_auxt__44c0_s2_p7_1, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s2_p7_2.vqh b/lib/books/coupled/_44c0_s2_p7_2.vqh new file mode 100644 index 00000000..373aff45 --- /dev/null +++ b/lib/books/coupled/_44c0_s2_p7_2.vqh @@ -0,0 +1,63 @@ +/******************************************************************** + * * + * 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_s2_p7_2_VQH_ +#define _V__44c0_s2_p7_2_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s2_p7_2[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c0_s2_p7_2[] = { + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, +}; + +static float _vq_quantthresh__44c0_s2_p7_2[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44c0_s2_p7_2[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s2_p7_2 = { + _vq_quantthresh__44c0_s2_p7_2, + _vq_quantmap__44c0_s2_p7_2, + 3, + 3 +}; + +static static_codebook _44c0_s2_p7_2 = { + 4, 81, + _vq_lengthlist__44c0_s2_p7_2, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44c0_s2_p7_2, + NULL, + &_vq_auxt__44c0_s2_p7_2, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s3_p7_0.vqh b/lib/books/coupled/_44c0_s3_p7_0.vqh new file mode 100644 index 00000000..e2d74e4c --- /dev/null +++ b/lib/books/coupled/_44c0_s3_p7_0.vqh @@ -0,0 +1,65 @@ +/******************************************************************** + * * + * 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_s3_p7_0_VQH_ +#define _V__44c0_s3_p7_0_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s3_p7_0[] = { + 3, + 2, + 4, + 1, + 5, + 0, + 6, +}; + +static long _vq_lengthlist__44c0_s3_p7_0[] = { + 1, 3, 3,10,10,12,12, 6, 4, 6,11,10,12,12, 6, 6, + 4,10,10,12,12,12, 6,12,12,11,12,12,12,11, 5,12, + 9,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, + 11, +}; + +static float _vq_quantthresh__44c0_s3_p7_0[] = { + -167.5, -100.5, -33.5, 33.5, 100.5, 167.5, +}; + +static long _vq_quantmap__44c0_s3_p7_0[] = { + 5, 3, 1, 0, 2, 4, 6, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s3_p7_0 = { + _vq_quantthresh__44c0_s3_p7_0, + _vq_quantmap__44c0_s3_p7_0, + 7, + 7 +}; + +static static_codebook _44c0_s3_p7_0 = { + 2, 49, + _vq_lengthlist__44c0_s3_p7_0, + 1, -520544256, 1624293376, 3, 0, + _vq_quantlist__44c0_s3_p7_0, + NULL, + &_vq_auxt__44c0_s3_p7_0, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s3_p7_1.vqh b/lib/books/coupled/_44c0_s3_p7_1.vqh new file mode 100644 index 00000000..7fe3f20e --- /dev/null +++ b/lib/books/coupled/_44c0_s3_p7_1.vqh @@ -0,0 +1,115 @@ +/******************************************************************** + * * + * 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_s3_p7_1_VQH_ +#define _V__44c0_s3_p7_1_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s3_p7_1[] = { + 11, + 10, + 12, + 9, + 13, + 8, + 14, + 7, + 15, + 6, + 16, + 5, + 17, + 4, + 18, + 3, + 19, + 2, + 20, + 1, + 21, + 0, + 22, +}; + +static long _vq_lengthlist__44c0_s3_p7_1[] = { + 1, 4, 4, 6, 6, 8, 7, 8, 8, 9, 9,10,10,10,10,11, + 10,10,10,10,10,11,11, 6, 6, 6, 7, 8, 9, 9, 9, 9, + 10,10,11,11,11,11,12,11,10,11,10,11,12,11,14, 6, + 6, 8, 7, 8, 9, 9, 9,10,10,11,11,10,11,11,11,10, + 10,10,10,11,11,15, 7, 8, 8, 8, 9, 9,10,10,11,11, + 12,12,11,12,12,12,11,11,11,11,12,12,15, 8, 7, 8, + 7, 9, 9,10,10,11,11,11,11,12,11,11,12,11,11,11, + 11,12,12,14,10,10, 8, 8,10,10,10,11,11,12,11,12, + 12,12,12,15,12,13,11,11,12,12,15,15,16, 8, 8,10, + 10,11,11,11,11,11,12,11,12,11,12,11,12,11,12,12, + 12,15,15,15, 9, 9, 9,10,11,11,11,11,12,12,12,12, + 13,14,13,12,12,12,12,13,15,15,16, 9, 9, 9, 9,11, + 11,12,12,11,12,11,13,12,13,12,13,12,12,13,13,15, + 13,14,12,12,10,10,11,11,12,11,13,12,13,12,13,12, + 13,13,12,13,14,13,14,14,14,16,15,10,10,11,11,12, + 12,12,12,11,12,12,13,14,13,13,12,13,13,16,15,15, + 14,15,11,11,12,11,12,11,13,13,13,12,12,13,13,13, + 13,12,13,13,15,14,16,15,16,11,11,11,11,11,11,11, + 13,12,13,12,13,13,13,13,12,14,13,16,16,16,16,14, + 13,13,12,11,12,12,13,12,13,12,14,13,12,12,13,13, + 14,12,14,16,15,15,14,14,15,10,10,12,12,12,13,11, + 13,12,13,13,13,13,14,13,14,14,14,14,14,13,14,13, + 11,12,13,12,13,12,14,12,13,13,14,13,13,14,14,13, + 14,14,15,14,15,14,14,11,12,13,13,11,13,11,13,14, + 13,12,12,13,13,14,13,14,14,16,13,13,13,14,13,14, + 13,12,13,12,13,13,14,13,13,13,13,12,14,14,14,14, + 14,16,16,14,13,14,14,13,13,12,13,13,13,13,13,14, + 13,14,13,14,13,14,15,15,13,13,12,14,14,14,13,12, + 14,13,13,13,14,13,13,13,14,15,14,13,14,14,14,14, + 14,13,14,13,13,13,13,13,14,13,13,13,14,13,14,13, + 14,14,13,14,14,14,14,13,12,13,14,13,15,13,14,13, + 15,13,14,13,14,14,14,14,15,14,14,14,14,14,14,13, + 14,13,13,13,13,13,15,14,14,14,14,14,14,13,14,14, + 14, +}; + +static float _vq_quantthresh__44c0_s3_p7_1[] = { + -31.5, -28.5, -25.5, -22.5, -19.5, -16.5, -13.5, -10.5, + -7.5, -4.5, -1.5, 1.5, 4.5, 7.5, 10.5, 13.5, + 16.5, 19.5, 22.5, 25.5, 28.5, 31.5, +}; + +static long _vq_quantmap__44c0_s3_p7_1[] = { + 21, 19, 17, 15, 13, 11, 9, 7, + 5, 3, 1, 0, 2, 4, 6, 8, + 10, 12, 14, 16, 18, 20, 22, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s3_p7_1 = { + _vq_quantthresh__44c0_s3_p7_1, + _vq_quantmap__44c0_s3_p7_1, + 23, + 23 +}; + +static static_codebook _44c0_s3_p7_1 = { + 2, 529, + _vq_lengthlist__44c0_s3_p7_1, + 1, -525303808, 1614282752, 5, 0, + _vq_quantlist__44c0_s3_p7_1, + NULL, + &_vq_auxt__44c0_s3_p7_1, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_s3_p7_2.vqh b/lib/books/coupled/_44c0_s3_p7_2.vqh new file mode 100644 index 00000000..c706631c --- /dev/null +++ b/lib/books/coupled/_44c0_s3_p7_2.vqh @@ -0,0 +1,63 @@ +/******************************************************************** + * * + * 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_s3_p7_2_VQH_ +#define _V__44c0_s3_p7_2_VQH_ +#include "codebook.h" + +static long _vq_quantlist__44c0_s3_p7_2[] = { + 1, + 0, + 2, +}; + +static long _vq_lengthlist__44c0_s3_p7_2[] = { + 3, 5, 5, 7, 6, 6, 7, 6, 6, 5, 5, 6, 7, 7, 7, 7, + 7, 7, 5, 6, 5, 7, 7, 7, 7, 7, 6, 7, 7, 8, 7, 8, + 7, 8, 7, 8, 6, 7, 7, 7, 7, 7, 7, 7, 7, 6, 7, 7, + 7, 7, 6, 7, 6, 7, 7, 8, 7, 7, 7, 7, 7, 8, 7, 6, + 6, 7, 7, 7, 7, 7, 6, 7, 6, 7, 6, 7, 7, 7, 7, 6, + 7, +}; + +static float _vq_quantthresh__44c0_s3_p7_2[] = { + -0.5, 0.5, +}; + +static long _vq_quantmap__44c0_s3_p7_2[] = { + 1, 0, 2, +}; + +static encode_aux_threshmatch _vq_auxt__44c0_s3_p7_2 = { + _vq_quantthresh__44c0_s3_p7_2, + _vq_quantmap__44c0_s3_p7_2, + 3, + 3 +}; + +static static_codebook _44c0_s3_p7_2 = { + 4, 81, + _vq_lengthlist__44c0_s3_p7_2, + 1, -535822336, 1611661312, 2, 0, + _vq_quantlist__44c0_s3_p7_2, + NULL, + &_vq_auxt__44c0_s3_p7_2, + NULL, + 0 +}; + + +#endif diff --git a/lib/books/coupled/_44c0_short.vqh b/lib/books/coupled/_44c0_short.vqh new file mode 100644 index 00000000..3b492bfc --- /dev/null +++ b/lib/books/coupled/_44c0_short.vqh @@ -0,0 +1,40 @@ +/******************************************************************** + * * + * 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 huff/huffbuld + + ********************************************************************/ + +#ifndef _V__44c0_short_VQH_ +#define _V__44c0_short_VQH_ +#include "codebook.h" + +static long _huff_lengthlist__44c0_short[] = { + 10,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,11,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13, 5, 4, 8, 2,13,13,13,13, 2, 5, 9, + 5,13,13,13,13, 3, 5, 9,11,13,13,13,12, 5, 3, 6, +}; + +static static_codebook _huff_book__44c0_short = { + 2, 64, + _huff_lengthlist__44c0_short, + 0, 0, 0, 0, 0, + NULL, + NULL, + NULL, + NULL, + 0 +}; + + +#endif diff --git a/lib/codec_internal.h b/lib/codec_internal.h new file mode 100644 index 00000000..21b6028e --- /dev/null +++ b/lib/codec_internal.h @@ -0,0 +1,180 @@ +/******************************************************************** + * * + * 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: libvorbis codec headers + last mod: $Id: codec_internal.h,v 1.12.2.1 2002/01/01 02:27:23 xiphmont Exp $ + + ********************************************************************/ + +#ifndef _V_CODECI_H_ +#define _V_CODECI_H_ + +#include "envelope.h" +#include "codebook.h" + +#define BLOCKTYPE_IMPULSE 0 +#define BLOCKTYPE_PADDING 1 +#define BLOCKTYPE_TRANSITION 0 +#define BLOCKTYPE_LONG 1 + +typedef struct vorbis_block_internal{ + float **pcmdelay; /* this is a pointer into local storage */ + float ampmax; + int blocktype; + + ogg_uint32_t *packet_markers; +} vorbis_block_internal; + +typedef void vorbis_look_time; +typedef void vorbis_look_mapping; +typedef void vorbis_look_floor; +typedef void vorbis_look_residue; +typedef void vorbis_look_transform; + +/* mode ************************************************************/ +typedef struct { + int blockflag; + int windowtype; + int transformtype; + int mapping; +} vorbis_info_mode; + +typedef void vorbis_info_time; +typedef void vorbis_info_floor; +typedef void vorbis_info_residue; +typedef void vorbis_info_mapping; + +#include "psy.h" +#include "bitrate.h" + +typedef struct backend_lookup_state { + /* local lookup storage */ + envelope_lookup *ve; /* envelope lookup */ + float **window[2][2][2]; /* block, leadin, leadout, type */ + vorbis_look_transform **transform[2]; /* block, type */ + codebook *fullbooks; + vorbis_look_psy_global *psy_g_look; + + /* backend lookups are tied to the mode, not the backend or naked mapping */ + int modebits; + vorbis_look_mapping **mode; + + /* local storage, only used on the encoding side. This way the + application does not need to worry about freeing some packets' + memory and not others'; packet storage is always tracked. + Cleared next call to a _dsp_ function */ + unsigned char *header; + unsigned char *header1; + unsigned char *header2; + + bitrate_manager_state bms; + +} backend_lookup_state; + +/* high level configuration information for setting things up + step-by-step with the detaile vorbis_encode_ctl interface */ + +typedef struct highlevel_block { + double tone_mask_quality; + double tone_peaklimit_quality; + + double noise_bias_quality; + double noise_compand_quality; + + double ath_quality; + +} highlevel_block; + +typedef struct highlevel_encode_setup { + double base_quality; /* these have to be tracked by the ctl */ + double base_quality_short; /* interface so that the right books get */ + double base_quality_long; /* chosen... */ + + int short_block_p; + int long_block_p; + int impulse_block_p; + + int stereo_couple_p; + int stereo_backfill_p; + int residue_backfill_p; + + int stereo_point_dB; + double stereo_point_kHz[2]; + double lowpass_kHz[2]; + + double ath_floating_dB; + double ath_absolute_dB; + + double amplitude_track_dBpersec; + double trigger_quality; + + highlevel_block blocktype[4]; /* impulse, padding, trans, long */ + + /* noise normalization for low bitrate */ + int normalize_noise_p; + float normalize_noise_minimum_upgrade; + float normalize_noise_unit_weight; + + int set_in_stone; +} highlevel_encode_setup; + +/* codec_setup_info contains all the setup information specific to the + specific compression/decompression mode in progress (eg, + psychoacoustic settings, channel setup, options, codebook + etc). +*********************************************************************/ + +typedef struct codec_setup_info { + + /* Vorbis supports only short and long blocks, but allows the + encoder to choose the sizes */ + + long blocksizes[2]; + + /* modes are the primary means of supporting on-the-fly different + blocksizes, different channel mappings (LR or M/A), + different residue backends, etc. Each mode consists of a + blocksize flag and a mapping (along with the mapping setup */ + + int modes; + int maps; + int times; + int floors; + int residues; + int books; + int psys; /* encode only */ + + vorbis_info_mode *mode_param[64]; + int map_type[64]; + vorbis_info_mapping *map_param[64]; + int time_type[64]; + vorbis_info_time *time_param[64]; + int floor_type[64]; + vorbis_info_floor *floor_param[64]; + int residue_type[64]; + vorbis_info_residue *residue_param[64]; + static_codebook *book_param[256]; + + vorbis_info_psy *psy_param[64]; /* encode only */ + vorbis_info_psy_global psy_g_param; + + bitrate_manager_info bi; + highlevel_encode_setup hi; + + int passlimit[32]; /* iteration limit per couple/quant pass */ + int coupling_passes; +} codec_setup_info; + +extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi); +extern void _vp_global_free(vorbis_look_psy_global *look); + +#endif diff --git a/lib/floor1.c b/lib/floor1.c new file mode 100644 index 00000000..893d8782 --- /dev/null +++ b/lib/floor1.c @@ -0,0 +1,1153 @@ +/******************************************************************** + * * + * 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: floor backend 1 implementation + last mod: $Id: floor1.c,v 1.19.2.1 2002/01/01 02:27:23 xiphmont Exp $ + + ********************************************************************/ + +#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 "scales.h" + +#include <stdio.h> + +#define floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */ + +typedef struct { + int sorted_index[VIF_POSIT+2]; + int forward_index[VIF_POSIT+2]; + int reverse_index[VIF_POSIT+2]; + + int hineighbor[VIF_POSIT]; + int loneighbor[VIF_POSIT]; + int posts; + + int n; + int quant_q; + vorbis_info_floor1 *vi; + + long phrasebits; + long postbits; + long frames; +} vorbis_look_floor1; + +typedef struct lsfit_acc{ + long x0; + long x1; + + long xa; + long ya; + long x2a; + long y2a; + long xya; + long n; + long an; + long un; + long edgey0; + long edgey1; +} lsfit_acc; + +/***********************************************/ + +static vorbis_info_floor *floor1_copy_info (vorbis_info_floor *i){ + vorbis_info_floor1 *info=(vorbis_info_floor1 *)i; + vorbis_info_floor1 *ret=_ogg_malloc(sizeof(*ret)); + memcpy(ret,info,sizeof(*ret)); + return(ret); +} + +static void floor1_free_info(vorbis_info_floor *i){ + vorbis_info_floor1 *info=(vorbis_info_floor1 *)i; + if(info){ + memset(info,0,sizeof(*info)); + _ogg_free(info); + } +} + +static void floor1_free_look(vorbis_look_floor *i){ + vorbis_look_floor1 *look=(vorbis_look_floor1 *)i; + if(look){ + fprintf(stderr,"floor 1 bit usage %f:%f (%f total)\n", + (float)look->phrasebits/look->frames, + (float)look->postbits/look->frames, + (float)(look->postbits+look->phrasebits)/look->frames); + + 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 ilog2(unsigned int v){ + int ret=0; + while(v>1){ + ret++; + v>>=1; + } + return(ret); +} + +static void floor1_pack (vorbis_info_floor *i,oggpack_buffer *opb){ + vorbis_info_floor1 *info=(vorbis_info_floor1 *)i; + int j,k; + int count=0; + int rangebits; + int maxposit=info->postlist[1]; + int maxclass=-1; + + /* save out partitions */ + oggpack_write(opb,info->partitions,5); /* only 0 to 31 legal */ + for(j=0;j<info->partitions;j++){ + oggpack_write(opb,info->partitionclass[j],4); /* only 0 to 15 legal */ + if(maxclass<info->partitionclass[j])maxclass=info->partitionclass[j]; + } + + /* save out partition classes */ + for(j=0;j<maxclass+1;j++){ + oggpack_write(opb,info->class_dim[j]-1,3); /* 1 to 8 */ + oggpack_write(opb,info->class_subs[j],2); /* 0 to 3 */ + if(info->class_subs[j])oggpack_write(opb,info->class_book[j],8); + for(k=0;k<(1<<info->class_subs[j]);k++) + oggpack_write(opb,info->class_subbook[j][k]+1,8); + } + + /* save out the post list */ + oggpack_write(opb,info->mult-1,2); /* only 1,2,3,4 legal now */ + oggpack_write(opb,ilog2(maxposit),4); + rangebits=ilog2(maxposit); + + for(j=0,k=0;j<info->partitions;j++){ + count+=info->class_dim[info->partitionclass[j]]; + for(;k<count;k++) + oggpack_write(opb,info->postlist[k+2],rangebits); + } +} + + +static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){ + codec_setup_info *ci=vi->codec_setup; + int j,k,count=0,maxclass=-1,rangebits; + + vorbis_info_floor1 *info=_ogg_calloc(1,sizeof(*info)); + /* read partitions */ + info->partitions=oggpack_read(opb,5); /* only 0 to 31 legal */ + for(j=0;j<info->partitions;j++){ + info->partitionclass[j]=oggpack_read(opb,4); /* only 0 to 15 legal */ + if(maxclass<info->partitionclass[j])maxclass=info->partitionclass[j]; + } + + /* read partition classes */ + for(j=0;j<maxclass+1;j++){ + info->class_dim[j]=oggpack_read(opb,3)+1; /* 1 to 8 */ + info->class_subs[j]=oggpack_read(opb,2); /* 0,1,2,3 bits */ + if(info->class_subs[j]<0) + goto err_out; + if(info->class_subs[j])info->class_book[j]=oggpack_read(opb,8); + if(info->class_book[j]<0 || info->class_book[j]>=ci->books) + goto err_out; + for(k=0;k<(1<<info->class_subs[j]);k++){ + info->class_subbook[j][k]=oggpack_read(opb,8)-1; + if(info->class_subbook[j][k]<-1 || info->class_subbook[j][k]>=ci->books) + goto err_out; + } + } + + /* read the post list */ + info->mult=oggpack_read(opb,2)+1; /* only 1,2,3,4 legal now */ + rangebits=oggpack_read(opb,4); + + for(j=0,k=0;j<info->partitions;j++){ + count+=info->class_dim[info->partitionclass[j]]; + for(;k<count;k++){ + int t=info->postlist[k+2]=oggpack_read(opb,rangebits); + if(t<0 || t>=(1<<rangebits)) + goto err_out; + } + } + info->postlist[0]=0; + info->postlist[1]=1<<rangebits; + + return(info); + + err_out: + floor1_free_info(info); + return(NULL); +} + +static int icomp(const void *a,const void *b){ + return(**(int **)a-**(int **)b); +} + +static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,vorbis_info_mode *mi, + vorbis_info_floor *in){ + + int *sortpointer[VIF_POSIT+2]; + vorbis_info_floor1 *info=(vorbis_info_floor1 *)in; + vorbis_look_floor1 *look=_ogg_calloc(1,sizeof(*look)); + int i,j,n=0; + + look->vi=info; + look->n=info->postlist[1]; + + /* we drop each position value in-between already decoded values, + and use linear interpolation to predict each new value past the + edges. The positions are read in the order of the position + list... we precompute the bounding positions in the lookup. Of + course, the neighbors can change (if a position is declined), but + this is an initial mapping */ + + for(i=0;i<info->partitions;i++)n+=info->class_dim[info->partitionclass[i]]; + n+=2; + look->posts=n; + + /* also store a sorted position index */ + for(i=0;i<n;i++)sortpointer[i]=info->postlist+i; + qsort(sortpointer,n,sizeof(*sortpointer),icomp); + + /* points from sort order back to range number */ + for(i=0;i<n;i++)look->forward_index[i]=sortpointer[i]-info->postlist; + /* points from range order to sorted position */ + for(i=0;i<n;i++)look->reverse_index[look->forward_index[i]]=i; + /* we actually need the post values too */ + for(i=0;i<n;i++)look->sorted_index[i]=info->postlist[look->forward_index[i]]; + + /* quantize values to multiplier spec */ + switch(info->mult){ + case 1: /* 1024 -> 256 */ + look->quant_q=256; + break; + case 2: /* 1024 -> 128 */ + look->quant_q=128; + break; + case 3: /* 1024 -> 86 */ + look->quant_q=86; + break; + case 4: /* 1024 -> 64 */ + look->quant_q=64; + break; + } + + /* discover our neighbors for decode where we don't use fit flags + (that would push the neighbors outward) */ + for(i=0;i<n-2;i++){ + int lo=0; + int hi=1; + int lx=0; + int hx=look->n; + int currentx=info->postlist[i+2]; + for(j=0;j<i+2;j++){ + int x=info->postlist[j]; + if(x>lx && x<currentx){ + lo=j; + lx=x; + } + if(x<hx && x>currentx){ + hi=j; + hx=x; + } + } + look->loneighbor[i]=lo; + look->hineighbor[i]=hi; + } + + return(look); +} + +static int render_point(int x0,int x1,int y0,int y1,int x){ + y0&=0x7fff; /* mask off flag */ + y1&=0x7fff; + + { + int dy=y1-y0; + int adx=x1-x0; + int ady=abs(dy); + int err=ady*(x-x0); + + int off=err/adx; + if(dy<0)return(y0-off); + return(y0+off); + } +} + +static int vorbis_dBquant(const float *x){ + int i= *x*7.3142857f+1023.5f; + if(i>1023)return(1023); + if(i<0)return(0); + return i; +} + +static float FLOOR_fromdB_LOOKUP[256]={ + 1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F, + 1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F, + 1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F, + 2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F, + 2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F, + 3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F, + 4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F, + 6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F, + 7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F, + 1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F, + 1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F, + 1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F, + 2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F, + 2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F, + 3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F, + 4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F, + 5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F, + 7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F, + 9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F, + 1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F, + 1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F, + 2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F, + 2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F, + 3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F, + 4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F, + 5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F, + 7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F, + 9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F, + 0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F, + 0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F, + 0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F, + 0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F, + 0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F, + 0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F, + 0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F, + 0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F, + 0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F, + 0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F, + 0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F, + 0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F, + 0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F, + 0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F, + 0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F, + 0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F, + 0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F, + 0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F, + 0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F, + 0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F, + 0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F, + 0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F, + 0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F, + 0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F, + 0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F, + 0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F, + 0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F, + 0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F, + 0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F, + 0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F, + 0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F, + 0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F, + 0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F, + 0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F, + 0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F, + 0.82788260F, 0.88168307F, 0.9389798F, 1.F, +}; + +static void render_line(int x0,int x1,int y0,int y1,float *d){ + int dy=y1-y0; + int adx=x1-x0; + int ady=abs(dy); + int base=dy/adx; + int sy=(dy<0?base-1:base+1); + int x=x0; + int y=y0; + int err=0; + + ady-=abs(base*adx); + + d[x]*=FLOOR_fromdB_LOOKUP[y]; + while(++x<x1){ + err=err+ady; + if(err>=adx){ + err-=adx; + y+=sy; + }else{ + y+=base; + } + d[x]*=FLOOR_fromdB_LOOKUP[y]; + } +} + +static void render_line0(int x0,int x1,int y0,int y1,float *d){ + int dy=y1-y0; + int adx=x1-x0; + int ady=abs(dy); + int base=dy/adx; + int sy=(dy<0?base-1:base+1); + int x=x0; + int y=y0; + int err=0; + + ady-=abs(base*adx); + + d[x]=FLOOR_fromdB_LOOKUP[y]; + while(++x<x1){ + err=err+ady; + if(err>=adx){ + err-=adx; + y+=sy; + }else{ + y+=base; + } + d[x]=FLOOR_fromdB_LOOKUP[y]; + } +} + +/* the floor has already been filtered to only include relevant sections */ +static int accumulate_fit(const float *flr,const float *mdct, + int x0, int x1,lsfit_acc *a, + int n,vorbis_info_floor1 *info){ + long i; + int quantized=vorbis_dBquant(flr+x0); + + long xa=0,ya=0,x2a=0,y2a=0,xya=0,na=0, xb=0,yb=0,x2b=0,y2b=0,xyb=0,nb=0; + + memset(a,0,sizeof(*a)); + a->x0=x0; + a->x1=x1; + a->edgey0=quantized; + if(x1>n)x1=n; + + for(i=x0;i<x1;i++){ + int quantized=vorbis_dBquant(flr+i); + if(quantized){ + if(mdct[i]+info->twofitatten>=flr[i]){ + xa += i; + ya += quantized; + x2a += i*i; + y2a += quantized*quantized; + xya += i*quantized; + na++; + }else{ + xb += i; + yb += quantized; + x2b += i*i; + y2b += quantized*quantized; + xyb += i*quantized; + nb++; + } + } + } + + xb+=xa; + yb+=ya; + x2b+=x2a; + y2b+=y2a; + xyb+=xya; + nb+=na; + + /* weight toward the actually used frequencies if we meet the threshhold */ + { + int weight; + if(nb<info->twofitminsize || na<info->twofitminused){ + weight=0; + }else{ + weight=nb*info->twofitweight/na; + } + a->xa=xa*weight+xb; + a->ya=ya*weight+yb; + a->x2a=x2a*weight+x2b; + a->y2a=y2a*weight+y2b; + a->xya=xya*weight+xyb; + a->an=na*weight+nb; + a->n=nb; + a->un=na; + if(nb>=info->unusedminsize)a->un++; + } + + a->edgey1=-200; + if(x1<n){ + int quantized=vorbis_dBquant(flr+i); + a->edgey1=quantized; + } + return(a->n); +} + +/* returns < 0 on too few points to fit, >=0 (meansq error) on success */ +static int fit_line(lsfit_acc *a,int fits,int *y0,int *y1){ + long x=0,y=0,x2=0,y2=0,xy=0,n=0,an=0,i; + long x0=a[0].x0; + long x1=a[fits-1].x1; + + for(i=0;i<fits;i++){ + if(a[i].un){ + x+=a[i].xa; + y+=a[i].ya; + x2+=a[i].x2a; + y2+=a[i].y2a; + xy+=a[i].xya; + n+=a[i].n; + an+=a[i].an; + } + } + + if(*y0>=0){ /* hint used to break degenerate cases */ + x+= x0; + y+= *y0; + x2+= x0 * x0; + y2+= *y0 * *y0; + xy+= *y0 * x0; + n++; + an++; + } + + if(*y1>=0){ /* hint used to break degenerate cases */ + x+= x1; + y+= *y1; + x2+= x1 * x1; + y2+= *y1 * *y1; + xy+= *y1 * x1; + n++; + an++; + } + + if(n<2)return(n-2); + + { + /* need 64 bit multiplies, which C doesn't give portably as int */ + double fx=x; + double fy=y; + double fx2=x2; + double fxy=xy; + double denom=1./(an*fx2-fx*fx); + double a=(fy*fx2-fxy*fx)*denom; + double b=(an*fxy-fx*fy)*denom; + *y0=rint(a+b*x0); + *y1=rint(a+b*x1); + + /* limit to our range! */ + if(*y0>1023)*y0=1023; + if(*y1>1023)*y1=1023; + if(*y0<0)*y0=0; + if(*y1<0)*y1=0; + + return(0); + } +} + +/*static void fit_line_point(lsfit_acc *a,int fits,int *y0,int *y1){ + long y=0; + int i; + + for(i=0;i<fits && y==0;i++) + y+=a[i].ya; + + *y0=*y1=y; + }*/ + +static int inspect_error(int x0,int x1,int y0,int y1,const float *mask, + const float *mdct, + vorbis_info_floor1 *info){ + int dy=y1-y0; + int adx=x1-x0; + int ady=abs(dy); + int base=dy/adx; + int sy=(dy<0?base-1:base+1); + int x=x0; + int y=y0; + int err=0; + int val=vorbis_dBquant(mask+x); + int mse=0; + int n=0; + + ady-=abs(base*adx); + + if(mdct[x]+info->twofitatten>=mask[x]){ + if(y+info->maxover<val)return(1); + if(y-info->maxunder>val)return(1); + mse=(y-val); + mse*=mse; + n++; + } + + while(++x<x1){ + err=err+ady; + if(err>=adx){ + err-=adx; + y+=sy; + }else{ + y+=base; + } + + if(mdct[x]+info->twofitatten>=mask[x]){ + val=vorbis_dBquant(mask+x); + if(val){ + if(y+info->maxover<val)return(1); + if(y-info->maxunder>val)return(1); + mse+=((y-val)*(y-val)); + n++; + } + } + } + + if(n){ + if(info->maxover*info->maxover/n>info->maxerr)return(0); + if(info->maxunder*info->maxunder/n>info->maxerr)return(0); + if(mse/n>info->maxerr)return(1); + } + return(0); +} + +static int post_Y(int *A,int *B,int pos){ + if(A[pos]<0) + return B[pos]; + if(B[pos]<0) + return A[pos]; + + return (A[pos]+B[pos])>>1; +} + +static int floor1_forward(vorbis_block *vb,vorbis_look_floor *in, + float *mdct, const float *logmdct, /* in */ + const float *logmask, const float *logmax, /* in */ + float *codedflr){ /* out */ + static int seq=0; + long i,j,k,l; + vorbis_look_floor1 *look=(vorbis_look_floor1 *)in; + vorbis_info_floor1 *info=look->vi; + long n=info->n; + long posts=look->posts; + long nonzero=0; + lsfit_acc fits[VIF_POSIT+1]; + int fit_valueA[VIF_POSIT+2]; /* index by range list position */ + int fit_valueB[VIF_POSIT+2]; /* index by range list position */ + int fit_flag[VIF_POSIT+2]; + + int loneighbor[VIF_POSIT+2]; /* sorted index of range list position (+2) */ + int hineighbor[VIF_POSIT+2]; + int memo[VIF_POSIT+2]; + codec_setup_info *ci=vb->vd->vi->codec_setup; + static_codebook **sbooks=ci->book_param; + codebook *books=NULL; + int writeflag=0; + + if(vb->vd->backend_state){ + books=((backend_lookup_state *)(vb->vd->backend_state))-> + fullbooks; + writeflag=1; + } + + memset(fit_flag,0,sizeof(fit_flag)); + for(i=0;i<posts;i++)loneighbor[i]=0; /* 0 for the implicit 0 post */ + for(i=0;i<posts;i++)hineighbor[i]=1; /* 1 for the implicit post at n */ + for(i=0;i<posts;i++)memo[i]=-1; /* no neighbor yet */ + + /* Scan back from high edge to first 'used' frequency */ + for(;n>info->unusedmin_n;n--) + if(logmdct[n-1]>-floor1_rangedB && + logmdct[n-1]+info->twofitatten>logmask[n-1])break; + + /* quantize the relevant floor points and collect them into line fit + structures (one per minimal division) at the same time */ + if(posts==0){ + nonzero+=accumulate_fit(logmask,logmax,0,n,fits,n,info); + }else{ + for(i=0;i<posts-1;i++) + nonzero+=accumulate_fit(logmask,logmax,look->sorted_index[i], + look->sorted_index[i+1],fits+i, + n,info); + } + + if(nonzero){ + /* start by fitting the implicit base case.... */ + int y0=-200; + int y1=-200; + int mse=fit_line(fits,posts-1,&y0,&y1); + if(mse<0){ + /* Only a single nonzero point */ + y0=-200; + y1=0; + fit_line(fits,posts-1,&y0,&y1); + } + + fit_flag[0]=1; + fit_flag[1]=1; + fit_valueA[0]=y0; + fit_valueB[0]=y0; + fit_valueB[1]=y1; + fit_valueA[1]=y1; + + if(mse>=0){ + /* Non degenerate case */ + /* start progressive splitting. This is a greedy, non-optimal + algorithm, but simple and close enough to the best + answer. */ + for(i=2;i<posts;i++){ + int sortpos=look->reverse_index[i]; + int ln=loneighbor[sortpos]; + int hn=hineighbor[sortpos]; + + /* eliminate repeat searches of a particular range with a memo */ + if(memo[ln]!=hn){ + /* haven't performed this error search yet */ + int lsortpos=look->reverse_index[ln]; + int hsortpos=look->reverse_index[hn]; + memo[ln]=hn; + + /* if this is an empty segment, its endpoints don't matter. + Mark as such */ + for(j=lsortpos;j<hsortpos;j++) + if(fits[j].un)break; + if(j==hsortpos){ + /* empty segment; important to note that this does not + break 0/n post case */ + fit_valueB[ln]=-200; + if(fit_valueA[ln]<0) + fit_flag[ln]=0; + fit_valueA[hn]=-200; + if(fit_valueB[hn]<0) + fit_flag[hn]=0; + + }else{ + /* A note: we want to bound/minimize *local*, not global, error */ + int lx=info->postlist[ln]; + int hx=info->postlist[hn]; + int ly=post_Y(fit_valueA,fit_valueB,ln); + int hy=post_Y(fit_valueA,fit_valueB,hn); + + if(inspect_error(lx,hx,ly,hy,logmask,logmdct,info)){ + /* outside error bounds/begin search area. Split it. */ + int ly0=-200; + int ly1=-200; + int hy0=-200; + int hy1=-200; + int lmse=fit_line(fits+lsortpos,sortpos-lsortpos,&ly0,&ly1); + int hmse=fit_line(fits+sortpos,hsortpos-sortpos,&hy0,&hy1); + + /* the boundary/sparsity cases are the hard part. They + don't happen often given that we use the full mask + curve (weighted) now, but when they do happen they + can go boom. Pay them detailed attention */ + /* cases for a segment: + >=0) normal fit (>=2 unique points) + -1) one point on x0; + one point on x1; <-- disallowed by fit_line + -2) one point in between x0 and x1 + -3) no points */ + + switch(lmse){ + case -2: + /* no points in the low segment */ + break; + case -1: + ly0=fits[lsortpos].edgey0; + break; + /*default: + break;*/ + } + + switch(hmse){ + case -2: + /* no points in the hi segment */ + break; + case -1: + hy0=fits[sortpos].edgey0; + break; + } + + /* store new edge values */ + fit_valueB[ln]=ly0; + if(ln==0 && ly0>=0)fit_valueA[ln]=ly0; + fit_valueA[i]=ly1; + fit_valueB[i]=hy0; + fit_valueA[hn]=hy1; + if(hn==1 && hy1>=0)fit_valueB[hn]=hy1; + + if(ly0<0 && fit_valueA[ln]<0) + fit_flag[ln]=0; + if(hy1<0 && fit_valueB[hn]<0) + fit_flag[hn]=0; + + if(ly1>=0 || hy0>=0){ + /* store new neighbor values */ + for(j=sortpos-1;j>=0;j--) + if(hineighbor[j]==hn) + hineighbor[j]=i; + else + break; + for(j=sortpos+1;j<posts;j++) + if(loneighbor[j]==ln) + loneighbor[j]=i; + else + break; + + /* store flag (set) */ + fit_flag[i]=1; + } + } + } + } + } + } + + /* quantize values to multiplier spec */ + switch(info->mult){ + case 1: /* 1024 -> 256 */ + for(i=0;i<posts;i++) + if(fit_flag[i]) + fit_valueA[i]=post_Y(fit_valueA,fit_valueB,i)>>2; + break; + case 2: /* 1024 -> 128 */ + for(i=0;i<posts;i++) + if(fit_flag[i]) + fit_valueA[i]=post_Y(fit_valueA,fit_valueB,i)>>3; + break; + case 3: /* 1024 -> 86 */ + for(i=0;i<posts;i++) + if(fit_flag[i]) + fit_valueA[i]=post_Y(fit_valueA,fit_valueB,i)/12; + break; + case 4: /* 1024 -> 64 */ + for(i=0;i<posts;i++) + if(fit_flag[i]) + fit_valueA[i]=post_Y(fit_valueA,fit_valueB,i)>>4; + break; + } + + /* find prediction values for each post and subtract them */ + for(i=2;i<posts;i++){ + int sp=look->reverse_index[i]; + int ln=look->loneighbor[i-2]; + int hn=look->hineighbor[i-2]; + int x0=info->postlist[ln]; + int x1=info->postlist[hn]; + int y0=fit_valueA[ln]; + int y1=fit_valueA[hn]; + + int predicted=render_point(x0,x1,y0,y1,info->postlist[i]); + + if(fit_flag[i]){ + int headroom=(look->quant_q-predicted<predicted? + look->quant_q-predicted:predicted); + + int val=fit_valueA[i]-predicted; + + /* at this point the 'deviation' value is in the range +/- max + range, but the real, unique range can always be mapped to + only [0-maxrange). So we want to wrap the deviation into + this limited range, but do it in the way that least screws + an essentially gaussian probability distribution. */ + + if(val<0) + if(val<-headroom) + val=headroom-val-1; + else + val=-1-(val<<1); + else + if(val>=headroom) + val= val+headroom; + else + val<<=1; + + fit_valueB[i]=val; + + /* unroll the neighbor arrays */ + for(j=sp+1;j<posts;j++) + if(loneighbor[j]==i) + loneighbor[j]=loneighbor[sp]; + else + break; + for(j=sp-1;j>=0;j--) + if(hineighbor[j]==i) + hineighbor[j]=hineighbor[sp]; + else + break; + + }else{ + fit_valueA[i]=predicted; + fit_valueB[i]=0; + } + if(fit_valueB[i]==0) + fit_valueA[i]|=0x8000; + else{ + fit_valueA[look->loneighbor[i-2]]&=0x7fff; + fit_valueA[look->hineighbor[i-2]]&=0x7fff; + } + } + + /* we have everything we need. pack it out */ + /* mark nontrivial floor */ + if(writeflag){ + oggpack_write(&vb->opb,1,1); + + /* beginning/end post */ + look->frames++; + look->postbits+=ilog(look->quant_q-1)*2; + oggpack_write(&vb->opb,fit_valueA[0],ilog(look->quant_q-1)); + oggpack_write(&vb->opb,fit_valueA[1],ilog(look->quant_q-1)); + + + /* partition by partition */ + for(i=0,j=2;i<info->partitions;i++){ + int class=info->partitionclass[i]; + int cdim=info->class_dim[class]; + int csubbits=info->class_subs[class]; + int csub=1<<csubbits; + int bookas[8]={0,0,0,0,0,0,0,0}; + int cval=0; + int cshift=0; + + /* generate the partition's first stage cascade value */ + if(csubbits){ + int maxval[8]; + for(k=0;k<csub;k++){ + int booknum=info->class_subbook[class][k]; + if(booknum<0){ + maxval[k]=1; + }else{ + maxval[k]=sbooks[info->class_subbook[class][k]]->entries; + } + } + for(k=0;k<cdim;k++){ + for(l=0;l<csub;l++){ + int val=fit_valueB[j+k]; + if(val<maxval[l]){ + bookas[k]=l; + break; + } + } + cval|= bookas[k]<<cshift; + cshift+=csubbits; + } + /* write it */ + look->phrasebits+= + vorbis_book_encode(books+info->class_book[class],cval,&vb->opb); + +#ifdef TRAIN_FLOOR1 + { + FILE *of; + char buffer[80]; + sprintf(buffer,"line_%dx%ld_class%d.vqd", + vb->pcmend/2,posts-2,class); + of=fopen(buffer,"a"); + fprintf(of,"%d\n",cval); + fclose(of); + } +#endif + } + + /* write post values */ + for(k=0;k<cdim;k++){ + int book=info->class_subbook[class][bookas[k]]; + if(book>=0){ + /* hack to allow training with 'bad' books */ + if(fit_valueB[j+k]<(books+book)->entries) + look->postbits+=vorbis_book_encode(books+book, + fit_valueB[j+k],&vb->opb); + /*else + fprintf(stderr,"+!");*/ + +#ifdef TRAIN_FLOOR1 + { + FILE *of; + char buffer[80]; + sprintf(buffer,"line_%dx%ld_%dsub%d.vqd", + vb->pcmend/2,posts-2,class,bookas[k]); + of=fopen(buffer,"a"); + fprintf(of,"%d\n",fit_valueB[j+k]); + fclose(of); + } +#endif + } + } + j+=cdim; + } + } + + { + /* generate quantized floor equivalent to what we'd unpack in decode */ + int hx; + int lx=0; + int ly=fit_valueA[0]*info->mult; + + for(j=1;j<posts;j++){ + int current=look->forward_index[j]; + if(!(fit_valueA[current]&0x8000)){ + int hy=(fit_valueA[current]&0x7fff)*info->mult; + hx=info->postlist[current]; + + render_line0(lx,hx,ly,hy,codedflr); + + lx=hx; + ly=hy; + } + } + for(j=lx;j<vb->pcmend/2;j++)codedflr[j]=codedflr[j-1]; /* be certain */ + + /* use it to create residue vector. Eliminate mdct elements + that were below the error training attenuation relative to + the original mask. This avoids portions of the floor fit + that were considered 'unused' in fitting from being used in + coding residue if the unfit values are significantly below + the original input mask */ + + for(j=0;j<n;j++) + if(logmdct[j]+info->twofitatten<logmask[j]) + mdct[j]=0.f; + for(j=n;j<vb->pcmend/2;j++)mdct[j]=0.f; + + } + + }else{ + if(writeflag)oggpack_write(&vb->opb,0,1); + memset(codedflr,0,n*sizeof(*codedflr)); + memset(mdct,0,n*sizeof(*mdct)); + } + seq++; + return(nonzero); +} + +static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){ + vorbis_look_floor1 *look=(vorbis_look_floor1 *)in; + vorbis_info_floor1 *info=look->vi; + + int i,j,k; + codebook *books=((backend_lookup_state *)(vb->vd->backend_state))-> + fullbooks; + + /* unpack wrapped/predicted values from stream */ + if(oggpack_read(&vb->opb,1)==1){ + int *fit_value=_vorbis_block_alloc(vb,(look->posts)*sizeof(*fit_value)); + + fit_value[0]=oggpack_read(&vb->opb,ilog(look->quant_q-1)); + fit_value[1]=oggpack_read(&vb->opb,ilog(look->quant_q-1)); + + /* partition by partition */ + /* partition by partition */ + for(i=0,j=2;i<info->partitions;i++){ + int class=info->partitionclass[i]; + int cdim=info->class_dim[class]; + int csubbits=info->class_subs[class]; + int csub=1<<csubbits; + int cval=0; + + /* decode the partition's first stage cascade value */ + if(csubbits){ + cval=vorbis_book_decode(books+info->class_book[class],&vb->opb); + + if(cval==-1)goto eop; + } + + for(k=0;k<cdim;k++){ + int book=info->class_subbook[class][cval&(csub-1)]; + cval>>=csubbits; + if(book>=0){ + if((fit_value[j+k]=vorbis_book_decode(books+book,&vb->opb))==-1) + goto eop; + }else{ + fit_value[j+k]=0; + } + } + j+=cdim; + } + + /* unwrap positive values and reconsitute via linear interpolation */ + for(i=2;i<look->posts;i++){ + int predicted=render_point(info->postlist[look->loneighbor[i-2]], + info->postlist[look->hineighbor[i-2]], + fit_value[look->loneighbor[i-2]], + fit_value[look->hineighbor[i-2]], + info->postlist[i]); + int hiroom=look->quant_q-predicted; + int loroom=predicted; + int room=(hiroom<loroom?hiroom:loroom)<<1; + int val=fit_value[i]; + + if(val){ + if(val>=room){ + if(hiroom>loroom){ + val = val-loroom; + }else{ + val = -1-(val-hiroom); + } + }else{ + if(val&1){ + val= -((val+1)>>1); + }else{ + val>>=1; + } + } + + fit_value[i]=val+predicted; + fit_value[look->loneighbor[i-2]]&=0x7fff; + fit_value[look->hineighbor[i-2]]&=0x7fff; + + }else{ + fit_value[i]=predicted|0x8000; + } + + } + + return(fit_value); + } + eop: + return(NULL); +} + +static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo, + float *out){ + vorbis_look_floor1 *look=(vorbis_look_floor1 *)in; + vorbis_info_floor1 *info=look->vi; + + codec_setup_info *ci=vb->vd->vi->codec_setup; + int n=ci->blocksizes[vb->mode]/2; + int j; + + if(memo){ + /* render the lines */ + int *fit_value=(int *)memo; + int hx=0; + int lx=0; + int ly=fit_value[0]*info->mult; + for(j=1;j<look->posts;j++){ + int current=look->forward_index[j]; + int hy=fit_value[current]&0x7fff; + if(hy==fit_value[current]){ + + hy*=info->mult; + hx=info->postlist[current]; + + render_line(lx,hx,ly,hy,out); + + lx=hx; + ly=hy; + } + } + for(j=hx;j<n;j++)out[j]*=ly; /* be certain */ + return(1); + } + memset(out,0,sizeof(*out)*n); + return(0); +} + +/* export hooks */ +vorbis_func_floor floor1_exportbundle={ + &floor1_pack,&floor1_unpack,&floor1_look,&floor1_copy_info,&floor1_free_info, + &floor1_free_look,&floor1_forward,&floor1_inverse1,&floor1_inverse2 +}; + diff --git a/lib/info.c b/lib/info.c new file mode 100644 index 00000000..f58bfb61 --- /dev/null +++ b/lib/info.c @@ -0,0 +1,598 @@ +/******************************************************************** + * * + * 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: maintain the info structure, info <-> header packets + last mod: $Id: info.c,v 1.51.2.1 2002/01/01 02:27:23 xiphmont Exp $ + + ********************************************************************/ + +/* general handling of the header and the vorbis_info structure (and + substructures) */ + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <ogg/ogg.h> +#include "vorbis/codec.h" +#include "codec_internal.h" +#include "codebook.h" +#include "registry.h" +#include "window.h" +#include "psy.h" +#include "misc.h" +#include "os.h" + +/* helpers */ +static int ilog2(unsigned int v){ + int ret=0; + while(v>1){ + ret++; + v>>=1; + } + return(ret); +} + +static void _v_writestring(oggpack_buffer *o,char *s, int bytes){ + + while(bytes--){ + oggpack_write(o,*s++,8); + } +} + +static void _v_readstring(oggpack_buffer *o,char *buf,int bytes){ + while(bytes--){ + *buf++=oggpack_read(o,8); + } +} + +void vorbis_comment_init(vorbis_comment *vc){ + memset(vc,0,sizeof(*vc)); +} + +void vorbis_comment_add(vorbis_comment *vc,char *comment){ + vc->user_comments=_ogg_realloc(vc->user_comments, + (vc->comments+2)*sizeof(*vc->user_comments)); + vc->comment_lengths=_ogg_realloc(vc->comment_lengths, + (vc->comments+2)*sizeof(*vc->comment_lengths)); + vc->comment_lengths[vc->comments]=strlen(comment); + vc->user_comments[vc->comments]=_ogg_malloc(vc->comment_lengths[vc->comments]+1); + strcpy(vc->user_comments[vc->comments], comment); + vc->comments++; + vc->user_comments[vc->comments]=NULL; +} + +void vorbis_comment_add_tag(vorbis_comment *vc, char *tag, char *contents){ + char *comment=alloca(strlen(tag)+strlen(contents)+2); /* +2 for = and \0 */ + strcpy(comment, tag); + strcat(comment, "="); + strcat(comment, contents); + vorbis_comment_add(vc, comment); +} + +/* This is more or less the same as strncasecmp - but that doesn't exist + * everywhere, and this is a fairly trivial function, so we include it */ +static int tagcompare(const char *s1, const char *s2, int n){ + int c=0; + while(c < n){ + if(toupper(s1[c]) != toupper(s2[c])) + return !0; + c++; + } + return 0; +} + +char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){ + long i; + int found = 0; + int taglen = strlen(tag)+1; /* +1 for the = we append */ + char *fulltag = alloca(taglen+ 1); + + strcpy(fulltag, tag); + strcat(fulltag, "="); + + for(i=0;i<vc->comments;i++){ + if(!tagcompare(vc->user_comments[i], fulltag, taglen)){ + if(count == found) + /* We return a pointer to the data, not a copy */ + return vc->user_comments[i] + taglen; + else + found++; + } + } + return NULL; /* didn't find anything */ +} + +int vorbis_comment_query_count(vorbis_comment *vc, char *tag){ + int i,count=0; + int taglen = strlen(tag)+1; /* +1 for the = we append */ + char *fulltag = alloca(taglen+1); + strcpy(fulltag,tag); + strcat(fulltag, "="); + + for(i=0;i<vc->comments;i++){ + if(!tagcompare(vc->user_comments[i], fulltag, taglen)) + count++; + } + + return count; +} + +void vorbis_comment_clear(vorbis_comment *vc){ + if(vc){ + long i; + for(i=0;i<vc->comments;i++) + if(vc->user_comments[i])_ogg_free(vc->user_comments[i]); + if(vc->user_comments)_ogg_free(vc->user_comments); + if(vc->comment_lengths)_ogg_free(vc->comment_lengths); + if(vc->vendor)_ogg_free(vc->vendor); + } + memset(vc,0,sizeof(*vc)); +} + +/* blocksize 0 is guaranteed to be short, 1 is guarantted to be long. + They may be equal, but short will never ge greater than long */ +int vorbis_info_blocksize(vorbis_info *vi,int zo){ + codec_setup_info *ci = vi->codec_setup; + return ci ? ci->blocksizes[zo] : -1; +} + +/* used by synthesis, which has a full, alloced vi */ +void vorbis_info_init(vorbis_info *vi){ + memset(vi,0,sizeof(*vi)); + vi->codec_setup=_ogg_calloc(1,sizeof(codec_setup_info)); +} + +void vorbis_info_clear(vorbis_info *vi){ + codec_setup_info *ci=vi->codec_setup; + int i; + + if(ci){ + + for(i=0;i<ci->modes;i++) + if(ci->mode_param[i])_ogg_free(ci->mode_param[i]); + + for(i=0;i<ci->maps;i++) /* unpack does the range checking */ + _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]); + + for(i=0;i<ci->times;i++) /* unpack does the range checking */ + _time_P[ci->time_type[i]]->free_info(ci->time_param[i]); + + for(i=0;i<ci->floors;i++) /* unpack does the range checking */ + _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]); + + for(i=0;i<ci->residues;i++) /* unpack does the range checking */ + _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]); + + for(i=0;i<ci->books;i++){ + if(ci->book_param[i]){ + /* knows if the book was not alloced */ + vorbis_staticbook_destroy(ci->book_param[i]); + } + } + + for(i=0;i<ci->psys;i++) + _vi_psy_free(ci->psy_param[i]); + + _ogg_free(ci); + } + + memset(vi,0,sizeof(*vi)); +} + +/* Header packing/unpacking ********************************************/ + +static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){ + codec_setup_info *ci=vi->codec_setup; + if(!ci)return(OV_EFAULT); + + vi->version=oggpack_read(opb,32); + if(vi->version!=0)return(OV_EVERSION); + + vi->channels=oggpack_read(opb,8); + vi->rate=oggpack_read(opb,32); + + vi->bitrate_upper=oggpack_read(opb,32); + vi->bitrate_nominal=oggpack_read(opb,32); + vi->bitrate_lower=oggpack_read(opb,32); + + ci->blocksizes[0]=1<<oggpack_read(opb,4); + ci->blocksizes[1]=1<<oggpack_read(opb,4); + + if(vi->rate<1)goto err_out; + if(vi->channels<1)goto err_out; + if(ci->blocksizes[0]<8)goto err_out; + if(ci->blocksizes[1]<ci->blocksizes[0])goto err_out; + + if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */ + + return(0); + err_out: + vorbis_info_clear(vi); + return(OV_EBADHEADER); +} + +static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){ + int i; + int vendorlen=oggpack_read(opb,32); + if(vendorlen<0)goto err_out; + vc->vendor=_ogg_calloc(vendorlen+1,1); + _v_readstring(opb,vc->vendor,vendorlen); + vc->comments=oggpack_read(opb,32); + if(vc->comments<0)goto err_out; + vc->user_comments=_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments)); + vc->comment_lengths=_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths)); + + for(i=0;i<vc->comments;i++){ + int len=oggpack_read(opb,32); + if(len<0)goto err_out; + vc->comment_lengths[i]=len; + vc->user_comments[i]=_ogg_calloc(len+1,1); + _v_readstring(opb,vc->user_comments[i],len); + } + if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */ + + return(0); + err_out: + vorbis_comment_clear(vc); + return(OV_EBADHEADER); +} + +/* all of the real encoding details are here. The modes, books, + everything */ +static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){ + codec_setup_info *ci=vi->codec_setup; + int i; + if(!ci)return(OV_EFAULT); + + /* codebooks */ + ci->books=oggpack_read(opb,8)+1; + /*ci->book_param=_ogg_calloc(ci->books,sizeof(*ci->book_param));*/ + for(i=0;i<ci->books;i++){ + ci->book_param[i]=_ogg_calloc(1,sizeof(*ci->book_param[i])); + if(vorbis_staticbook_unpack(opb,ci->book_param[i]))goto err_out; + } + + /* time backend settings */ + ci->times=oggpack_read(opb,6)+1; + /*ci->time_type=_ogg_malloc(ci->times*sizeof(*ci->time_type));*/ + /*ci->time_param=_ogg_calloc(ci->times,sizeof(void *));*/ + for(i=0;i<ci->times;i++){ + ci->time_type[i]=oggpack_read(opb,16); + if(ci->time_type[i]<0 || ci->time_type[i]>=VI_TIMEB)goto err_out; + ci->time_param[i]=_time_P[ci->time_type[i]]->unpack(vi,opb); + if(!ci->time_param[i])goto err_out; + } + + /* floor backend settings */ + ci->floors=oggpack_read(opb,6)+1; + /*ci->floor_type=_ogg_malloc(ci->floors*sizeof(*ci->floor_type));*/ + /*ci->floor_param=_ogg_calloc(ci->floors,sizeof(void *));*/ + for(i=0;i<ci->floors;i++){ + ci->floor_type[i]=oggpack_read(opb,16); + if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out; + ci->floor_param[i]=_floor_P[ci->floor_type[i]]->unpack(vi,opb); + if(!ci->floor_param[i])goto err_out; + } + + /* residue backend settings */ + ci->residues=oggpack_read(opb,6)+1; + /*ci->residue_type=_ogg_malloc(ci->residues*sizeof(*ci->residue_type));*/ + /*ci->residue_param=_ogg_calloc(ci->residues,sizeof(void *));*/ + for(i=0;i<ci->residues;i++){ + ci->residue_type[i]=oggpack_read(opb,16); + if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out; + ci->residue_param[i]=_residue_P[ci->residue_type[i]]->unpack(vi,opb); + if(!ci->residue_param[i])goto err_out; + } + + /* map backend settings */ + ci->maps=oggpack_read(opb,6)+1; + /*ci->map_type=_ogg_malloc(ci->maps*sizeof(*ci->map_type));*/ + /*ci->map_param=_ogg_calloc(ci->maps,sizeof(void *));*/ + for(i=0;i<ci->maps;i++){ + ci->map_type[i]=oggpack_read(opb,16); + if(ci->map_type[i]<0 || ci->map_type[i]>=VI_MAPB)goto err_out; + ci->map_param[i]=_mapping_P[ci->map_type[i]]->unpack(vi,opb); + if(!ci->map_param[i])goto err_out; + } + + /* mode settings */ + ci->modes=oggpack_read(opb,6)+1; + /*vi->mode_param=_ogg_calloc(vi->modes,sizeof(void *));*/ + for(i=0;i<ci->modes;i++){ + ci->mode_param[i]=_ogg_calloc(1,sizeof(*ci->mode_param[i])); + ci->mode_param[i]->blockflag=oggpack_read(opb,1); + ci->mode_param[i]->windowtype=oggpack_read(opb,16); + ci->mode_param[i]->transformtype=oggpack_read(opb,16); + ci->mode_param[i]->mapping=oggpack_read(opb,8); + + if(ci->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out; + if(ci->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out; + if(ci->mode_param[i]->mapping>=ci->maps)goto err_out; + } + + if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */ + + return(0); + err_out: + vorbis_info_clear(vi); + return(OV_EBADHEADER); +} + +/* The Vorbis header is in three packets; the initial small packet in + the first page that identifies basic parameters, a second packet + with bitstream comments and a third packet that holds the + codebook. */ + +int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){ + oggpack_buffer opb; + + if(op){ + oggpack_readinit(&opb,op->packet,op->bytes); + + /* Which of the three types of header is this? */ + /* Also verify header-ness, vorbis */ + { + char buffer[6]; + int packtype=oggpack_read(&opb,8); + memset(buffer,0,6); + _v_readstring(&opb,buffer,6); + if(memcmp(buffer,"vorbis",6)){ + /* not a vorbis header */ + return(OV_ENOTVORBIS); + } + switch(packtype){ + case 0x01: /* least significant *bit* is read first */ + if(!op->b_o_s){ + /* Not the initial packet */ + return(OV_EBADHEADER); + } + if(vi->rate!=0){ + /* previously initialized info header */ + return(OV_EBADHEADER); + } + + return(_vorbis_unpack_info(vi,&opb)); + + case 0x03: /* least significant *bit* is read first */ + if(vi->rate==0){ + /* um... we didn't get the initial header */ + return(OV_EBADHEADER); + } + + return(_vorbis_unpack_comment(vc,&opb)); + + case 0x05: /* least significant *bit* is read first */ + if(vi->rate==0 || vc->vendor==NULL){ + /* um... we didn;t get the initial header or comments yet */ + return(OV_EBADHEADER); + } + + return(_vorbis_unpack_books(vi,&opb)); + + default: + /* Not a valid vorbis header type */ + return(OV_EBADHEADER); + break; + } + } + } + return(OV_EBADHEADER); +} + +/* pack side **********************************************************/ + +static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){ + codec_setup_info *ci=vi->codec_setup; + if(!ci)return(OV_EFAULT); + + /* preamble */ + oggpack_write(opb,0x01,8); + _v_writestring(opb,"vorbis", 6); + + /* basic information about the stream */ + oggpack_write(opb,0x00,32); + oggpack_write(opb,vi->channels,8); + oggpack_write(opb,vi->rate,32); + + oggpack_write(opb,vi->bitrate_upper,32); + oggpack_write(opb,vi->bitrate_nominal,32); + oggpack_write(opb,vi->bitrate_lower,32); + + oggpack_write(opb,ilog2(ci->blocksizes[0]),4); + oggpack_write(opb,ilog2(ci->blocksizes[1]),4); + oggpack_write(opb,1,1); + + return(0); +} + +static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){ + char temp[]="Xiphophorus libVorbis I 20020107"; + int bytes = strlen(temp); + + /* preamble */ + oggpack_write(opb,0x03,8); + _v_writestring(opb,"vorbis", 6); + + /* vendor */ + oggpack_write(opb,bytes,32); + _v_writestring(opb,temp, bytes); + + /* comments */ + + oggpack_write(opb,vc->comments,32); + if(vc->comments){ + int i; + for(i=0;i<vc->comments;i++){ + if(vc->user_comments[i]){ + oggpack_write(opb,vc->comment_lengths[i],32); + _v_writestring(opb,vc->user_comments[i], vc->comment_lengths[i]); + }else{ + oggpack_write(opb,0,32); + } + } + } + oggpack_write(opb,1,1); + + return(0); +} + +static int _vorbis_pack_books(oggpack_buffer *opb,vorbis_info *vi){ + codec_setup_info *ci=vi->codec_setup; + int i; + if(!ci)return(OV_EFAULT); + + oggpack_write(opb,0x05,8); + _v_writestring(opb,"vorbis", 6); + + /* books */ + oggpack_write(opb,ci->books-1,8); + for(i=0;i<ci->books;i++) + if(vorbis_staticbook_pack(ci->book_param[i],opb))goto err_out; + + /* times */ + oggpack_write(opb,ci->times-1,6); + for(i=0;i<ci->times;i++){ + oggpack_write(opb,ci->time_type[i],16); + _time_P[ci->time_type[i]]->pack(ci->time_param[i],opb); + } + + /* floors */ + oggpack_write(opb,ci->floors-1,6); + for(i=0;i<ci->floors;i++){ + oggpack_write(opb,ci->floor_type[i],16); + _floor_P[ci->floor_type[i]]->pack(ci->floor_param[i],opb); + } + + /* residues */ + oggpack_write(opb,ci->residues-1,6); + for(i=0;i<ci->residues;i++){ + oggpack_write(opb,ci->residue_type[i],16); + _residue_P[ci->residue_type[i]]->pack(ci->residue_param[i],opb); + } + + /* maps */ + oggpack_write(opb,ci->maps-1,6); + for(i=0;i<ci->maps;i++){ + oggpack_write(opb,ci->map_type[i],16); + _mapping_P[ci->map_type[i]]->pack(vi,ci->map_param[i],opb); + } + + /* modes */ + oggpack_write(opb,ci->modes-1,6); + for(i=0;i<ci->modes;i++){ + oggpack_write(opb,ci->mode_param[i]->blockflag,1); + oggpack_write(opb,ci->mode_param[i]->windowtype,16); + oggpack_write(opb,ci->mode_param[i]->transformtype,16); + oggpack_write(opb,ci->mode_param[i]->mapping,8); + } + oggpack_write(opb,1,1); + + return(0); +err_out: + return(-1); +} + +int vorbis_commentheader_out(vorbis_comment *vc, + ogg_packet *op){ + + oggpack_buffer opb; + + oggpack_writeinit(&opb); + if(_vorbis_pack_comment(&opb,vc)) return OV_EIMPL; + + op->packet = _ogg_malloc(oggpack_bytes(&opb)); + memcpy(op->packet, opb.buffer, oggpack_bytes(&opb)); + + op->bytes=oggpack_bytes(&opb); + op->b_o_s=0; + op->e_o_s=0; + op->granulepos=0; + + return 0; +} + +int vorbis_analysis_headerout(vorbis_dsp_state *v, + vorbis_comment *vc, + ogg_packet *op, + ogg_packet *op_comm, + ogg_packet *op_code){ + int ret=OV_EIMPL; + vorbis_info *vi=v->vi; + oggpack_buffer opb; + backend_lookup_state *b=v->backend_state; + + if(!b){ + ret=OV_EFAULT; + goto err_out; + } + + /* first header packet **********************************************/ + + oggpack_writeinit(&opb); + if(_vorbis_pack_info(&opb,vi))goto err_out; + + /* build the packet */ + if(b->header)_ogg_free(b->header); + b->header=_ogg_malloc(oggpack_bytes(&opb)); + memcpy(b->header,opb.buffer,oggpack_bytes(&opb)); + op->packet=b->header; + op->bytes=oggpack_bytes(&opb); + op->b_o_s=1; + op->e_o_s=0; + op->granulepos=0; + + /* second header packet (comments) **********************************/ + + oggpack_reset(&opb); + if(_vorbis_pack_comment(&opb,vc))goto err_out; + + if(b->header1)_ogg_free(b->header1); + b->header1=_ogg_malloc(oggpack_bytes(&opb)); + memcpy(b->header1,opb.buffer,oggpack_bytes(&opb)); + op_comm->packet=b->header1; + op_comm->bytes=oggpack_bytes(&opb); + op_comm->b_o_s=0; + op_comm->e_o_s=0; + op_comm->granulepos=0; + + /* third header packet (modes/codebooks) ****************************/ + + oggpack_reset(&opb); + if(_vorbis_pack_books(&opb,vi))goto err_out; + + if(b->header2)_ogg_free(b->header2); + b->header2=_ogg_malloc(oggpack_bytes(&opb)); + memcpy(b->header2,opb.buffer,oggpack_bytes(&opb)); + op_code->packet=b->header2; + op_code->bytes=oggpack_bytes(&opb); + op_code->b_o_s=0; + op_code->e_o_s=0; + op_code->granulepos=0; + + oggpack_writeclear(&opb); + return(0); + err_out: + oggpack_writeclear(&opb); + memset(op,0,sizeof(*op)); + memset(op_comm,0,sizeof(*op_comm)); + memset(op_code,0,sizeof(*op_code)); + + if(b->header)_ogg_free(b->header); + if(b->header1)_ogg_free(b->header1); + if(b->header2)_ogg_free(b->header2); + b->header=NULL; + b->header1=NULL; + b->header2=NULL; + return(ret); +} + diff --git a/lib/mapping0.c b/lib/mapping0.c new file mode 100644 index 00000000..2e67f132 --- /dev/null +++ b/lib/mapping0.c @@ -0,0 +1,739 @@ +/******************************************************************** + * * + * 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: channel mapping 0 implementation + last mod: $Id: mapping0.c,v 1.43.2.1 2002/01/01 02:27:23 xiphmont Exp $ + + ********************************************************************/ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <math.h> +#include <ogg/ogg.h> +#include "vorbis/codec.h" +#include "codec_internal.h" +#include "codebook.h" +#include "registry.h" +#include "psy.h" +#include "misc.h" + +/* simplistic, wasteful way of doing this (unique lookup for each + mode/submapping); there should be a central repository for + identical lookups. That will require minor work, so I'm putting it + off as low priority. + + Why a lookup for each backend in a given mode? Because the + blocksize is set by the mode, and low backend lookups may require + parameters from other areas of the mode/mapping */ + +extern int analysis_noisy; + +typedef struct { + drft_lookup fft_look; + vorbis_info_mode *mode; + vorbis_info_mapping0 *map; + + vorbis_look_time **time_look; + vorbis_look_floor **floor_look; + + vorbis_look_residue **residue_look; + vorbis_look_psy *psy_look[2]; + + vorbis_func_time **time_func; + vorbis_func_floor **floor_func; + vorbis_func_residue **residue_func; + + int ch; + long lastframe; /* if a different mode is called, we need to + invalidate decay */ +} vorbis_look_mapping0; + +static vorbis_info_mapping *mapping0_copy_info(vorbis_info_mapping *vm){ + vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)vm; + vorbis_info_mapping0 *ret=_ogg_malloc(sizeof(*ret)); + memcpy(ret,info,sizeof(*ret)); + return(ret); +} + +static void mapping0_free_info(vorbis_info_mapping *i){ + vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)i; + if(info){ + memset(info,0,sizeof(*info)); + _ogg_free(info); + } +} + +static void mapping0_free_look(vorbis_look_mapping *look){ + int i; + vorbis_look_mapping0 *l=(vorbis_look_mapping0 *)look; + if(l){ + drft_clear(&l->fft_look); + + for(i=0;i<l->map->submaps;i++){ + l->time_func[i]->free_look(l->time_look[i]); + l->floor_func[i]->free_look(l->floor_look[i]); + l->residue_func[i]->free_look(l->residue_look[i]); + } + if(l->psy_look[1] && l->psy_look[1]!=l->psy_look[0]){ + _vp_psy_clear(l->psy_look[1]); + _ogg_free(l->psy_look[1]); + } + if(l->psy_look[0]){ + _vp_psy_clear(l->psy_look[0]); + _ogg_free(l->psy_look[0]); + } + _ogg_free(l->time_func); + _ogg_free(l->floor_func); + _ogg_free(l->residue_func); + _ogg_free(l->time_look); + _ogg_free(l->floor_look); + _ogg_free(l->residue_look); + memset(l,0,sizeof(*l)); + _ogg_free(l); + } +} + +static vorbis_look_mapping *mapping0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm, + vorbis_info_mapping *m){ + int i; + vorbis_info *vi=vd->vi; + codec_setup_info *ci=vi->codec_setup; + vorbis_look_mapping0 *look=_ogg_calloc(1,sizeof(*look)); + vorbis_info_mapping0 *info=look->map=(vorbis_info_mapping0 *)m; + look->mode=vm; + + look->time_look=_ogg_calloc(info->submaps,sizeof(*look->time_look)); + look->floor_look=_ogg_calloc(info->submaps,sizeof(*look->floor_look)); + + look->residue_look=_ogg_calloc(info->submaps,sizeof(*look->residue_look)); + + look->time_func=_ogg_calloc(info->submaps,sizeof(*look->time_func)); + look->floor_func=_ogg_calloc(info->submaps,sizeof(*look->floor_func)); + look->residue_func=_ogg_calloc(info->submaps,sizeof(*look->residue_func)); + + for(i=0;i<info->submaps;i++){ + int timenum=info->timesubmap[i]; + int floornum=info->floorsubmap[i]; + int resnum=info->residuesubmap[i]; + + look->time_func[i]=_time_P[ci->time_type[timenum]]; + look->time_look[i]=look->time_func[i]-> + look(vd,vm,ci->time_param[timenum]); + look->floor_func[i]=_floor_P[ci->floor_type[floornum]]; + look->floor_look[i]=look->floor_func[i]-> + look(vd,vm,ci->floor_param[floornum]); + look->residue_func[i]=_residue_P[ci->residue_type[resnum]]; + look->residue_look[i]=look->residue_func[i]-> + look(vd,vm,ci->residue_param[resnum]); + + } + if(ci->psys && vd->analysisp){ + if(info->psy[0] != info->psy[1]){ + + int psynum=info->psy[0]; + look->psy_look[0]=_ogg_calloc(1,sizeof(*look->psy_look[0])); + _vp_psy_init(look->psy_look[0],ci->psy_param[psynum], + &ci->psy_g_param, + ci->blocksizes[vm->blockflag]/2,vi->rate); + + psynum=info->psy[1]; + look->psy_look[1]=_ogg_calloc(1,sizeof(*look->psy_look[1])); + _vp_psy_init(look->psy_look[1],ci->psy_param[psynum], + &ci->psy_g_param, + ci->blocksizes[vm->blockflag]/2,vi->rate); + }else{ + + int psynum=info->psy[0]; + look->psy_look[0]=_ogg_calloc(1,sizeof(*look->psy_look[0])); + look->psy_look[1]=look->psy_look[0]; + _vp_psy_init(look->psy_look[0],ci->psy_param[psynum], + &ci->psy_g_param, + ci->blocksizes[vm->blockflag]/2,vi->rate); + + } + } + + look->ch=vi->channels; + + if(vd->analysisp)drft_init(&look->fft_look,ci->blocksizes[vm->blockflag]); + return(look); +} + +static int ilog2(unsigned int v){ + int ret=0; + while(v>1){ + ret++; + v>>=1; + } + return(ret); +} + +static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm, + oggpack_buffer *opb){ + int i; + vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)vm; + + /* another 'we meant to do it this way' hack... up to beta 4, we + packed 4 binary zeros here to signify one submapping in use. We + now redefine that to mean four bitflags that indicate use of + deeper features; bit0:submappings, bit1:coupling, + bit2,3:reserved. This is backward compatable with all actual uses + of the beta code. */ + + if(info->submaps>1){ + oggpack_write(opb,1,1); + oggpack_write(opb,info->submaps-1,4); + }else + oggpack_write(opb,0,1); + + if(info->coupling_steps>0){ + oggpack_write(opb,1,1); + oggpack_write(opb,info->coupling_steps-1,8); + + for(i=0;i<info->coupling_steps;i++){ + oggpack_write(opb,info->coupling_mag[i],ilog2(vi->channels)); + oggpack_write(opb,info->coupling_ang[i],ilog2(vi->channels)); + } + }else + oggpack_write(opb,0,1); + + oggpack_write(opb,0,2); /* 2,3:reserved */ + + /* we don't write the channel submappings if we only have one... */ + if(info->submaps>1){ + for(i=0;i<vi->channels;i++) + oggpack_write(opb,info->chmuxlist[i],4); + } + for(i=0;i<info->submaps;i++){ + oggpack_write(opb,info->timesubmap[i],8); + oggpack_write(opb,info->floorsubmap[i],8); + oggpack_write(opb,info->residuesubmap[i],8); + } +} + +/* also responsible for range checking */ +static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){ + int i; + vorbis_info_mapping0 *info=_ogg_calloc(1,sizeof(*info)); + codec_setup_info *ci=vi->codec_setup; + memset(info,0,sizeof(*info)); + + if(oggpack_read(opb,1)) + info->submaps=oggpack_read(opb,4)+1; + else + info->submaps=1; + + if(oggpack_read(opb,1)){ + info->coupling_steps=oggpack_read(opb,8)+1; + + for(i=0;i<info->coupling_steps;i++){ + int testM=info->coupling_mag[i]=oggpack_read(opb,ilog2(vi->channels)); + int testA=info->coupling_ang[i]=oggpack_read(opb,ilog2(vi->channels)); + + if(testM<0 || + testA<0 || + testM==testA || + testM>=vi->channels || + testA>=vi->channels) goto err_out; + } + + } + + if(oggpack_read(opb,2)>0)goto err_out; /* 2,3:reserved */ + + if(info->submaps>1){ + for(i=0;i<vi->channels;i++){ + info->chmuxlist[i]=oggpack_read(opb,4); + if(info->chmuxlist[i]>=info->submaps)goto err_out; + } + } + for(i=0;i<info->submaps;i++){ + info->timesubmap[i]=oggpack_read(opb,8); + if(info->timesubmap[i]>=ci->times)goto err_out; + info->floorsubmap[i]=oggpack_read(opb,8); + if(info->floorsubmap[i]>=ci->floors)goto err_out; + info->residuesubmap[i]=oggpack_read(opb,8); + if(info->residuesubmap[i]>=ci->residues)goto err_out; + } + + return info; + + err_out: + mapping0_free_info(info); + return(NULL); +} + +#include "os.h" +#include "lpc.h" +#include "lsp.h" +#include "envelope.h" +#include "mdct.h" +#include "psy.h" +#include "scales.h" + +/* no time mapping implementation for now */ +static long seq=0; +static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){ + vorbis_dsp_state *vd=vb->vd; + vorbis_info *vi=vd->vi; + codec_setup_info *ci=vi->codec_setup; + backend_lookup_state *b=vb->vd->backend_state; + bitrate_manager_state *bm=&b->bms; + vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l; + vorbis_info_mapping0 *info=look->map; + vorbis_info_mode *mode=look->mode; + vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal; + int n=vb->pcmend; + int i,j; + float *window=b->window[vb->W][vb->lW][vb->nW][mode->windowtype]; + int *nonzero=alloca(sizeof(*nonzero)*vi->channels); + + float *work=_vorbis_block_alloc(vb,n*sizeof(*work)); + + float global_ampmax=vbi->ampmax; + float *local_ampmax=alloca(sizeof(*local_ampmax)*vi->channels); + int blocktype=vbi->blocktype; + + /* we differentiate between short and long block types to help the + masking engine; the window shapes also matter. + impulse block (a short block in which an impulse occurs) + padding block (a short block that pads between a transitional + long block and an impulse block, or vice versa) + transition block (the wqeird one; a long block with the transition + window; affects bass/midrange response and that must be + accounted for in masking) + long block (run of the mill long block) + */ + + for(i=0;i<vi->channels;i++){ + float scale=4.f/n; + float scale_dB; + + /* the following makes things clearer to *me* anyway */ + float *pcm =vb->pcm[i]; + float *fft =work; + float *logfft =pcm+n/2; + + /*float *res =pcm; + float *mdct =pcm; + float *codedflr=pcm+n/2; + float *logmax =work; + float *logmask =work+n/2;*/ + + scale_dB=todB(&scale); + _analysis_output("pcm",seq+i,pcm,n,0,0); + + /* window the PCM data */ + for(j=0;j<n;j++) + fft[j]=pcm[j]*=window[j]; + + /*_analysis_output("windowed",seq+i,pcm,n,0,0);*/ + + /* transform the PCM data */ + /* only MDCT right now.... */ + mdct_forward(b->transform[vb->W][0],pcm,pcm); + + /* FFT yields more accurate tonal estimation (not phase sensitive) */ + drft_forward(&look->fft_look,fft); + fft[0]*=scale; + logfft[0]=todB(fft); + local_ampmax[i]=logfft[0]; + for(j=1;j<n-1;j+=2){ + float temp=fft[j]*fft[j]+fft[j+1]*fft[j+1]; + temp=logfft[(j+1)>>1]=scale_dB+.5f*todB(&temp); + if(temp>local_ampmax[i])local_ampmax[i]=temp; + } + + if(local_ampmax[i]>0.f)local_ampmax[i]=0.f; + if(local_ampmax[i]>global_ampmax)global_ampmax=local_ampmax[i]; + + _analysis_output("fft",seq+i,logfft,n/2,1,0); + } + + for(i=0;i<vi->channels;i++){ + int submap=info->chmuxlist[i]; + + /* the following makes things clearer to *me* anyway */ + float *mdct =vb->pcm[i]; + float *res =mdct; + float *codedflr=mdct+n/2; + float *logfft =mdct+n/2; + + float *logmdct =work; + float *logmax =mdct+n/2; + float *logmask =work+n/2; + + for(j=0;j<n/2;j++) + logmdct[j]=todB(mdct+j); + _analysis_output("mdct",seq+i,logmdct,n/2,1,0); + + + /* perform psychoacoustics; do masking */ + _vp_compute_mask(look->psy_look[blocktype], + logfft, /* -> logmax */ + logmdct, + logmask, + global_ampmax, + local_ampmax[i], + bm->avgnoise); + + _analysis_output("mask",seq+i,logmask,n/2,1,0); + /* perform floor encoding */ + nonzero[i]=look->floor_func[submap]-> + forward(vb,look->floor_look[submap], + mdct, + logmdct, + logmask, + logmax, + + codedflr); + + + _vp_remove_floor(look->psy_look[blocktype], + mdct, + codedflr, + res); + + /*for(j=0;j<n/2;j++) + if(fabs(res[j])>1200){ + analysis_noisy=1; + fprintf(stderr,"%ld ",seq+i); + }*/ + + _analysis_output("codedflr",seq+i,codedflr,n/2,1,1); + + } + + vbi->ampmax=global_ampmax; + + /* partition based prequantization and channel coupling */ + /* Steps in prequant and coupling: + + down-couple/down-quantize from perfect residue -> quantized vector + + classify by |mag| of perfect res and |mag| of quant + across all pcm vectors + + do{ + encode quantized vector; add encoded values to 'so-far' vector + more? [not yet at bitrate/not yet at target] + yes{ + down-couple/down-quantize from perfect-'so-far' -> + quantized vector; when subtracting coupling, + account for +/- out-of-phase component + }no{ + break + } + } + done. + + quantization in each iteration is done (after circular normalization + in coupling) using a by-iteration quantization granule value. + */ + + { + float **pcm=vb->pcm; + float **quantized=alloca(sizeof(*quantized)*vi->channels); + float **sofar=alloca(sizeof(*sofar)*vi->channels); + + long ***classifications=alloca(sizeof(*classifications)*info->submaps); + float ***qbundle=alloca(sizeof(*qbundle)*info->submaps); + float ***pcmbundle=alloca(sizeof(*pcmbundle)*info->submaps); + float ***sobundle=alloca(sizeof(*sobundle)*info->submaps); + int **zerobundle=alloca(sizeof(*zerobundle)*info->submaps); + int *chbundle=alloca(sizeof(*chbundle)*info->submaps); + int chcounter=0; + + /* play a little loose with this abstraction */ + int quant_passes=ci->coupling_passes; + + for(i=0;i<vi->channels;i++){ + quantized[i]=_vorbis_block_alloc(vb,n*sizeof(*sofar[i])); + sofar[i]=quantized[i]+n/2; + memset(sofar[i],0,sizeof(*sofar[i])*n/2); + } + + qbundle[0]=alloca(sizeof(*qbundle[0])*vi->channels); + pcmbundle[0]=alloca(sizeof(*pcmbundle[0])*vi->channels); + sobundle[0]=alloca(sizeof(*sobundle[0])*vi->channels); + zerobundle[0]=alloca(sizeof(*zerobundle[0])*vi->channels); + + /* initial down-quantized coupling */ + + /* this assumes all or nothing coupling right now. it should pass + through any channels left uncoupled, but it doesn't do that now */ + if(info->coupling_steps==0){ + for(i=0;i<vi->channels;i++){ + float *lpcm=pcm[i]; + float *lqua=quantized[i]; + for(j=0;j<n/2;j++) + lqua[j]=lpcm[j]; + } + }else{ + _vp_quantize_couple(look->psy_look[blocktype], + info, + pcm, + sofar, + quantized, + nonzero, + 0); + } + + for(i=0;i<vi->channels;i++) + _analysis_output("quant",seq+i,quantized[i],n/2,1,0); + + /* classify, by submap */ + + for(i=0;i<info->submaps;i++){ + int ch_in_bundle=0; + qbundle[i]=qbundle[0]+chcounter; + sobundle[i]=sobundle[0]+chcounter; + zerobundle[i]=zerobundle[0]+chcounter; + + for(j=0;j<vi->channels;j++){ + if(info->chmuxlist[j]==i){ + if(nonzero[j]) + zerobundle[i][ch_in_bundle]=1; + else + zerobundle[i][ch_in_bundle]=0; + qbundle[i][ch_in_bundle]=quantized[j]; + pcmbundle[i][ch_in_bundle]=pcm[j]; + sobundle[i][ch_in_bundle++]=sofar[j]; + } + } + chbundle[i]=ch_in_bundle; + chcounter+=ch_in_bundle; + + classifications[i]=look->residue_func[i]-> + class(vb,look->residue_look[i],pcmbundle[i],qbundle[i], + zerobundle[i],chbundle[i]); + } + + for(i=0;i<vi->channels;i++) + _analysis_output("nquant",seq+i,quantized[i],n/2,1,0); + + + /* actual encoding loop; we pack all the iterations to collect + management data */ + + for(i=0;i<quant_passes;){ + + /* perform residue encoding of this pass's quantized residue + vector, according residue mapping */ + + for(j=0;j<info->submaps;j++){ + look->residue_func[j]-> + forward(vb,look->residue_look[j], + qbundle[j],sobundle[j],zerobundle[j],chbundle[j], + i,classifications[j],vbi->packet_markers); + + } + i++; + +#ifdef TRAIN_RES + /* this is sanity checking *highly specific* to current encoder + convention. This is only to be enabled during training data + collection and testing */ + + /* first pass: normal unit-encode, second pass is stereo + backfill (unit encode), third pass is 1/3 encode, fourth is + 1/9 encode. No submaps. */ + for(j=0;j<vi->channels;j++){ + int k; + for(k=0;k<n/2;k++){ + switch(i){ + case 1:case 2: + if(fabs(quantized[j][k])>.5) + fprintf(stderr,">>>%d+%d:%d/%d(%f) ",seq+j,i,j,k,quantized[j][k]); + break; + case 3: + if(fabs(quantized[j][k])>.1667) + fprintf(stderr,">>>%d+%d:%d/%d(%f) ",seq+j,i,j,k,quantized[j][k]); + break; + case 4: + if(fabs(quantized[j][k])>.0556) + fprintf(stderr,">>>%d+%d:%d/%d(%f) ",seq+j,i,j,k,quantized[j][k]); + break; + } + } + } + + +#endif + + + if(i<quant_passes){ + /* down-couple/down-quantize from perfect-'so-far' -> + new quantized vector */ + if(info->coupling_steps==0){ + /* this assumes all or nothing coupling right now. it should pass + through any channels left uncoupled, but it doesn't do that now */ + int k; + for(k=0;k<vi->channels;k++){ + float *lpcm=pcm[k]; + float *lsof=sofar[k]; + float *lqua=quantized[k]; + for(j=0;j<n/2;j++) + lqua[j]=lpcm[j]-lsof[j]; + } + }else{ + + _vp_quantize_couple(look->psy_look[blocktype], + info, + pcm, + sofar, + quantized, + nonzero, + i); + } + } + } + seq+=vi->channels; + } + + look->lastframe=vb->sequence; + return(0); +} + +static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){ + vorbis_dsp_state *vd=vb->vd; + vorbis_info *vi=vd->vi; + codec_setup_info *ci=vi->codec_setup; + backend_lookup_state *b=vd->backend_state; + vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l; + vorbis_info_mapping0 *info=look->map; + vorbis_info_mode *mode=look->mode; + int i,j; + long n=vb->pcmend=ci->blocksizes[vb->W]; + + float *window=b->window[vb->W][vb->lW][vb->nW][mode->windowtype]; + float **pcmbundle=alloca(sizeof(*pcmbundle)*vi->channels); + int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels); + + int *nonzero =alloca(sizeof(*nonzero)*vi->channels); + void **floormemo=alloca(sizeof(*floormemo)*vi->channels); + + /* time domain information decode (note that applying the + information would have to happen later; we'll probably add a + function entry to the harness for that later */ + /* NOT IMPLEMENTED */ + + /* recover the spectral envelope; store it in the PCM vector for now */ + for(i=0;i<vi->channels;i++){ + int submap=info->chmuxlist[i]; + floormemo[i]=look->floor_func[submap]-> + inverse1(vb,look->floor_look[submap]); + if(floormemo[i]) + nonzero[i]=1; + else + nonzero[i]=0; + memset(vb->pcm[i],0,sizeof(*vb->pcm[i])*n/2); + } + + /* channel coupling can 'dirty' the nonzero listing */ + for(i=0;i<info->coupling_steps;i++){ + if(nonzero[info->coupling_mag[i]] || + nonzero[info->coupling_ang[i]]){ + nonzero[info->coupling_mag[i]]=1; + nonzero[info->coupling_ang[i]]=1; + } + } + + /* recover the residue into our working vectors */ + for(i=0;i<info->submaps;i++){ + int ch_in_bundle=0; + for(j=0;j<vi->channels;j++){ + if(info->chmuxlist[j]==i){ + if(nonzero[j]) + zerobundle[ch_in_bundle]=1; + else + zerobundle[ch_in_bundle]=0; + pcmbundle[ch_in_bundle++]=vb->pcm[j]; + } + } + + look->residue_func[i]->inverse(vb,look->residue_look[i], + pcmbundle,zerobundle,ch_in_bundle); + } + + /* channel coupling */ + for(i=info->coupling_steps-1;i>=0;i--){ + float *pcmM=vb->pcm[info->coupling_mag[i]]; + float *pcmA=vb->pcm[info->coupling_ang[i]]; + + for(j=0;j<n/2;j++){ + float mag=pcmM[j]; + float ang=pcmA[j]; + + if(mag>0) + if(ang>0){ + pcmM[j]=mag; + pcmA[j]=mag-ang; + }else{ + pcmA[j]=mag; + pcmM[j]=mag+ang; + } + else + if(ang>0){ + pcmM[j]=mag; + pcmA[j]=mag+ang; + }else{ + pcmA[j]=mag; + pcmM[j]=mag-ang; + } + } + } + + /* compute and apply spectral envelope */ + for(i=0;i<vi->channels;i++){ + float *pcm=vb->pcm[i]; + int submap=info->chmuxlist[i]; + look->floor_func[submap]-> + inverse2(vb,look->floor_look[submap],floormemo[i],pcm); + _analysis_output("final",seq++,pcm,n/2,1,1); + } + + /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */ + /* only MDCT right now.... */ + for(i=0;i<vi->channels;i++){ + float *pcm=vb->pcm[i]; + mdct_backward(b->transform[vb->W][0],pcm,pcm); + } + + /* window the data */ + for(i=0;i<vi->channels;i++){ + float *pcm=vb->pcm[i]; + if(nonzero[i]) + for(j=0;j<n;j++) + pcm[j]*=window[j]; + else + for(j=0;j<n;j++) + pcm[j]=0.f; + + } + + /* all done! */ + return(0); +} + +/* export hooks */ +vorbis_func_mapping mapping0_exportbundle={ + &mapping0_pack, + &mapping0_unpack, + &mapping0_look, + &mapping0_copy_info, + &mapping0_free_info, + &mapping0_free_look, + &mapping0_forward, + &mapping0_inverse +}; diff --git a/lib/modes/floor_44.h b/lib/modes/floor_44.h new file mode 100644 index 00000000..74109665 --- /dev/null +++ b/lib/modes/floor_44.h @@ -0,0 +1,226 @@ +/******************************************************************** + * * + * 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: key floor settings for 44.1/48kHz + last mod: $Id: floor_44.h,v 1.2.4.1 2002/01/01 02:27:42 xiphmont Exp $ + + ********************************************************************/ + +#include "vorbis/codec.h" +#include "backends.h" + +#include "books/floor/line_128x7_class1.vqh" +#include "books/floor/line_128x7_class2.vqh" + +#include "books/floor/line_128x7_0sub0.vqh" +#include "books/floor/line_128x7_1sub1.vqh" +#include "books/floor/line_128x7_1sub2.vqh" +#include "books/floor/line_128x7_1sub3.vqh" +#include "books/floor/line_128x7_2sub1.vqh" +#include "books/floor/line_128x7_2sub2.vqh" +#include "books/floor/line_128x7_2sub3.vqh" + +#include "books/floor/line_128x9_class1.vqh" +#include "books/floor/line_128x9_class2.vqh" + +#include "books/floor/line_128x9_0sub0.vqh" +#include "books/floor/line_128x9_1sub1.vqh" +#include "books/floor/line_128x9_1sub2.vqh" +#include "books/floor/line_128x9_1sub3.vqh" +#include "books/floor/line_128x9_2sub1.vqh" +#include "books/floor/line_128x9_2sub2.vqh" +#include "books/floor/line_128x9_2sub3.vqh" + +#include "books/floor/line_128x19_class1.vqh" +#include "books/floor/line_128x19_class2.vqh" + +#include "books/floor/line_128x19_0sub0.vqh" +#include "books/floor/line_128x19_1sub1.vqh" +#include "books/floor/line_128x19_1sub2.vqh" +#include "books/floor/line_128x19_1sub3.vqh" +#include "books/floor/line_128x19_2sub1.vqh" +#include "books/floor/line_128x19_2sub2.vqh" +#include "books/floor/line_128x19_2sub3.vqh" + +#include "books/floor/line_1024x19_class0.vqh" +#include "books/floor/line_1024x19_class1.vqh" +#include "books/floor/line_1024x19_class2.vqh" + +#include "books/floor/line_1024x19_0sub0.vqh" +#include "books/floor/line_1024x19_0sub1.vqh" +#include "books/floor/line_1024x19_1sub1.vqh" +#include "books/floor/line_1024x19_1sub2.vqh" +#include "books/floor/line_1024x19_1sub3.vqh" +#include "books/floor/line_1024x19_2sub1.vqh" +#include "books/floor/line_1024x19_2sub2.vqh" +#include "books/floor/line_1024x19_2sub3.vqh" + +#include "books/floor/line_1024x31_class0.vqh" +#include "books/floor/line_1024x31_class1.vqh" +#include "books/floor/line_1024x31_class2.vqh" +#include "books/floor/line_1024x31_class3.vqh" + +#include "books/floor/line_1024x31_0sub0.vqh" +#include "books/floor/line_1024x31_0sub1.vqh" +#include "books/floor/line_1024x31_1sub0.vqh" +#include "books/floor/line_1024x31_1sub1.vqh" +#include "books/floor/line_1024x31_2sub1.vqh" +#include "books/floor/line_1024x31_2sub2.vqh" +#include "books/floor/line_1024x31_2sub3.vqh" +#include "books/floor/line_1024x31_3sub1.vqh" +#include "books/floor/line_1024x31_3sub2.vqh" +#include "books/floor/line_1024x31_3sub3.vqh" + +static static_codebook *_floor_44_128x7_books[]={ + &_huff_book_line_128x7_class1, + &_huff_book_line_128x7_class2, + + &_huff_book_line_128x7_0sub0, + &_huff_book_line_128x7_1sub1, + &_huff_book_line_128x7_1sub2, + &_huff_book_line_128x7_1sub3, + &_huff_book_line_128x7_2sub1, + &_huff_book_line_128x7_2sub2, + &_huff_book_line_128x7_2sub3, +}; +static static_codebook *_floor_44_128x9_books[]={ + &_huff_book_line_128x9_class1, + &_huff_book_line_128x9_class2, + + &_huff_book_line_128x9_0sub0, + &_huff_book_line_128x9_1sub1, + &_huff_book_line_128x9_1sub2, + &_huff_book_line_128x9_1sub3, + &_huff_book_line_128x9_2sub1, + &_huff_book_line_128x9_2sub2, + &_huff_book_line_128x9_2sub3, +}; +static static_codebook *_floor_44_128x19_books[]={ + &_huff_book_line_128x19_class1, + &_huff_book_line_128x19_class2, + + &_huff_book_line_128x19_0sub0, + &_huff_book_line_128x19_1sub1, + &_huff_book_line_128x19_1sub2, + &_huff_book_line_128x19_1sub3, + &_huff_book_line_128x19_2sub1, + &_huff_book_line_128x19_2sub2, + &_huff_book_line_128x19_2sub3, +}; + +static static_codebook **_floor_44_128_books[3]={ + _floor_44_128x7_books, + _floor_44_128x9_books, + _floor_44_128x19_books, +}; + +static static_codebook *_floor_44_1024x19_books[]={ + &_huff_book_line_1024x19_class0, + &_huff_book_line_1024x19_class1, + &_huff_book_line_1024x19_class2, + + &_huff_book_line_1024x19_0sub0, + &_huff_book_line_1024x19_0sub1, + &_huff_book_line_1024x19_1sub1, + &_huff_book_line_1024x19_1sub2, + &_huff_book_line_1024x19_1sub3, + &_huff_book_line_1024x19_2sub1, + &_huff_book_line_1024x19_2sub2, + &_huff_book_line_1024x19_2sub3, +}; +static static_codebook *_floor_44_1024x31_books[]={ + &_huff_book_line_1024x31_class0, + &_huff_book_line_1024x31_class1, + &_huff_book_line_1024x31_class2, + &_huff_book_line_1024x31_class3, + + &_huff_book_line_1024x31_0sub0, + &_huff_book_line_1024x31_0sub1, + &_huff_book_line_1024x31_1sub0, + &_huff_book_line_1024x31_1sub1, + &_huff_book_line_1024x31_2sub1, + &_huff_book_line_1024x31_2sub2, + &_huff_book_line_1024x31_2sub3, + &_huff_book_line_1024x31_3sub1, + &_huff_book_line_1024x31_3sub2, + &_huff_book_line_1024x31_3sub3, +}; + +static static_codebook **_floor_44_1024_books[2]={ + _floor_44_1024x19_books, + _floor_44_1024x31_books +}; + +static vorbis_info_floor1 _floor_44_128[3]={ + { + 3,{0,1,2},{1,3,3},{0,2,2},{-1,0,1}, + {{2},{-1,3,4,5},{-1,6,7,8}}, + 4,{0,128, 7, 2,1,4, 23,13,45}, + + 60,30,500, + 999,999,0,18., + 8,70, + -1 /* lowpass! */ + }, + + { + 3,{0,1,2},{1,4,4},{0,2,2},{-1,0,1}, + {{2},{-1,3,4,5},{-1,6,7,8}}, + 4,{0,128, 13, 4,2,7,1, 44,30,62,20}, + + 60,30,500, + 999,999,0,18., + 8,70, + -1 /* lowpass! */ + }, + + + { + 6,{0,1,1,1,2,2},{4,3,3},{0,2,2},{-1,0,1}, + {{2},{-1,3,4,5},{-1,6,7,8}}, + 2,{0,128, 6,17,30,58, 2,1,4, 11,8,14, 23,20,26, 41,35,48, 84,69,103}, + + 60,30,500, + 999,999,1,18., + 8,70, + -1 /* lowpass */ + } +}; + +static vorbis_info_floor1 _floor_44_1024[2]={ + { + 6,{0,1,1, 2,2,2},{4,3,3},{1,2,2},{0,1,2}, + {{3,4},{-1,5,6,7},{-1,8,9,10}}, + 2,{0,1024, + + 32,112,211,387, + + 8,4,16, 64,48,88, 162,136,185, 282,243,329, 553,460,672}, + + 60,30,400, + 20,8,1,18., + 20,600, + -1 /* lowpass */ + }, + { + 10,{0,1,2,2,2,2,2, 3,3,3},{3,4,3,3},{1,1,2,2},{0,1,2,3}, + {{4,5},{6,7},{-1,8,9,10},{-1,11,12,13}}, + 2,{0,1024, 88,31,243, 14,54,143,460, 6,3,10, 22,18,26, 41,36,47, + 69,61,78, 112,99,126, 185,162,211, 329,282,387, 672,553,825}, + + 60,30,400, + 20,8,1,18., + 20,600, + -1 /* lowpass */ + } +}; + diff --git a/lib/modes/psych_44.h b/lib/modes/psych_44.h index 5f1ff981..9e8f7fa0 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.7.2.1 2001/12/27 08:07:30 xiphmont Exp $ + last mod: $Id: psych_44.h,v 1.7.2.2 2002/01/01 02:27:42 xiphmont Exp $ ********************************************************************/ @@ -21,19 +21,25 @@ static vorbis_info_psy_global _psy_global_44[3]={ {8, /* lines per eighth octave */ - /*{990.f,990.f,990.f,990.f}, {-990.f,-990.f,-990.f,-990.f}, -90.f, - {0.f,0.f,0.f,0.f}, {-0.f,-0.f,-0.f,-0.f}, -90.f,*/ + //{990.f,990.f,990.f,990.f}, {-990.f,-990.f,-990.f,-990.f}, -90.f, + //{0.f,0.f,0.f,0.f}, {-0.f,-0.f,-0.f,-0.f}, -90.f, {30.f,30.f,30.f,34.f}, {-990.f,-990.f,-990.f,-990.f}, -90.f, - -6.f, 0, + -6.f, + 1,.2,1.4, + 0, }, {8, /* lines per eighth octave */ /*{990.f,990.f,990.f,990.f}, {-990.f,-990.f,-990.f,-990.f}, -90.f,*/ {26.f,26.f,26.f,30.f}, {-90.f,-90.f,-90.f,-90.f}, -90.f, - -6.f, 0, + -6.f, + 0,0.,0., + 0, }, {8, /* lines per eighth octave */ {26.f,26.f,26.f,30.f}, {-26.f,-26.f,-26.f,-30.f}, -90.f, - -6.f, 0, + -6.f, + 0,0.,0., + 0, } }; @@ -75,12 +81,11 @@ static float _psy_compand_44[3][NOISE_COMPAND_LEVELS]={ 24.f,25.f,26.f,27.f,28.f,29.f,30.f, 31.f, /* 31dB */ 32.f,33.f,34.f,35.f,36.f,37.f,38.f, 39.f, /* 39dB */ }, - /* mode_Z nominal */ { 0.f, 1.f, 2.f, 3.f, 4.f, 5.f, 6.f, 7.f, /* 7dB */ - 8.f, 9.f,10.f,11.f,12.f,12.f,13.f, 13.f, /* 15dB */ - 13.f,14.f,14.f,14.f,15.f,15.f,15.f, 15.f, /* 23dB */ - 16.f,16.f,17.f,17.f,17.f,18.f,18.f, 19.f, /* 31dB */ + 8.f, 9.f,10.f,11.f,12.f,13.f,12.f, 12.f, /* 15dB */ + 11.f,11.f,10.f,10.f,11.f,12.f,13.f, 14.f, /* 23dB */ + 15.f,15.f,16.f,16.f,17.f,17.f,18.f, 18.f, /* 31dB */ 19.f,19.f,20.f,21.f,22.f,23.f,24.f, 25.f, /* 39dB */ }, /* mode A */ @@ -103,10 +108,10 @@ static vp_adjblock _vp_tonemask_adj_longblock[6]={ { 10, 10, 5, }, { 10, 10, 5, }, /* 250 */ { 10, 10, 5, }, - { 10, 10, 5, }, /* 500 */ - { 10, 10, 5, }, - { 0, }, /* 1000 */ - { 0, }, + { 10, 10, 5, 5, 5, 3, 3, 3, 3, 3, }, /* 500*/ + { 10, 10, 5, 5, 5, 3, 3, 3, 3, 3, }, + { 10, 10, 5, 5, 5, 3, 3, 3, 3, 3, }, /* 1000*/ + { 10, 10, 5, 5, 5, 5, 5, 5, 5, 5, 5}, { 13, 13, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /* 2000 */ { 13, 13, 10, 10, 10, 10, 10, 10, 10, 10, 10}, @@ -236,10 +241,10 @@ static vp_adjblock _vp_tonemask_adj_otherblock[6]={ { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, /*250*/ { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, { 5, 5, 5, 0, -5, -5, -5, -5, -5, -5, -5}, /*500*/ - { 5, 5, 5, 0, -5, -5, -5, -5, -5, -5, -5}, + { 5, 5, 5, }, - { 5, 5, 5, }, /*1000*/ - { 5, 5, 5, }, + { 10, 10, 5, 5, 5, }, /*1000*/ + { 10, 10, 5, 5, 5, 5, 5, 5, 5, 5, 5}, { 13, 13, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /* 2000 */ { 13, 13, 10, 10, 10, 10, 10, 10, 10, 10, 10}, @@ -410,10 +415,10 @@ static vp_adjblock _vp_peakguard[6]={ {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*63*/ {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40}, {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*125*/ - {-14,-20,-20,-20,-20,-20,-20,-30,-32,-32,-40}, - {-14,-20,-20,-20,-20,-20,-20,-30,-32,-32,-40},/*250*/ - {-14,-20,-20,-20,-20,-20,-20,-24,-32,-32,-40}, - {-14,-20,-20,-20,-20,-20,-20,-24,-32,-32,-40},/*500*/ + {-14,-20,-20,-20,-26,-30,-30,-30,-32,-32,-40}, + {-14,-20,-20,-20,-26,-30,-30,-30,-32,-32,-40},/*250*/ + {-14,-20,-20,-20,-26,-30,-30,-30,-32,-32,-40}, + {-14,-20,-20,-20,-26,-30,-30,-30,-32,-32,-40},/*500*/ {-10,-10,-10,-10,-14,-16,-20,-24,-26,-32,-40}, {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40},/*1000*/ {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40}, @@ -489,7 +494,7 @@ static vp_adjblock _vp_peakguard[6]={ static int _psy_noisebias_long[11][17]={ /*63 125 250 500 1k 2k 4k 8k 16k*/ - {-20,-20,-20,-20,-20,-18,-16, -8, -6, -2, 2, 2, 3, 3, 4, 4, 10}, + {-20,-20,-20,-20,-20,-18,-16, -8, -6, -2, 0, 2, 2, 5, 5, 6, 12}, {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -2, -2, 1, 1, 2, 2, 4}, {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, -1, -1, 0, 1, 2}, {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, -1, -1, 0, 1, 2}, @@ -523,7 +528,7 @@ static int _psy_noisebias_impulse[11][17]={ static int _psy_noisebias_other[11][17]={ /*63 125 250 500 1k 2k 4k 8k 16k*/ - {-26,-26,-26,-26,-26,-22,-18,-12, -6, -2, 2, 2, 3, 3, 4, 4, 10}, + {-26,-26,-26,-26,-26,-22,-18,-12, -6, -2, 0, 2, 2, 5, 5, 6, 12}, {-26,-26,-26,-26,-26,-22,-20,-14,-10, -2, -2, -2, 1, 1, 2, 2, 4}, {-30,-30,-30,-30,-26,-22,-20,-14,-10, -2, -3, -3, -1, -1, 0, 1, 2}, {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -1, -1, 0, 1, 2}, @@ -539,7 +544,7 @@ static int _psy_noisebias_other[11][17]={ }; static int _psy_noiseguards_short[33]={ - 2,2,-1, + 4,4,-1, 4,4,-1, 4,4,15, 4,4,15, @@ -592,7 +597,7 @@ static int _psy_ehmer_bandlimit[11]={ static vorbis_info_psy _psy_info_template={ {-1},-110.,-140., /* tonemask att,guard,suppr,curves peakattp,curvelimitp,peaksettings*/ - 0.f, -40.f,-40.f, {{{0.}}}, 1, 0, {{{0.}}}, + 0.f, -40.f,-40.f, {{{0.}}}, 1, 0, {{{0.}}}, /*noisemaskp,supp, low/high window, low/hi guard, minimum */ 1, -0.f, .5f, .5f, 0,0,0, diff --git a/lib/modes/residue_44.h b/lib/modes/residue_44.h new file mode 100644 index 00000000..4c59abb1 --- /dev/null +++ b/lib/modes/residue_44.h @@ -0,0 +1,1401 @@ +/******************************************************************** + * * + * 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: toplevel residue templates for 32/44.1/48kHz + last mod: $Id: residue_44.h,v 1.11.2.1 2002/01/01 02:27:43 xiphmont Exp $ + + ********************************************************************/ + +#include "vorbis/codec.h" +#include "backends.h" + +static bitrate_manager_info _bm_default={ + /* progressive coding and bitrate controls */ + 4.,.0, + 2., 0, 0, + 0, 0, + + 4.0,2.3, -9999, .02, + + 3.2,5.0, + 0.,0. +}; + +/***** 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}, + { .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}, + { .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}, + { .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}, + { .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}, + { .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}}, + } + }, +}; + + + + + @@ -11,7 +11,7 @@ ******************************************************************** function: psychoacoustics not including preecho - last mod: $Id: psy.c,v 1.64.2.1 2001/12/27 08:09:33 xiphmont Exp $ + last mod: $Id: psy.c,v 1.64.2.2 2002/01/01 02:27:24 xiphmont Exp $ ********************************************************************/ @@ -942,7 +942,7 @@ void _vp_quantize_couple(vorbis_look_psy *p, int passno){ int i,j,k,n=p->n; - vorbis_info_psy *info=p->vi; + vorbis_info_psy *info=p->vi; /* perform any requested channel coupling */ for(i=0;i<vi->coupling_steps;i++){ @@ -1013,45 +1013,42 @@ static int apsort(const void *a, const void *b){ } void psy_normalize_noise(vorbis_block *vb,float *pcm,int n){ - /* sort in ascending order */ - int i; - float **index=alloca(n*sizeof(*index)); - float acc=0,qacc=0; - - for(i=0;i<n;i++)index[i]=pcm+i; - qsort(index,n,sizeof(*index),apsort); - - for(i=0;i<n;i++)acc+=fabs(pcm[i]); - for(i=0;i<n;i++){ - float qval=rint(*index[i]); - - if(qval!=0.f){ - qacc+=fabs(qval); - }else{ - if(fabs(*index[i])<.1f)break; - if(*index[i]<0){ - qacc+=1.f; - *index[i]= -1.; + vorbis_dsp_state *vd=vb->vd; + vorbis_info *vi=vd->vi; + codec_setup_info *ci=vi->codec_setup; + highlevel_encode_setup *hi=&ci->hi; + + if(hi->normalize_noise_p){ + /* sort in decending order */ + int i; + float **index=alloca(n*sizeof(*index)); + float acc=0,qacc=0; + + for(i=0;i<n;i++)index[i]=pcm+i; + qsort(index,n,sizeof(*index),apsort); + + for(i=0;i<n;i++)acc+=fabs(pcm[i]); + for(i=0;i<n;i++){ + float qval=rint(*index[i]); + + if(qval!=0.f){ + qacc+=fabs(qval); }else{ - qacc+=1.f; - *index[i]=1.; + if(fabs(*index[i])<hi->normalize_noise_minimum_upgrade)break; + if(*index[i]<0){ + qacc+=hi->normalize_noise_unit_weight; + *index[i]= -1.; + }else{ + qacc+=hi->normalize_noise_unit_weight; + *index[i]= 1.; + } + if(qacc>acc)break; } - if(qacc>acc)break; + + } + for(;i<n;i++){ + *index[i]=0.; } - - } - for(;i<n;i++){ - *index[i]=0.; } - } - - - - - - - - - @@ -11,7 +11,7 @@ ******************************************************************** function: random psychoacoustics (not including preecho) - last mod: $Id: psy.h,v 1.27.2.1 2001/12/27 08:09:33 xiphmont Exp $ + last mod: $Id: psy.h,v 1.27.2.2 2002/01/01 02:27:24 xiphmont Exp $ ********************************************************************/ @@ -92,7 +92,7 @@ typedef struct{ float preecho_minenergy; float ampmax_att_per_sec; - + /* delay caching... how many samples to keep around prior to our current block to aid in analysis? */ int delaycache; @@ -155,6 +155,7 @@ extern void _vp_quantize_couple(vorbis_look_psy *p, int passno); extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd); + extern void psy_normalize_noise(vorbis_block *vb,float *pcm,int n); #endif @@ -162,3 +163,4 @@ extern void psy_normalize_noise(vorbis_block *vb,float *pcm,int n); + diff --git a/lib/res0.c b/lib/res0.c new file mode 100644 index 00000000..f1070be0 --- /dev/null +++ b/lib/res0.c @@ -0,0 +1,955 @@ +/******************************************************************** + * * + * 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.44.2.1 2002/01/01 02:27:24 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" +#include "psy.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]; + long training_bits[8][64]; + float training_max[8][64]; + float training_min[8][64]; + long training_count[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; + vorbis_info_residue0 *info=look->info; + +#ifdef TRAIN_RES + { + int j,k,l; + for(j=0;j<look->parts;j++){ + fprintf(stderr,"partition %d [%ld]: ",j,look->training_count[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); + + for(j=0;j<look->parts;j++){ + int k; + 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->training_bits[k][j]); + acc+=look->training_bits[k][j]; + } + + fprintf(stderr,":: (%ld vals) %1.2fbits/sample\n", + look->training_count[j], + (float)acc/look->training_count[j]); + } + fprintf(stderr,"\n"); +#endif + + + + 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((float)look->parts,(float)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); +} + +/* almost the simplest possible subvector classification; by max + amplitude/position. Assumes forst pass is quantized to unit steps */ + +/* broken out for specific encoding tasks */ + +static int _testhack(float *vec,float *q,int n, + vorbis_look_residue0 *look, + int auxparts,int auxpartnum){ + vorbis_info_residue0 *info=look->info; + int i; + float max=0.f; + + for(i=0;i<n;i++) + if(max<fabs(vec[i]))max=fabs(vec[i]); + + for(i=0;i<auxparts-1;i++) + if(auxpartnum<info->blimit[i] && + max<=info->ampmax[i]) + break; + + return(i); +} + +static int _testhack_stereo_res2(float *vec,float *q,int n, + vorbis_look_residue0 *look, + int auxparts,int auxpartnum){ + vorbis_info_residue0 *info=look->info; + int i; + float max=0.f; + + for(i=0;i<n;i+=2){ + if(max<fabs(vec[i]))max=fabs(vec[i]); + if(max<fabs(vec[i+1]))max=fabs(vec[i+1]); + if(max<fabs(q[i]))max=fabs(q[i]); + } + + for(i=0;i<auxparts-1;i++) + if(auxpartnum<info->blimit[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,float **q,int ch, + int (*classify)(float *,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++){ + + psy_normalize_noise(vb,q[j]+i*samples_per_partition+info->begin, + samples_per_partition); + + partword[j][i]= + classify(in[j]+i*samples_per_partition+info->begin, + q[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,float **q,int ch, + int (*classify)(float *,float *,int, + vorbis_look_residue0 *, + int,int)){ + long i,j,k,l,jj,ll; + 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); + float *qwork=alloca(sizeof(*qwork)*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,jj=j=0,k=0,ll=l=info->begin;i<partvals;i++){ + for(k=0;k<samples_per_partition;k++){ + work[k]=in[j][l]; + qwork[k]=q[j][l]; + j++; + if(j>=ch){ + j=0; + l++; + } + } + + psy_normalize_noise(vb,qwork,samples_per_partition); + + partword[0][i]= + classify(work,qwork,samples_per_partition,look,possible_partitions,i); + + for(k=0;k<samples_per_partition;k++){ + q[jj][ll]=qwork[k]; + jj++; + if(jj>=ch){ + jj=0; + ll++; + } + } + } + +#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]; + 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) + look->phrasebits+=vorbis_book_encode(look->phrasebook,val,&vb->opb); +#ifdef TRAIN_RES + else + fprintf(stderr,"!"); +#endif + + } + } + + /* 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){ + +#ifdef TRAIN_RES + look->training_count[partword[j][i]]+=samples_per_partition; +#endif + } + + 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); + +#ifdef TRAIN_RES + look->postbits+=ret; + look->training_bits[s][partword[j][i]]+=ret; +#endif + } + } + } + } + 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,float **q,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,q,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,float **q,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,q,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,float **q,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,q,used,_testhack_stereo_res2)); + 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 */ + /* update the quantized pcm 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]; + 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 new file mode 100644 index 00000000..3d7316ca --- /dev/null +++ b/lib/vorbisenc.c @@ -0,0 +1,1277 @@ +/******************************************************************** + * * + * 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 programmatic interface for encoder mode setup + last mod: $Id: vorbisenc.c,v 1.33.2.1 2002/01/01 02:27:25 xiphmont Exp $ + + ********************************************************************/ + +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include <stdarg.h> + +#include "vorbis/codec.h" +#include "vorbis/vorbisenc.h" + +#include "codec_internal.h" +#include "registry-api.h" + +#include "os.h" +#include "misc.h" + +/* careful with this; it's using static array sizing to make managing + all the modes a little less annoying. If we use a residue backend + with > 10 partition types, or a different division of iteration, + this needs to be updated. */ +typedef struct { + vorbis_info_residue0 *res[2]; + static_codebook *book_aux[2]; + static_codebook *books_base[5][10][3]; + static_codebook *books_stereo_backfill[5][10]; + static_codebook *books_residue_backfill[5][10][2]; +} vorbis_residue_template; + +static double stereo_threshholds[]={0.5, 2.5, 4.5, 8.5, 16.5}; + +typedef struct vp_adjblock{ + int block[P_BANDS][P_LEVELS]; +} vp_adjblock; + +#include "modes/residue_44.h" +#include "modes/psych_44.h" +#include "modes/floor_44.h" + +/* a few static coder conventions */ +static vorbis_info_time0 _time_dummy={0}; +static vorbis_info_mode _mode_set_short={0,0,0,0}; +static vorbis_info_mode _mode_set_long={1,0,0,1}; + +/* mapping conventions: + only one submap (this would change for efficient 5.1 support for example)*/ +/* Four psychoacoustic profiles are used, one for each blocktype */ +static vorbis_info_mapping0 _mapping_set_short={ + 1, {0,0}, {0}, {0}, {0}, {0,1}, 0,{0},{0}}; +static vorbis_info_mapping0 _mapping_set_long={ + 1, {0,0}, {0}, {1}, {1}, {2,3}, 0,{0},{0}}; + +static int vorbis_encode_toplevel_setup(vorbis_info *vi,int small,int large,int ch,long rate){ + if(vi && vi->codec_setup){ + codec_setup_info *ci=vi->codec_setup; + + vi->version=0; + vi->channels=ch; + vi->rate=rate; + + ci->blocksizes[0]=small; + ci->blocksizes[1]=large; + + /* time mapping hooks are unused in vorbis I */ + ci->times=1; + ci->time_type[0]=0; + ci->time_param[0]=calloc(1,sizeof(_time_dummy)); + memcpy(ci->time_param[0],&_time_dummy,sizeof(_time_dummy)); + + /* by convention, two modes: one for short, one for long blocks. + short block mode uses mapping sero, long block uses mapping 1 */ + ci->modes=2; + ci->mode_param[0]=calloc(1,sizeof(_mode_set_short)); + memcpy(ci->mode_param[0],&_mode_set_short,sizeof(_mode_set_short)); + ci->mode_param[1]=calloc(1,sizeof(_mode_set_long)); + memcpy(ci->mode_param[1],&_mode_set_long,sizeof(_mode_set_long)); + + /* by convention two mappings, both mapping type zero (polyphonic + PCM), first for short, second for long blocks */ + ci->maps=2; + ci->map_type[0]=0; + ci->map_param[0]=calloc(1,sizeof(_mapping_set_short)); + memcpy(ci->map_param[0],&_mapping_set_short,sizeof(_mapping_set_short)); + ci->map_type[1]=0; + ci->map_param[1]=calloc(1,sizeof(_mapping_set_long)); + memcpy(ci->map_param[1],&_mapping_set_long,sizeof(_mapping_set_long)); + + return(0); + } + return(OV_EINVAL); +} + +static int vorbis_encode_floor_setup(vorbis_info *vi,double q,int block, + static_codebook ***books, + vorbis_info_floor1 *in, + ...){ + int x[11],i,k,iq=rint(q*10); + vorbis_info_floor1 *f=calloc(1,sizeof(*f)); + codec_setup_info *ci=vi->codec_setup; + va_list ap; + + va_start(ap,in); + for(i=0;i<11;i++) + x[i]=va_arg(ap,int); + va_end(ap); + + memcpy(f,in+x[iq],sizeof(*f)); + /* fill in the lowpass field, even if it's temporary */ + f->n=ci->blocksizes[block]>>1; + + /* books */ + { + int partitions=f->partitions; + int maxclass=-1; + int maxbook=-1; + for(i=0;i<partitions;i++) + if(f->partitionclass[i]>maxclass)maxclass=f->partitionclass[i]; + for(i=0;i<=maxclass;i++){ + if(f->class_book[i]>maxbook)maxbook=f->class_book[i]; + f->class_book[i]+=ci->books; + for(k=0;k<(1<<f->class_subs[i]);k++){ + if(f->class_subbook[i][k]>maxbook)maxbook=f->class_subbook[i][k]; + if(f->class_subbook[i][k]>=0)f->class_subbook[i][k]+=ci->books; + } + } + + for(i=0;i<=maxbook;i++) + ci->book_param[ci->books++]=books[x[iq]][i]; + } + + /* for now, we're only using floor 1 */ + ci->floor_type[ci->floors]=1; + ci->floor_param[ci->floors]=f; + ci->floors++; + + return(0); +} + +static int vorbis_encode_global_psych_setup(vorbis_info *vi,double q, + vorbis_info_psy_global *in, ...){ + int i,iq=q*10; + double x[11],dq; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy_global *g=&ci->psy_g_param; + va_list ap; + + va_start(ap,in); + for(i=0;i<11;i++) + x[i]=va_arg(ap,double); + va_end(ap); + + if(iq==10){ + iq=9; + dq=1.; + }else{ + dq=q*10.-iq; + } + + memcpy(g,in+(int)x[iq],sizeof(*g)); + + dq=x[iq]*(1.-dq)+x[iq+1]*dq; + iq=(int)dq; + dq-=iq; + if(dq==0 && iq>0){ + iq--; + dq=1.; + } + + /* interpolate the trigger threshholds */ + for(i=0;i<4;i++){ + g->preecho_thresh[i]=in[iq].preecho_thresh[i]*(1.-dq)+in[iq+1].preecho_thresh[i]*dq; + g->postecho_thresh[i]=in[iq].postecho_thresh[i]*(1.-dq)+in[iq+1].postecho_thresh[i]*dq; + } + g->ampmax_att_per_sec=ci->hi.amplitude_track_dBpersec; + return(0); +} + +static int vorbis_encode_psyset_setup(vorbis_info *vi,int block){ + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy *p=ci->psy_param[block]; + + if(block>=ci->psys) + ci->psys=block+1; + if(!p){ + p=calloc(1,sizeof(*p)); + ci->psy_param[block]=p; + } + + memcpy(p,&_psy_info_template,sizeof(*p)); + + return 0; +} + +static int vorbis_encode_tonemask_setup(vorbis_info *vi,double q,int block, + double *att, + double *max, + int *peaklimit_bands, + vp_adjblock *in){ + int i,j,iq; + double dq; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy *p=ci->psy_param[block]; + + iq=q*10; + if(iq==10){ + iq=9; + dq=1.; + }else{ + dq=q*10.-iq; + } + + p->tone_masteratt=att[iq]*(1.-dq)+att[iq+1]*dq; + p->max_curve_dB=max[iq]*(1.-dq)+max[iq+1]*dq; + p->curvelimitp=peaklimit_bands[iq]; + + iq=q*5.; + if(iq==5){ + iq=5; + dq=1.; + }else{ + dq=q*5.-iq; + } + + for(i=0;i<P_BANDS;i++) + for(j=0;j<P_LEVELS;j++) + p->toneatt.block[i][j]=(j<4?4:j)*-10.+ + in[iq].block[i][j]*(1.-dq)+in[iq+1].block[i][j]*dq; + return(0); +} + + +static int vorbis_encode_compand_setup(vorbis_info *vi,double q,int block, + float in[][NOISE_COMPAND_LEVELS], ...){ + int i,iq=q*10; + double x[11],dq; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy *p=ci->psy_param[block]; + va_list ap; + + va_start(ap,in); + for(i=0;i<11;i++) + x[i]=va_arg(ap,double); + va_end(ap); + + if(iq==10){ + iq=9; + dq=1.; + }else{ + dq=q*10.-iq; + } + + dq=x[iq]*(1.-dq)+x[iq+1]*dq; + iq=(int)dq; + dq-=iq; + if(dq==0 && iq>0){ + iq--; + dq=1.; + } + + /* interpolate the compander settings */ + for(i=0;i<NOISE_COMPAND_LEVELS;i++) + p->noisecompand[i]=in[iq][i]*(1.-dq)+in[iq+1][i]*dq; + return(0); +} + +static int vorbis_encode_peak_setup(vorbis_info *vi,double q,int block, + double *guard, + double *suppress, + vp_adjblock *in){ + int i,j,iq; + double dq; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy *p=ci->psy_param[block]; + + iq=q*10; + if(iq==10){ + iq=9; + dq=1.; + }else{ + dq=q*10.-iq; + } + + p->peakattp=1; + p->tone_guard=guard[iq]*(1.-dq)+guard[iq+1]*dq; + p->tone_abs_limit=suppress[iq]*(1.-dq)+suppress[iq+1]*dq; + + iq=q*5.; + if(iq==5){ + iq=5; + dq=1.; + }else{ + dq=q*5.-iq; + } + + for(i=0;i<P_BANDS;i++) + for(j=0;j<P_LEVELS;j++) + p->peakatt.block[i][j]=(j<4?4:j)*-10.+ + in[iq].block[i][j]*(1.-dq)+in[iq+1].block[i][j]*dq; + return(0); +} + +static int vorbis_encode_noisebias_setup(vorbis_info *vi,double q,int block, + double *suppress, + int in[][17],int guard[33]){ + int i,iq=q*10; + double dq; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy *p=ci->psy_param[block]; + + if(iq==10){ + iq=9; + dq=1.; + }else{ + dq=q*10.-iq; + } + + p->noisemaxsupp=suppress[iq]*(1.-dq)+suppress[iq+1]*dq; + p->noisewindowlomin=guard[iq*3]; + p->noisewindowhimin=guard[iq*3+1]; + p->noisewindowfixed=guard[iq*3+2]; + + for(i=0;i<P_BANDS;i++) + p->noiseoff[i]=in[iq][i]*(1.-dq)+in[iq+1][i]*dq; + return(0); +} + +static int vorbis_encode_ath_setup(vorbis_info *vi,double q,int block, + float in[][27], ...){ + int i,iq=q*10; + double x[11],dq; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_psy *p=ci->psy_param[block]; + va_list ap; + + va_start(ap,in); + for(i=0;i<11;i++) + x[i]=va_arg(ap,double); + va_end(ap); + + p->ath_adjatt=ci->hi.ath_floating_dB; + p->ath_maxatt=ci->hi.ath_absolute_dB; + + if(iq==10){ + iq=9; + dq=1.; + }else{ + dq=q*10.-iq; + } + + dq=x[iq]*(1.-dq)+x[iq+1]*dq; + iq=(int)dq; + dq-=iq; + if(dq==0 && iq>0){ + iq--; + dq=1.; + } + + for(i=0;i<27;i++) + p->ath[i]=in[iq][i]*(1.-dq)+in[iq+1][i]*dq; + return(0); +} + + +static int book_dup_or_new(codec_setup_info *ci,static_codebook *book){ + int i; + for(i=0;i<ci->books;i++) + if(ci->book_param[i]==book)return(i); + + return(ci->books++); +} + +static int vorbis_encode_residue_setup(vorbis_info *vi,double q,int block, + int coupled_p, + int stereo_backfill_p, + int residue_backfill_p, + vorbis_residue_template *in, + int point_dB, + double point_kHz){ + + int i,iq=q*10; + int n,k; + int partition_position=0; + int res_position=0; + int iterations=1; + int amplitude_select=0; + + codec_setup_info *ci=vi->codec_setup; + vorbis_info_residue0 *r; + vorbis_info_psy *psy=ci->psy_param[block*2]; + + /* may be re-called due to ctl */ + if(ci->residue_param[block]) + /* free preexisting instance */ + residue_free_info(ci->residue_param[block],ci->residue_type[block]); + + r=ci->residue_param[block]=malloc(sizeof(*r)); + memcpy(r,in[iq].res[block],sizeof(*r)); + if(ci->residues<=block)ci->residues=block+1; + + r->grouping=32; + + /* for uncoupled, we use type 1, else type 2 */ + if(coupled_p){ + ci->residue_type[block]=2; + }else{ + ci->residue_type[block]=1; + } + + switch(ci->residue_type[block]){ + case 1: + n=r->end=ci->blocksizes[block?1:0]>>1; /* to be adjusted by lowpass later */ + partition_position=rint(point_kHz*1000./(vi->rate/2)*n/r->grouping); + res_position=partition_position*r->grouping; + break; + case 2: + n=r->end=(ci->blocksizes[block?1:0]>>1)*vi->channels; /* to be adjusted by lowpass later */ + partition_position=rint(point_kHz*1000./(vi->rate/2)*n/r->grouping); + res_position=partition_position*r->grouping/vi->channels; + break; + } + + for(i=0;i<r->partitions;i++) + if(r->blimit[i]<0)r->blimit[i]=partition_position; + + for(i=0;i<r->partitions;i++) + for(k=0;k<3;k++) + if(in[iq].books_base[point_dB][i][k]) + r->secondstages[i]|=(1<<k); + + ci->passlimit[0]=3; + + if(coupled_p){ + vorbis_info_mapping0 *map=ci->map_param[block]; + + map->coupling_steps=1; + map->coupling_mag[0]=0; + map->coupling_ang[0]=1; + + psy->couple_pass[0].granulem=1.; + psy->couple_pass[0].igranulem=1.; + + psy->couple_pass[0].couple_pass[0].limit=res_position; + psy->couple_pass[0].couple_pass[0].outofphase_redundant_flip_p=1; + psy->couple_pass[0].couple_pass[0].outofphase_requant_limit=9e10; + psy->couple_pass[0].couple_pass[0].amppost_point=0; + psy->couple_pass[0].couple_pass[1].limit=9999; + psy->couple_pass[0].couple_pass[1].outofphase_redundant_flip_p=1; + psy->couple_pass[0].couple_pass[1].outofphase_requant_limit=9e10; + psy->couple_pass[0].couple_pass[1].amppost_point= + stereo_threshholds[point_dB]; + amplitude_select=point_dB; + + if(stereo_backfill_p && amplitude_select){ + memcpy(psy->couple_pass+iterations,psy->couple_pass+iterations-1, + sizeof(*psy->couple_pass)); + 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][i]) + r->secondstages[i]|=8; + amplitude_select=amplitude_select-1; + iterations++; + } + + if(residue_backfill_p){ + memcpy(psy->couple_pass+iterations,psy->couple_pass+iterations-1, + 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)); + ci->passlimit[iterations]=ci->passlimit[iterations-1]+1; + iterations++; + + memcpy(psy->couple_pass+iterations,psy->couple_pass+iterations-1, + 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)); + ci->passlimit[iterations]=ci->passlimit[iterations-1]+1; + iterations++; + } + ci->coupling_passes=iterations; + + }else{ + + if(residue_backfill_p){ + for(i=0;i<r->partitions;i++){ + if(in[iq].books_residue_backfill[0][i][0]) + r->secondstages[i]|=8; + if(in[iq].books_residue_backfill[0][i][1]) + r->secondstages[i]|=16; + } + ci->passlimit[1]=4; + ci->passlimit[2]=5; + ci->coupling_passes=3; + }else + ci->coupling_passes=1; + } + + memcpy(&ci->psy_param[block*2+1]->couple_pass, + &ci->psy_param[block*2]->couple_pass, + sizeof(psy->couple_pass)); + + /* fill in all the books */ + { + int booklist=0,k; + r->groupbook=ci->books; + ci->book_param[ci->books++]=in[iq].book_aux[block]; + for(i=0;i<r->partitions;i++){ + for(k=0;k<3;k++){ + if(in[iq].books_base[point_dB][i][k]){ + int bookid=book_dup_or_new(ci,in[iq].books_base[point_dB][i][k]); + r->booklist[booklist++]=bookid; + ci->book_param[bookid]=in[iq].books_base[point_dB][i][k]; + } + } + if(coupled_p && stereo_backfill_p && point_dB && + in[iq].books_stereo_backfill[point_dB][i]){ + int bookid=book_dup_or_new(ci,in[iq].books_stereo_backfill[point_dB][i]); + r->booklist[booklist++]=bookid; + ci->book_param[bookid]=in[iq].books_stereo_backfill[point_dB][i]; + } + if(residue_backfill_p){ + for(k=0;k<2;k++){ + if(in[iq].books_residue_backfill[amplitude_select][i][k]){ + int bookid=book_dup_or_new(ci,in[iq].books_residue_backfill[amplitude_select][i][k]); + r->booklist[booklist++]=bookid; + ci->book_param[bookid]=in[iq].books_residue_backfill[amplitude_select][i][k]; + } + } + } + } + } + + return(0); +} + +static int vorbis_encode_lowpass_setup(vorbis_info *vi,double q,int block){ + int iq=q*10; + double dq; + double freq; + codec_setup_info *ci=vi->codec_setup; + vorbis_info_floor1 *f=ci->floor_param[block]; + vorbis_info_residue0 *r=ci->residue_param[block]; + int blocksize=ci->blocksizes[block]>>1; + double nyq=vi->rate/2.; + + if(iq==10){ + iq=9; + dq=1.; + }else{ + dq=q*10.-iq; + } + + freq=ci->hi.lowpass_kHz[block]*1000.; + if(freq>vi->rate/2)freq=vi->rate/2; + /* lowpass needs to be set in the floor and the residue. */ + + /* in the floor, the granularity can be very fine; it doesn't alter + the encoding structure, only the samples used to fit the floor + approximation */ + f->n=freq/nyq*blocksize; + + /* in the residue, we're constrained, physically, by partition + boundaries. We still lowpass 'wherever', but we have to round up + 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=(int)((freq/nyq*blocksize*2)/r->grouping+.9)* /* round up only if we're well past */ + r->grouping; + else + r->end=(int)((freq/nyq*blocksize)/r->grouping+.9)* /* round up only if we're well past */ + r->grouping; + return(0); +} + +/* encoders will need to use vorbis_info_init beforehand and call + vorbis_info clear when all done */ + +/* two interfaces; this, more detailed one, and later a convenience + layer on top */ + +/* the final setup call */ +int vorbis_encode_setup_init(vorbis_info *vi){ + int ret=0; + /*long rate=vi->rate;*/ + long channels=vi->channels; + codec_setup_info *ci=vi->codec_setup; + highlevel_encode_setup *hi=&ci->hi; + + if(!hi->impulse_block_p) + /* write over the impulse settings */ + memcpy(&hi->blocktype[0],&hi->blocktype[1],sizeof(hi->blocktype[0])); + + + ret|=vorbis_encode_floor_setup(vi,hi->base_quality_short,0, + _floor_44_128_books,_floor_44_128, + 0,1,1,2,2,2,2,2,2,2,2); + ret|=vorbis_encode_floor_setup(vi,hi->base_quality_long,1, + _floor_44_1024_books,_floor_44_1024, + 0,0,1,1,1,1,1,1,1,1,1); + + ret|=vorbis_encode_global_psych_setup(vi,hi->trigger_quality,_psy_global_44, + 0., 1., 1.5, 2., 2., 2., 2., 2., 2., 2., 2.); + + ret|=vorbis_encode_psyset_setup(vi,0); + ret|=vorbis_encode_psyset_setup(vi,1); + ret|=vorbis_encode_psyset_setup(vi,2); + ret|=vorbis_encode_psyset_setup(vi,3); + + ret|=vorbis_encode_tonemask_setup(vi,hi->blocktype[0].tone_mask_quality,0, + _psy_tone_masteratt,_psy_tone_0dB,_psy_ehmer_bandlimit, + _vp_tonemask_adj_otherblock); + ret|=vorbis_encode_tonemask_setup(vi,hi->blocktype[1].tone_mask_quality,1, + _psy_tone_masteratt,_psy_tone_0dB,_psy_ehmer_bandlimit, + _vp_tonemask_adj_otherblock); + ret|=vorbis_encode_tonemask_setup(vi,hi->blocktype[2].tone_mask_quality,2, + _psy_tone_masteratt,_psy_tone_0dB,_psy_ehmer_bandlimit, + _vp_tonemask_adj_otherblock); + ret|=vorbis_encode_tonemask_setup(vi,hi->blocktype[3].tone_mask_quality,3, + _psy_tone_masteratt,_psy_tone_0dB,_psy_ehmer_bandlimit, + _vp_tonemask_adj_longblock); + + ret|=vorbis_encode_compand_setup(vi,hi->blocktype[0].noise_compand_quality, + 0,_psy_compand_44_short, + 1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.); + ret|=vorbis_encode_compand_setup(vi,hi->blocktype[1].noise_compand_quality, + 1,_psy_compand_44_short, + 1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.); + ret|=vorbis_encode_compand_setup(vi,hi->blocktype[2].noise_compand_quality, + 2,_psy_compand_44, + 1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.); + ret|=vorbis_encode_compand_setup(vi,hi->blocktype[3].noise_compand_quality, + 3,_psy_compand_44, + 1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.); + ret|=vorbis_encode_peak_setup(vi,hi->blocktype[0].tone_peaklimit_quality, + 0,_psy_tone_masterguard,_psy_tone_suppress, + _vp_peakguard); + ret|=vorbis_encode_peak_setup(vi,hi->blocktype[1].tone_peaklimit_quality, + 1,_psy_tone_masterguard,_psy_tone_suppress, + _vp_peakguard); + ret|=vorbis_encode_peak_setup(vi,hi->blocktype[2].tone_peaklimit_quality, + 2,_psy_tone_masterguard,_psy_tone_suppress, + _vp_peakguard); + ret|=vorbis_encode_peak_setup(vi,hi->blocktype[3].tone_peaklimit_quality, + 3,_psy_tone_masterguard,_psy_tone_suppress, + _vp_peakguard); + + if(hi->impulse_block_p){ + ret|=vorbis_encode_noisebias_setup(vi,hi->blocktype[0].noise_bias_quality, + 0,_psy_noise_suppress,_psy_noisebias_impulse, + _psy_noiseguards_short); + }else{ + ret|=vorbis_encode_noisebias_setup(vi,hi->blocktype[0].noise_bias_quality, + 0,_psy_noise_suppress,_psy_noisebias_other, + _psy_noiseguards_short); + } + + ret|=vorbis_encode_noisebias_setup(vi,hi->blocktype[1].noise_bias_quality, + 1,_psy_noise_suppress,_psy_noisebias_other, + _psy_noiseguards_short); + ret|=vorbis_encode_noisebias_setup(vi,hi->blocktype[2].noise_bias_quality, + 2,_psy_noise_suppress,_psy_noisebias_other, + _psy_noiseguards_long); + ret|=vorbis_encode_noisebias_setup(vi,hi->blocktype[3].noise_bias_quality, + 3,_psy_noise_suppress,_psy_noisebias_long, + _psy_noiseguards_long); + + ret|=vorbis_encode_ath_setup(vi,hi->blocktype[0].ath_quality,0,ATH_Bark_dB, + 0., 0., 0., 0., .2, .5, 1., 1., 1.5, 2., 2.); + ret|=vorbis_encode_ath_setup(vi,hi->blocktype[1].ath_quality,1,ATH_Bark_dB, + 0., 0., 0., 0., .2, .5, 1., 1., 1.5, 2., 2.); + ret|=vorbis_encode_ath_setup(vi,hi->blocktype[2].ath_quality,2,ATH_Bark_dB, + 0., 0., 0., 0., .2, .5, 1., 1., 1.5, 2., 2.); + ret|=vorbis_encode_ath_setup(vi,hi->blocktype[3].ath_quality,3,ATH_Bark_dB, + 0., 0., 0., 0., .2, .5, 1., 1., 1.5, 2., 2.); + + if(ret){ + vorbis_info_clear(vi); + return ret; + } + + if(channels==2 && hi->stereo_couple_p){ + /* setup specific to stereo coupling */ + + ret|=vorbis_encode_residue_setup(vi,hi->base_quality_short,0, + 1, /* coupled */ + hi->stereo_backfill_p, + hi->residue_backfill_p, + _residue_template_44_stereo, + hi->stereo_point_dB, + hi->stereo_point_kHz[0]); + + ret|=vorbis_encode_residue_setup(vi,hi->base_quality_long,1, + 1, /* coupled */ + hi->stereo_backfill_p, + hi->residue_backfill_p, + _residue_template_44_stereo, + hi->stereo_point_dB, + hi->stereo_point_kHz[1]); + + }else{ + /* setup specific to non-stereo (mono or uncoupled polyphonic) + coupling */ + ret|=vorbis_encode_residue_setup(vi,hi->base_quality_short,0, + 0, /* uncoupled */ + 0, + hi->residue_backfill_p, + _residue_template_44_uncoupled, + 0, + hi->stereo_point_kHz[0]); /* just + used as an encoding partitioning + point */ + + ret|=vorbis_encode_residue_setup(vi,hi->base_quality_long,1, + 0, /* uncoupled */ + 0, + hi->residue_backfill_p, + _residue_template_44_uncoupled, + 0, + hi->stereo_point_kHz[1]); /* just + used as an encoding partitioning + point */ + } + ret|=vorbis_encode_lowpass_setup(vi,hi->lowpass_kHz[0],0); + ret|=vorbis_encode_lowpass_setup(vi,hi->lowpass_kHz[1],1); + + hi->set_in_stone=1; + + if(ret) + vorbis_info_clear(vi); + return(ret); + +} + +/* this is only tuned for 44.1kHz right now. S'ok, for other rates it + just doesn't guess */ +static double ratepch_un44[11]= + {40000.,50000.,60000.,70000.,75000.,85000.,105000., + 115000.,135000.,160000.,250000.}; +static double ratepch_st44[11]= + {32000.,40000.,48000.,56000.,64000., + 80000.,96000.,112000.,128000.,160000.,250000.}; + +static double vbr_to_approx_bitrate(int ch,int coupled, + double q,long srate){ + int iq=q*10.; + double dq; + double *r=NULL; + + if(iq==10){ + iq=9; + dq=1.; + }else{ + dq=q*10.-iq; + } + + if(srate>42000 && srate<46000){ + if(coupled) + r=ratepch_st44; + else + r=ratepch_un44; + } + + if(r==NULL) + return(-1); + + return((r[iq]*(1.-dq)+r[iq+1]*dq)*ch); +} + +static double approx_bitrate_to_vbr(int ch,int coupled, + double bitrate,long srate){ + double *r=NULL,del; + int i; + + if(srate>42000 && srate<46000){ + if(coupled) + r=ratepch_st44; + else + r=ratepch_un44; + } + + if(r==NULL) + return(-1.); + + bitrate/=ch; + + if(bitrate<=r[0])return(0.); + for(i=0;i<10;i++) + if(r[i]<bitrate && r[i+1]>=bitrate)break; + if(i==10)return(10.); + + del=(bitrate-r[i])/(r[i+1]-r[i]); + + return((i+del)*.1); +} + +/* only populates the high-level settings so that we can tweak with ctl before final setup */ +int vorbis_encode_setup_vbr(vorbis_info *vi, + long channels, + long rate, + + float base_quality){ + int ret=0,i,iq; + double dq; + codec_setup_info *ci=vi->codec_setup; + highlevel_encode_setup *hi=&ci->hi; + + base_quality+=.0001; + if(base_quality<0.)base_quality=0.; + if(base_quality>.999)base_quality=.999; + + iq=base_quality*10; + if(iq==10){ + iq=9; + dq=1.; + }else{ + dq=base_quality*10.-iq; + } + + ret|=vorbis_encode_toplevel_setup(vi,256,2048,channels,rate); + hi->base_quality=base_quality; + hi->base_quality_short=base_quality; + hi->base_quality_long=base_quality; + hi->trigger_quality=base_quality; + + for(i=0;i<4;i++){ + hi->blocktype[i].tone_mask_quality=base_quality; + hi->blocktype[i].tone_peaklimit_quality=base_quality; + hi->blocktype[i].noise_bias_quality=base_quality; + hi->blocktype[i].noise_compand_quality=base_quality; + hi->blocktype[i].ath_quality=base_quality; + } + + hi->short_block_p=1; + hi->long_block_p=1; + hi->impulse_block_p=1; + hi->amplitude_track_dBpersec=-6.; + + hi->stereo_couple_p=1; /* only relevant if a two channel input */ + hi->stereo_backfill_p=0; + hi->residue_backfill_p=0; + + /* set the ATH floaters */ + hi->ath_floating_dB=_psy_ath_floater[iq]*(1.-dq)+_psy_ath_floater[iq+1]*dq; + hi->ath_absolute_dB=_psy_ath_abs[iq]*(1.-dq)+_psy_ath_abs[iq+1]*dq; + + /* set stereo dB and Hz */ + hi->stereo_point_dB=_psy_stereo_point_dB_44[iq]; + hi->stereo_point_kHz[0]=_psy_stereo_point_kHz_44[0][iq]*(1.-dq)+ + _psy_stereo_point_kHz_44[0][iq+1]*dq; + hi->stereo_point_kHz[1]=_psy_stereo_point_kHz_44[1][iq]*(1.-dq)+ + _psy_stereo_point_kHz_44[1][iq+1]*dq; + + /* set lowpass */ + hi->lowpass_kHz[0]= + hi->lowpass_kHz[1]= + _psy_lowpass_44[iq]*(1.-dq)+_psy_lowpass_44[iq+1]*dq; + + /* set a few bitrate management conventions, but don't enable + management */ + ci->bi.avgfloat_initial=4.0; + ci->bi.avgfloat_minimum=2.3; + + /* set bitrate approximation */ + vi->bitrate_nominal=vbr_to_approx_bitrate(vi->channels,hi->stereo_couple_p, + base_quality,vi->rate); + vi->bitrate_lower=-1; + vi->bitrate_upper=-1; + vi->bitrate_window=-1; + + return(ret); +} + +int vorbis_encode_init_vbr(vorbis_info *vi, + long channels, + long rate, + + float base_quality /* 0. to 1. */ + ){ + int ret=0; + + ret=vorbis_encode_setup_vbr(vi,channels,rate,base_quality); + + if(ret){ + vorbis_info_clear(vi); + return ret; + } + ret=vorbis_encode_setup_init(vi); + if(ret) + vorbis_info_clear(vi); + return(ret); +} + +int vorbis_encode_setup_managed(vorbis_info *vi, + long channels, + long rate, + + long max_bitrate, + long nominal_bitrate, + long min_bitrate){ + + double tnominal=nominal_bitrate; + double approx_vbr=approx_bitrate_to_vbr(channels,(channels==2), + (float)nominal_bitrate,rate); + int ret=0; + if(approx_vbr<0)return(OV_EIMPL); + + if(nominal_bitrate<=0.){ + if(max_bitrate>0.){ + nominal_bitrate=max_bitrate*.875; + }else{ + if(min_bitrate>0.){ + nominal_bitrate=min_bitrate; + }else{ + return(OV_EINVAL); + } + } + } + + ret=vorbis_encode_setup_vbr(vi,channels,rate,approx_vbr); + if(ret){ + vorbis_info_clear(vi); + return ret; + } + + /* adjust to make management's life easier */ + { + vectl_stereo_arg stereo; + vectl_block_arg block; + vectl_bitrate_arg bitrate; + + vorbis_encode_ctl(vi,VECTL_BITRATE,0,&bitrate); + vorbis_encode_ctl(vi,VECTL_BLOCK,0,&block); + vorbis_encode_ctl(vi,VECTL_STEREO,0,&stereo); + + bitrate.stereo_backfill_p=1; + bitrate.residue_backfill_p=1; + + block.impulse_block_p=0; + + if(stereo.stereo_couple_p && channels==2){ + stereo.stereo_point_dB_mode++; + if(stereo.stereo_point_dB_mode>3)stereo.stereo_point_dB_mode=3; + } + + /* slug the vbr noise setting*/ + hi->blocktype[0].noise_bias_quality-=.1; + if(hi->blocktype[0].noise_bias_quality<0.) + hi->blocktype[0].noise_bias_quality=0.; + hi->blocktype[1].noise_bias_quality-=.1; + if(hi->blocktype[1].noise_bias_quality<0.) + hi->blocktype[1].noise_bias_quality=0.; + hi->blocktype[2].noise_bias_quality-=.05; + if(hi->blocktype[2].noise_bias_quality<0.) + hi->blocktype[2].noise_bias_quality=0.; + hi->blocktype[3].noise_bias_quality-=.05; + if(hi->blocktype[3].noise_bias_quality<0.) + hi->blocktype[3].noise_bias_quality=0.; + + /* initialize management. Currently hardcoded for 44, but so is above. */ + memcpy(&ci->bi,&_bm_44_default,sizeof(ci->bi)); + ci->bi.queue_hardmin=min_bitrate; + ci->bi.queue_hardmax=max_bitrate; + + ci->bi.queue_avgmin=tnominal; + ci->bi.queue_avgmax=tnominal; + + /* adjust management */ + ci->bi.avgfloat_noise_maxval=_bm_max_noise_offset[(int)approx_vbr]; + + } + return(ret); +} + +int vorbis_encode_init(vorbis_info *vi, + long channels, + long rate, + + long max_bitrate, + long nominal_bitrate, + long min_bitrate){ + + int ret=vorbis_encode_setup_managed(vi,channels,rate, + max_bitrate, + nominal_bitrate, + min_bitrate); + if(ret){ + vorbis_info_clear(vi); + return(ret); + } + + ret=vorbis_encode_setup_init(vi); + if(ret) + vorbis_info_clear(vi); + return(ret); +} + +int vorbis_encode_ctl(vorbis_info *vi,int number,int setp,void *arg){ + codec_setup_info *ci=vi->codec_setup; + highlevel_encode_setup *hi=&ci->hi; + + if(setp && hi->set_in_stone)return(OV_EINVAL); + + switch(number){ + case VECTL_BLOCK: + if(setp){ + vectl_block_arg *varg=(vectl_block_arg *)arg; + if(!varg->short_block_p && !varg->long_block_p)return(OV_EINVAL); + + hi->short_block_p=varg->short_block_p; + hi->long_block_p=varg->long_block_p; + hi->impulse_block_p=varg->impulse_block_p; + }else{ + vectl_block_arg *varg=(vectl_block_arg *)arg; + + varg->short_block_p=hi->short_block_p; + varg->long_block_p=hi->long_block_p; + varg->impulse_block_p=hi->impulse_block_p; + } + break; + + case VECTL_PSY_LOWPASS: + if(setp){ + vectl_lowpass_arg *varg=(vectl_lowpass_arg *)arg; + hi->lowpass_kHz[0]=varg->short_lowpass_kHz; + hi->lowpass_kHz[1]=varg->long_lowpass_kHz; + }else{ + vectl_lowpass_arg *varg=(vectl_lowpass_arg *)arg; + varg->short_lowpass_kHz=hi->lowpass_kHz[0]; + varg->long_lowpass_kHz=hi->lowpass_kHz[1]; + } + break; + + case VECTL_PSY_STEREO: + if(setp){ + vectl_stereo_arg *varg=(vectl_stereo_arg *)arg; + + if(varg->stereo_point_dB_mode<0)return(OV_EINVAL); + if(varg->stereo_point_dB_mode>3)return(OV_EINVAL); + + hi->stereo_point_kHz[0]=varg->stereo_point_kHz_short; + hi->stereo_point_kHz[1]=varg->stereo_point_kHz_long; + hi->stereo_point_dB=varg->stereo_point_dB_mode; + hi->stereo_couple_p=varg->stereo_couple_p; + }else{ + vectl_stereo_arg *varg=(vectl_stereo_arg *)arg; + + varg->stereo_point_kHz_short=hi->stereo_point_kHz[0]; + varg->stereo_point_kHz_long=hi->stereo_point_kHz[1]; + varg->stereo_point_dB_mode=hi->stereo_point_dB; + varg->stereo_couple_p=hi->stereo_couple_p; + } + break; + + case VECTL_PSY_ATH: + { + vectl_ath_arg *varg=(vectl_ath_arg *)arg; + if(setp){ + hi->ath_floating_dB=varg->ath_float_dB; + hi->ath_fixed_dB=varg->ath_fixed_dB; + }else{ + varg->ath_float_dB=hi->ath_floating_dB; + varg->ath_fixed_dB=hi->ath_fixed_dB; + } + } + break; + + case VECTL_PSY_AMPTRACK: + if(setp){ + vectl_amp_arg *varg=(vectl_amp_arg *)arg; + hi->residue_backfill_p=varg->maxdB_track_decay; + }else{ + vectl_amp_arg *varg=(vectl_amp_arg *)arg; + varg->maxdB_track_decay=hi->residue_backfill_p; + } + break; + + case VECTL_PSY_MASK_Q: + if(setp){ + int i; + vectl_mask_arg *varg=(vectl_mask_arg *)arg; + + if(varg->trigger_q<0.)return(OV_EINVAL); + if(varg->trigger_q>1.)return(OV_EINVAL); + for(i=0;i<4;i++){ + if(varg->tonemask_q[i]<0.)return(OV_EINVAL); + if(varg->tonemask_q[i]>1.)return(OV_EINVAL); + if(varg->tonepeak_q[i]<0.)return(OV_EINVAL); + if(varg->tonepeak_q[i]>1.)return(OV_EINVAL); + if(varg->noise_q[i]<0.)return(OV_EINVAL); + if(varg->noise_q[i]>1.)return(OV_EINVAL); + } + + hi->trigger_quality=varg->trigger_q; + for(i=0;i<4;i++){ + hi->blocktype[i].tone_mask_quality=varg->tonemask_q[i]; + hi->blocktype[i].tone_peaklimit_quality=varg->tonepeak_q[i]; + hi->blocktype[i].noise_bias_quality=varg->noise_q[i]; + hi->blocktype[i].noise_compand_quality=varg->noise_q[i]; + } + }else{ + int i; + vectl_mask_arg *varg=(vectl_mask_arg *)arg; + + varg->trigger_q=hi->trigger_quality; + for(i=0;i<4;i++){ + varg->tonemask_q[i]=hi->blocktype[i].tone_mask_quality; + varg->tonepeak_q[i]=hi->blocktype[i].tone_peaklimit_quality; + varg->noise_q[i]=hi->blocktype[i].noise_bias_quality; + varg->noise_q[i]=hi->blocktype[i].noise_compand_quality; + } + } + break; + + case VECTL_PSY_NOISENORM: + if(setp){ + vectl_noisenorm_arg *varg=(vectl_noisenorm_arg *)arg; + if(varg->noise_normalize_weight<0.)return(OV_EINVAL); + if(varg->noise_normalize_weight>4.)return(OV_EINVAL); + if(varg->noise_normalize_thresh<0.)return(OV_EINVAL); + if(varg->noise_normalize_thresh>.5)return(OV_EINVAL); + + hi->normalize_noise_p=varg->noise_normalize_p; + hi->normalize_noise_unit_weight=varg->noise_normalize_weight; + hi->normalize_noise_minimum_upgrade=varg->noise_normalize_thresh; + }else{ + vectl_noisenorm_arg *varg=(vectl_noisenorm_arg *)arg; + hi->normalize_noise_p=varg->noise_normalize_p; + hi->normalize_noise_unit_weight=varg->noise_normalize_weight; + hi->normalize_noise_minimum_upgrade=varg->noise_normalize_thresh; + } + break; + + case VECTL_BITRATE: + if(setp){ + vectl_bitrate_arg *varg=(vectl_bitrate_arg *)arg; + + if(varg->avg_min>0. && varg->avg_max>0. && + varg->avg_min>varg->avg_max)return(OV_EINVAL); + if(varg->avg_window_time>20)return(OV_EINVAL); + if(varg->avg_window_time>0. && varg->avg_window_time<.1) + return(OV_EINVAL); + if(varg->avg_window_center<0.)return(OV_EINVAL); + if(varg->avg_window_center>1.)return(OV_EINVAL); + + if(varg->limit_min>0. && varg->limit_max>0. && + varg->limit_min>varg->limit_max)return(OV_EINVAL); + if(varg->limit_window_time>20)return(OV_EINVAL); + if(varg->limit_window_time>0. && varg->limit_window_time<.1) + return(OV_EINVAL); + + if(varg->avg_slew_downmax>0.)return(OV_EINVAL); + if(varg->avg_slew_upmax<0.)return(OV_EINVAL); + + ci->bi.queue_avg_time=hi->avg_window_time; + ci->bi.queue_avg_center=hi->avg_window_center; + ci->bi.queue_minmax_time=hi->limit_window_time; + ci->bi.queue_avgmin=hi->avg_min; + ci->bi.queue_avgmax=hi->avg_max; + ci->bi.queue_hardmin=hi->limit_min; + ci->bi.queue_hardmax=hi->limit_max; + + ci->bi.avgfloat_initial=_bm_default.avgfloat_initial; + ci->bi.avgfloat_minimum=_bm_default.avgfloat_minimum; + ci->bi.avgfloat_downslew_max=hi->avg_slew_downmax; + ci->bi.avgfloat_upslew_max=hi->avg_slew_upmax; + + if(hi->avg_noisetrack_p){ + ci->bi.avgfloat_noise_lowtrigger= + _bm_default.avgfloat_noise_lowtrigger; + ci->bi.avgfloat_noise_hightrigger= + _bm_default.avgfloat_noise_hightrigger; + ci->bi.avgfloat_noise_minval=-6.; + ci->bi.avgfloat_noise_maxval=_bm_max_noise_offset[(int)approx_vbr]; + }else{ + ci->bi.avgfloat_noise_lowtrigger=-1.f; + ci->bi.avgfloat_noise_hightrigger=9999.f; + ci->bi.avgfloat_noise_minval=0.f; + ci->bi.avgfloat_noise_maxval=0.f; + } + + hi->stereo_backfill_p=varg->stereo_backfill_p; + hi->residue_backfill_p=varg->residue_backfill_p; + }else{ + vectl_bitrate_arg *varg=(vectl_bitrate_arg *)arg; + + varg->stereo_backfill_p=hi->stereo_backfill_p; + varg->residue_backfill_p=hi->residue_backfill_p; + varg->avg_min=ci->bi.queue_avgmin; + varg->avg_max=ci->bi.queue_avgmax; + varg->avg_window_time=ci->bi.queue_avg_time; + varg->avg_window_center=ci->bi.queue_avg_center; + varg->avg_slew_downmax=ci->bi.avgfloat_downslew_max; + varg->avg_slew_upmax=ci->bi.avgfloat_upslew_max; + + if(ci->bi.avgfloat_noise_minval!=0. || + ci->bi.avgfloat_noise_maxval!=0.) + varg->avg_noisetrack_p=1; + else + varg->avg_noisetrack_p=0; + + varg->limit_min=ci->bi.queue_hardmin; + varg->limit_max=ci->bi.queue_hardmax; + varg->limit_window_time=ci->bi.queue_minmax_time; + + varg->stereo_backfill_p=hi->stereo_backfill_p; + varg->residue_backfill_p=hi->residue_backfill_p; + } + break; + + default: + return(OV_EIMPL); + } + + /* update base_quality_short and base_quality_long */ + { + double max_short=0.; + double max_long=0.; + + if(hi->impulse_block_p){ + if(max_short<hi->blocktype[0].tone_mask_quality) + max_short=hi->blocktype[0].tone_mask_quality; + if(max_short<hi->blocktype[0].tone_peaklimit_quality) + max_short=hi->blocktype[0].tone_peaklimit_quality; + if(max_short<hi->blocktype[0].noise_bias_quality) + max_short=hi->blocktype[0].noise_bias_quality; + } + if(max_short<hi->blocktype[1].tone_mask_quality) + max_short=hi->blocktype[1].tone_mask_quality; + if(max_short<hi->blocktype[1].tone_peaklimit_quality) + max_short=hi->blocktype[1].tone_peaklimit_quality; + if(max_short<hi->blocktype[1].noise_bias_quality) + max_short=hi->blocktype[1].noise_bias_quality; + + if(max_long<hi->blocktype[2].tone_mask_quality) + max_long=hi->blocktype[2].tone_mask_quality; + if(max_long<hi->blocktype[2].tone_peaklimit_quality) + max_long=hi->blocktype[2].tone_peaklimit_quality; + if(max_long<hi->blocktype[2].noise_bias_quality) + max_long=hi->blocktype[2].noise_bias_quality; + + if(max_long<hi->blocktype[3].tone_mask_quality) + max_long=hi->blocktype[3].tone_mask_quality; + if(max_long<hi->blocktype[3].tone_peaklimit_quality) + max_long=hi->blocktype[3].tone_peaklimit_quality; + if(max_long<hi->blocktype[3].noise_bias_quality) + max_long=hi->blocktype[3].noise_bias_quality; + + hi->base_quality_long=max_long; + hi->base_quality_short=max_short; + } + + return(0); +} diff --git a/vq/44c0.vqs b/vq/44c0.vqs new file mode 100644 index 00000000..43cd0ae0 --- /dev/null +++ b/vq/44c0.vqs @@ -0,0 +1,91 @@ +cp 44c0_s3/resaux_short.vqd _44c0_short.vqd +cp 44c0_s3/resaux_long.vqd _44c0_long.vqd + + +GO + +>_44c0s noninterleaved +haux _44c0_short.vqd 0,6,2 + +>_44c0 noninterleaved +haux _44c0_long.vqd 0,42,2 + +#iter 0 + +# 0 1 2 4 26 1 4 + +# 0 0 0 0 +# +# 0 1 2 3 4 5 6 7 +# 1 . . +# 2 . . +# 4 . . . . . . + +:_s0_p1_0 44c0_s3/res_part1_pass2.vqd, 4, nonseq cull, 0 +- 1 2 +:_s0_p2_0 44c0_s3/res_part2_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 +:_s0_p3_0 44c0_s3/res_part3_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 + +:_s0_p4_0 44c0_s3/res_part4_pass0.vqd, 4, nonseq cull, 0 +- 21 42 +:_s0_p4_1 44c0_s3/res_part4_pass1.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 + +:_s0_p5_0 44c0_s0/res_part5_pass2.vqd, 4, nonseq cull, 0 +- 1 2 +:_s1_p5_0 44c0_s3/res_part5_pass2.vqd, 8, nonseq cull, 0 +- 1 + +:_s0_p6_0 44c0_s0/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 +:_s1_p6_0 44c0_s1/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 +:_s2_p6_0 44c0_s3/res_part6_pass2.vqd, 2, nonseq cull, 0 +- 1 2 3 4 + + +:_s0_p7_0 44c0_s0/res_part7_pass0.vqd, 4, nonseq, 0 +- 105 210 +:_s0_p7_1 44c0_s0/res_part7_pass1.vqd, 4, nonseq, 0 +- 21 42 +:_s0_p7_2 44c0_s0/res_part7_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 + +:_s1_p7_0 44c0_s1/res_part7_pass0.vqd, 4, nonseq, 0 +- 105 210 +:_s1_p7_1 44c0_s1/res_part7_pass1.vqd, 4, nonseq, 0 +- 21 42 +:_s1_p7_2 44c0_s1/res_part7_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 + +:_s2_p7_0 44c0_s2/res_part7_pass0.vqd, 4, nonseq, 0 +- 105 210 +:_s2_p7_1 44c0_s2/res_part7_pass1.vqd, 4, nonseq, 0 +- 21 42 +:_s2_p7_2 44c0_s2/res_part7_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 + +:_s3_p7_0 44c0_s3/res_part7_pass0.vqd, 4, nonseq, 0 +- 105 210 +:_s3_p7_1 44c0_s3/res_part7_pass1.vqd, 4, nonseq, 0 +- 21 42 +:_s3_p7_2 44c0_s3/res_part7_pass2.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 9 10 + + + + +:_s1_p7_0 44c0_s1/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201 +:_s1_p7_1 44c0_s1/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33 +:_s1_p7_2 44c0_s1/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 + +:_s2_p7_0 44c0_s2/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201 +:_s2_p7_1 44c0_s2/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33 +:_s2_p7_2 44c0_s2/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 + +:_s3_p7_0 44c0_s3/res_part7_pass0.vqd, 2, nonseq, 0 +- 67 134 201 +:_s3_p7_1 44c0_s3/res_part7_pass1.vqd, 2, nonseq, 0 +- 3 6 9 12 15 18 21 24 27 30 33 +:_s3_p7_2 44c0_s3/res_part7_pass2.vqd, 4, nonseq, 0 +- 1 + +#iter 1 (stereo 3(8.)->2 2(4.)->1 1(2.)->0) shared for all 'low' modes + +:_s1_p5_s0 44cL_s1/res_part5_pass3.vqd, 2, nonseq, 0 +- 1 2 +:_s1_p6_s0 44cL_s1/res_part6_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 +:_s1_p7_s0 44cL_s1/res_part7_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 + +:_s2_p6_s0 44cL_s2/res_part6_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 +:_s2_p7_s0 44cL_s2/res_part7_pass3.vqd, 2, nonseq, 0 +- 1 2 3 4 5 6 7 8 + +:_s3_p7_s0 44cL_s3/res_part7_pass3.vqd, 2, nonseq cull, 0 +- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 + +#iter 2 (residue backfill) shared for all 'low' modes + +:_s0_p0_r0 44cL_s0/res_part0_r0.vqd, 2, nonseq, 0 +- .333333333 .666666667 +:_s0_pN_r0 44cL_s0/res_partN_r0.vqd, 2, nonseq, 0 +- .333333333 .666666667 +:_s1_pS_r0 44cL_s1/res_partS_r0.vqd, 2, nonseq, 0 +- .333333333 + +#iter 3 (residue backfill) + +:_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 + |