summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <xiphmont@xiph.org>2000-03-29 03:49:29 +0000
committerMonty <xiphmont@xiph.org>2000-03-29 03:49:29 +0000
commit38a19fa1a830005b8d02cb8505da8f5bf374cdc8 (patch)
treecae6f30cdd7af150cfdc3a25b4c01120d0611d92
parent0cf048ae1b74528fe7789d1466299f02fd52002b (diff)
downloadlibvorbis-git-38a19fa1a830005b8d02cb8505da8f5bf374cdc8.tar.gz
Don't want to lose anything while I'm integrating (also don;t want to
disturb mainline till I'm done) Monty svn path=/branches/unlabeled-1.11.2/vorbis/; revision=286
-rw-r--r--lib/floor0.c254
-rw-r--r--lib/mapping0.c372
-rw-r--r--lib/psy.h50
3 files changed, 676 insertions, 0 deletions
diff --git a/lib/floor0.c b/lib/floor0.c
new file mode 100644
index 00000000..f2ed4c24
--- /dev/null
+++ b/lib/floor0.c
@@ -0,0 +1,254 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: floor backend 0 implementation
+ last mod: $Id: floor0.c,v 1.11.2.1 2000/03/29 03:49:28 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "vorbis/codec.h"
+#include "bitwise.h"
+#include "registry.h"
+#include "lpc.h"
+#include "lsp.h"
+#include "bookinternal.h"
+#include "scales.h"
+
+typedef struct {
+ long n;
+ long m;
+
+ double ampscale;
+ double ampvals;
+
+ vorbis_info_floor0 *vi;
+ lpc_lookup lpclook;
+} vorbis_look_floor0;
+
+static void free_info(vorbis_info_floor *i){
+ if(i){
+ memset(i,0,sizeof(vorbis_info_floor0));
+ free(i);
+ }
+}
+
+static void free_look(vorbis_look_floor *i){
+ vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
+ if(i){
+ lpc_clear(&look->lpclook);
+ memset(look,0,sizeof(vorbis_look_floor0));
+ free(look);
+ }
+}
+
+static void pack (vorbis_info_floor *i,oggpack_buffer *opb){
+ vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
+ int j;
+ _oggpack_write(opb,info->order,8);
+ _oggpack_write(opb,info->rate,16);
+ _oggpack_write(opb,info->barkmap,16);
+ _oggpack_write(opb,info->ampbits,6);
+ _oggpack_write(opb,info->ampdB,8);
+ _oggpack_write(opb,info->stages-1,4);
+ for(j=0;j<info->stages;j++)
+ _oggpack_write(opb,info->books[j],8);
+}
+
+static vorbis_info_floor *unpack (vorbis_info *vi,oggpack_buffer *opb){
+ int j;
+ vorbis_info_floor0 *info=malloc(sizeof(vorbis_info_floor0));
+ info->order=_oggpack_read(opb,8);
+ info->rate=_oggpack_read(opb,16);
+ info->barkmap=_oggpack_read(opb,16);
+ info->ampbits=_oggpack_read(opb,6);
+ info->ampdB=_oggpack_read(opb,8);
+ info->stages=_oggpack_read(opb,4)+1;
+
+ if(info->order<1)goto err_out;
+ if(info->rate<1)goto err_out;
+ if(info->barkmap<1)goto err_out;
+ if(info->stages<1)goto err_out;
+
+ for(j=0;j<info->stages;j++){
+ info->books[j]=_oggpack_read(opb,8);
+ if(info->books[j]<0 || info->books[j]>=vi->books)goto err_out;
+ }
+ return(info);
+ err_out:
+ free_info(info);
+ return(NULL);
+}
+
+static vorbis_look_floor *look (vorbis_dsp_state *vd,vorbis_info_mode *mi,
+ vorbis_info_floor *i){
+ vorbis_info *vi=vd->vi;
+ vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
+ vorbis_look_floor0 *look=malloc(sizeof(vorbis_look_floor0));
+ look->m=info->order;
+ look->n=vi->blocksizes[mi->blockflag]/2;
+ look->vi=info;
+ lpc_init(&look->lpclook,look->n,info->barkmap,info->rate,look->m);
+
+ return look;
+}
+
+#include <stdio.h>
+
+static int forward(vorbis_block *vb,vorbis_look_floor *i,
+ double *in,double *out){
+ long j,k,stage;
+ vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
+ vorbis_info_floor0 *info=look->vi;
+ double amp;
+ long bits=0;
+
+ /* use 'out' as temp storage */
+ /* Convert our floor to a set of lpc coefficients */
+ amp=sqrt(vorbis_curve_to_lpc(in,out,&look->lpclook));
+
+ /* amp is in the range 0. to 1. (well, more like .7). Log scale it */
+
+ /* 0 == 0 dB
+ (1<<ampbits)-1 == amp dB = 1. amp */
+ {
+ long ampscale=fromdB(info->ampdB);
+ long maxval=(1<<info->ampbits)-1;
+
+ long val=todB(amp*ampscale)/info->ampdB*maxval+1;
+
+ if(val<0)val=0; /* likely */
+ if(val>maxval)val=maxval; /* not bloody likely */
+
+ _oggpack_write(&vb->opb,val,info->ampbits);
+ if(val>0)
+ amp=fromdB((val-.5)/maxval*info->ampdB)/ampscale;
+ else
+ amp=0;
+ }
+
+ if(amp>0){
+ double *work=alloca(sizeof(double)*look->m);
+
+ /* LSP <-> LPC is orthogonal and LSP quantizes more stably */
+ vorbis_lpc_to_lsp(out,out,look->m);
+ memcpy(work,out,sizeof(double)*look->m);
+
+#ifdef TRAIN
+ {
+ int j;
+ FILE *of;
+ char buffer[80];
+ sprintf(buffer,"lsp0coeff_%d.vqd",vb->mode);
+ of=fopen(buffer,"a");
+ for(j=0;j<look->m;j++)
+ fprintf(of,"%g, ",out[j]);
+ fprintf(of,"\n");
+ fclose(of);
+ }
+#endif
+
+#ifdef ANALYSIS
+ vorbis_lsp_to_lpc(out,out,look->m);
+ vorbis_lpc_to_curve(out,out,amp,&look->lpclook);
+ _analysis_output("floor0_pre",vb->sequence,out,look->n);
+ memcpy(out,work,sizeof(double)*look->m);
+#endif
+
+
+ /* code the spectral envelope, and keep track of the actual
+ quantized values; we don't want creeping error as each block is
+ nailed to the last quantized value of the previous block. */
+
+ /* first stage is a bit different because quantization error must be
+ handled carefully */
+ for(stage=0;stage<info->stages;stage++){
+ codebook *b=vb->vd->fullbooks+info->books[stage];
+
+ if(stage==0){
+ double last=0.;
+ for(j=0;j<look->m;){
+ for(k=0;k<b->dim;k++)out[j+k]-=last;
+ bits+=vorbis_book_encodev(b,out+j,&vb->opb);
+ for(k=0;k<b->dim;k++,j++){
+ out[j]+=last;
+ work[j]-=out[j];
+ }
+ last=out[j-1];
+ }
+ }else{
+ memcpy(out,work,sizeof(double)*look->m);
+ for(j=0;j<look->m;){
+ bits+=vorbis_book_encodev(b,out+j,&vb->opb);
+ for(k=0;k<b->dim;k++,j++)work[j]-=out[j];
+ }
+ }
+ }
+ /* take the coefficients back to a spectral envelope curve */
+ vorbis_lsp_to_lpc(out,out,look->m);
+ vorbis_lpc_to_curve(out,out,amp,&look->lpclook);
+ _analysis_output("floor0_post",vb->sequence,out,look->n);
+ fprintf(stderr,"Encoded %ld LSP coefficients in %ld bits\n",look->m,bits);
+ return(1);
+ }
+
+ fprintf(stderr,"Encoded %ld LSP coefficients in %ld bits\n",look->m,bits);
+
+ memset(out,0,sizeof(double)*look->n);
+ _analysis_output("floor0_post",vb->sequence,out,look->n);
+ return(0);
+}
+
+static int inverse(vorbis_block *vb,vorbis_look_floor *i,double *out){
+ vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
+ vorbis_info_floor0 *info=look->vi;
+ int j,k,stage;
+
+ long ampraw=_oggpack_read(&vb->opb,info->ampbits);
+ if(ampraw>0){
+ long ampscale=fromdB(info->ampdB);
+ long maxval=(1<<info->ampbits)-1;
+ double amp=fromdB((ampraw-.5)/maxval*info->ampdB)/ampscale;
+
+ memset(out,0,sizeof(double)*look->m);
+ for(stage=0;stage<info->stages;stage++){
+ codebook *b=vb->vd->fullbooks+info->books[stage];
+ for(j=0;j<look->m;j+=b->dim)
+ vorbis_book_decodev(b,out+j,&vb->opb);
+ if(stage==0){
+ double last=0.;
+ for(j=0;j<look->m;){
+ for(k=0;k<b->dim;k++,j++)out[j]+=last;
+ last=out[j-1];
+ }
+ }
+ }
+
+
+ /* take the coefficients back to a spectral envelope curve */
+ vorbis_lsp_to_lpc(out,out,look->m);
+ vorbis_lpc_to_curve(out,out,amp,&look->lpclook);
+ return(1);
+ }else
+ memset(out,0,sizeof(double)*look->n);
+ return(0);
+}
+
+/* export hooks */
+vorbis_func_floor floor0_exportbundle={
+ &pack,&unpack,&look,&free_info,&free_look,&forward,&inverse
+};
+
+
diff --git a/lib/mapping0.c b/lib/mapping0.c
new file mode 100644
index 00000000..7baf9b78
--- /dev/null
+++ b/lib/mapping0.c
@@ -0,0 +1,372 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: channel mapping 0 implementation
+ last mod: $Id: mapping0.c,v 1.11.2.1 2000/03/29 03:49:28 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include "vorbis/codec.h"
+#include "vorbis/backends.h"
+#include "bitwise.h"
+#include "bookinternal.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 */
+
+typedef struct {
+ 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;
+
+ vorbis_func_time **time_func;
+ vorbis_func_floor **floor_func;
+ vorbis_func_residue **residue_func;
+
+ int ch;
+ double **decay;
+
+} vorbis_look_mapping0;
+
+static void free_info(vorbis_info_mapping *i){
+ if(i){
+ memset(i,0,sizeof(vorbis_info_mapping0));
+ free(i);
+ }
+}
+
+static void free_look(vorbis_look_mapping *look){
+ int i;
+ vorbis_look_mapping0 *l=(vorbis_look_mapping0 *)look;
+ if(l){
+ 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)_vp_psy_clear(l->psy_look+i);
+ }
+ if(l->decay){
+ for(i=0;i<l->ch;i++){
+ if(l->decay[i])free(l->decay[i]);
+ }
+ free(l->decay);
+ }
+ free(l->time_func);
+ free(l->floor_func);
+ free(l->residue_func);
+ free(l->time_look);
+ free(l->floor_look);
+ free(l->residue_look);
+ if(l->psy_look)free(l->psy_look);
+ memset(l,0,sizeof(vorbis_look_mapping0));
+ free(l);
+ }
+}
+
+static vorbis_look_mapping *look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
+ vorbis_info_mapping *m){
+ int i;
+ vorbis_info *vi=vd->vi;
+ vorbis_look_mapping0 *look=calloc(1,sizeof(vorbis_look_mapping0));
+ vorbis_info_mapping0 *info=look->map=(vorbis_info_mapping0 *)m;
+ look->mode=vm;
+
+ look->time_look=calloc(info->submaps,sizeof(vorbis_look_time *));
+ look->floor_look=calloc(info->submaps,sizeof(vorbis_look_floor *));
+ look->residue_look=calloc(info->submaps,sizeof(vorbis_look_residue *));
+ if(vi->psys)look->psy_look=calloc(info->submaps,sizeof(vorbis_look_psy));
+
+ look->time_func=calloc(info->submaps,sizeof(vorbis_func_time *));
+ look->floor_func=calloc(info->submaps,sizeof(vorbis_func_floor *));
+ look->residue_func=calloc(info->submaps,sizeof(vorbis_func_residue *));
+
+ 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[vi->time_type[timenum]];
+ look->time_look[i]=look->time_func[i]->
+ look(vd,vm,vi->time_param[timenum]);
+ look->floor_func[i]=_floor_P[vi->floor_type[floornum]];
+ look->floor_look[i]=look->floor_func[i]->
+ look(vd,vm,vi->floor_param[floornum]);
+ look->residue_func[i]=_residue_P[vi->residue_type[resnum]];
+ look->residue_look[i]=look->residue_func[i]->
+ look(vd,vm,vi->residue_param[resnum]);
+
+ if(vi->psys){
+ int psynum=info->psysubmap[i];
+ _vp_psy_init(look->psy_look+i,vi->psy_param[psynum],
+ vi->blocksizes[vm->blockflag]/2,vi->rate);
+ }
+ }
+
+ look->ch=vi->channels;
+ if(vi->psys){
+ look->decay=calloc(vi->channels,sizeof(double *));
+ for(i=0;i<vi->channels;i++)
+ look->decay[i]=calloc(vi->blocksizes[vm->blockflag]/2,sizeof(double));
+ }
+
+ return(look);
+}
+
+static void pack(vorbis_info *vi,vorbis_info_mapping *vm,oggpack_buffer *opb){
+ int i;
+ vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)vm;
+
+ _oggpack_write(opb,info->submaps-1,4);
+ /* 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 *unpack(vorbis_info *vi,oggpack_buffer *opb){
+ int i;
+ vorbis_info_mapping0 *info=calloc(1,sizeof(vorbis_info_mapping0));
+ memset(info,0,sizeof(vorbis_info_mapping0));
+
+ info->submaps=_oggpack_read(opb,4)+1;
+
+ 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]>=vi->times)goto err_out;
+ info->floorsubmap[i]=_oggpack_read(opb,8);
+ if(info->floorsubmap[i]>=vi->floors)goto err_out;
+ info->residuesubmap[i]=_oggpack_read(opb,8);
+ if(info->residuesubmap[i]>=vi->residues)goto err_out;
+ }
+
+ return info;
+
+ err_out:
+ free_info(info);
+ return(NULL);
+}
+
+#include <stdio.h>
+#include "os.h"
+#include "lpc.h"
+#include "lsp.h"
+#include "envelope.h"
+#include "mdct.h"
+#include "psy.h"
+#include "bitwise.h"
+#include "spectrum.h"
+
+/* no time mapping implementation for now */
+static int forward(vorbis_block *vb,vorbis_look_mapping *l){
+ vorbis_dsp_state *vd=vb->vd;
+ vorbis_info *vi=vd->vi;
+ vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l;
+ vorbis_info_mapping0 *info=look->map;
+ vorbis_info_mode *mode=look->mode;
+ int n=vb->pcmend;
+ int i,j;
+ double *window=vd->window[vb->W][vb->lW][vb->nW][mode->windowtype];
+
+ double **pcmbundle=alloca(sizeof(double *)*vi->channels);
+ int *nonzero=alloca(sizeof(int)*vi->channels);
+
+ /* time domain pre-window: NONE IMPLEMENTED */
+
+ /* window the PCM data: takes PCM vector, vb; modifies PCM vector */
+
+ for(i=0;i<vi->channels;i++){
+ double *pcm=vb->pcm[i];
+ for(j=0;j<n;j++)
+ pcm[j]*=window[j];
+ }
+
+ /* time-domain post-window: NONE IMPLEMENTED */
+
+ /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
+ /* only MDCT right now.... */
+ for(i=0;i<vi->channels;i++){
+ double *pcm=vb->pcm[i];
+ mdct_forward(vd->transform[vb->W][0],pcm,pcm);
+ }
+
+ {
+ double *floor=_vorbis_block_alloc(vb,n*sizeof(double)/2);
+ double *mask=_vorbis_block_alloc(vb,n*sizeof(double)/2);
+
+ for(i=0;i<vi->channels;i++){
+ double *pcm=vb->pcm[i];
+ double *decay=look->decay[i];
+ int submap=info->chmuxlist[i];
+
+ /* perform psychoacoustics; do masking */
+ /*memset(mask,0,sizeof(double)*n/2);*/
+ _vp_tone_tone_mask(look->psy_look+submap,pcm,mask,
+ 1,1,1,decay);
+
+ /* perform floor encoding */
+
+ nonzero[i]=look->floor_func[submap]->
+ forward(vb,look->floor_look[submap],mask,floor);
+
+ _analysis_output("map0_mdct",vb->sequence,pcm,n/2);
+ _analysis_output("map0_mask",vb->sequence,mask,n/2);
+ _analysis_output("map0_decay",vb->sequence,decay,n/2);
+
+#ifdef TRAIN
+ if(nonzero[i]){
+ FILE *of;
+ char buffer[80];
+ int i;
+
+ sprintf(buffer,"masked_%d.vqd",vb->mode);
+ of=fopen(buffer,"a");
+ for(i=0;i<n/2;i++)
+ fprintf(of,"%g, ",pcm[i]/mask[i]);
+ fprintf(of,"\n");
+ fclose(of);
+ sprintf(buffer,"floored_%d.vqd",vb->mode);
+ of=fopen(buffer,"a");
+ for(i=0;i<n/2;i++)
+ fprintf(of,"%g, ",pcm[i]/floor[i]);
+ fprintf(of,"\n");
+ fclose(of);
+ }
+#endif
+
+ /* no iterative residue/floor tuning at the moment */
+ if(nonzero[i])for(j=0;j<n/2;j++)pcm[j]/=floor[j];
+
+ }
+
+ /* perform residue encoding with residue mapping; this is
+ multiplexed. All the channels belonging to one submap are
+ encoded (values interleaved), then the next submap, etc */
+
+ for(i=0;i<info->submaps;i++){
+ int ch_in_bundle=0;
+ for(j=0;j<vi->channels;j++){
+ if(info->chmuxlist[j]==i && nonzero[j]==1){
+ pcmbundle[ch_in_bundle++]=vb->pcm[j];
+ }
+ }
+
+ look->residue_func[i]->forward(vb,look->residue_look[i],
+ pcmbundle,ch_in_bundle);
+ }
+ }
+
+ return(0);
+}
+
+static int inverse(vorbis_block *vb,vorbis_look_mapping *l){
+ vorbis_dsp_state *vd=vb->vd;
+ vorbis_info *vi=vd->vi;
+ 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=vi->blocksizes[vb->W];
+
+ double *window=vd->window[vb->W][vb->lW][vb->nW][mode->windowtype];
+ double **pcmbundle=alloca(sizeof(double *)*vi->channels);
+ int *nonzero=alloca(sizeof(int)*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++){
+ double *pcm=vb->pcm[i];
+ int submap=info->chmuxlist[i];
+ nonzero[i]=look->floor_func[submap]->
+ inverse(vb,look->floor_look[submap],pcm);
+ }
+
+ /* recover the residue, apply directly to the spectral envelope */
+
+ for(i=0;i<info->submaps;i++){
+ int ch_in_bundle=0;
+ for(j=0;j<vi->channels;j++){
+ if(info->chmuxlist[j]==i && nonzero[j])
+ pcmbundle[ch_in_bundle++]=vb->pcm[j];
+ }
+
+ look->residue_func[i]->inverse(vb,look->residue_look[i],pcmbundle,ch_in_bundle);
+ }
+
+ /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
+ /* only MDCT right now.... */
+ for(i=0;i<vi->channels;i++){
+ double *pcm=vb->pcm[i];
+ mdct_backward(vd->transform[vb->W][0],pcm,pcm);
+ }
+
+ /* now apply the decoded pre-window time information */
+ /* NOT IMPLEMENTED */
+
+ /* window the data */
+ for(i=0;i<vi->channels;i++){
+ double *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.;
+ }
+
+ /* now apply the decoded post-window time information */
+ /* NOT IMPLEMENTED */
+
+ /* all done! */
+ return(0);
+}
+
+/* export hooks */
+vorbis_func_mapping mapping0_exportbundle={
+ &pack,&unpack,&look,&free_info,&free_look,&forward,&inverse
+};
+
+
+
diff --git a/lib/psy.h b/lib/psy.h
new file mode 100644
index 00000000..6441be83
--- /dev/null
+++ b/lib/psy.h
@@ -0,0 +1,50 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: random psychoacoustics (not including preecho)
+ last mod: $Id: psy.h,v 1.11.2.1 2000/03/29 03:49:28 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_PSY_H_
+#define _V_PSY_H_
+#include "smallft.h"
+
+#ifndef EHMER_MAX
+#define EHMER_MAX 56
+#endif
+
+typedef struct {
+ int n;
+ struct vorbis_info_psy *vi;
+
+ double ***curves;
+
+ double *ath;
+ int *pre;
+ double *octave;
+ int *post;
+
+} vorbis_look_psy;
+
+extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,int n,long rate);
+extern void _vp_psy_clear(vorbis_look_psy *p);
+extern void *_vi_psy_dup(void *source);
+extern void _vi_psy_free(vorbis_info_psy *i);
+extern void _vp_tone_tone_mask(vorbis_look_psy *p,double *f, double *floor,
+ int athp, int addp, int decayp,
+ double *decay);
+
+#endif
+
+