[xiph-cvs] cvs commit: Tremor Makefile.am codec_internal.h floor0.c floor1.c info.c ivorbiscodec.h ivorbisfile.h mapping0.c mdct.c res012.c vorbisfile.c block.c synthesis.c

Monty xiphmont at xiph.org
Tue Apr 22 02:00:50 PDT 2003



xiphmont    03/04/22 05:00:49

  Modified:    .        Tag: lowmem-branch Makefile.am codec_internal.h
                        floor0.c floor1.c info.c ivorbiscodec.h
                        ivorbisfile.h mapping0.c mdct.c res012.c
                        vorbisfile.c
  Removed:     .        Tag: lowmem-branch block.c synthesis.c
  Log:
  Scary data flow rearrangement with mdct refolding

Revision  Changes    Path
No                   revision

<p>No                   revision

<p>1.8.2.4   +1 -2      Tremor/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Tremor/Makefile.am,v
retrieving revision 1.8.2.3
retrieving revision 1.8.2.4
diff -u -r1.8.2.3 -r1.8.2.4
--- Makefile.am	14 Apr 2003 01:13:44 -0000	1.8.2.3
+++ Makefile.am	22 Apr 2003 09:00:49 -0000	1.8.2.4
@@ -4,8 +4,7 @@
 
 lib_LTLIBRARIES = libvorbisidec.la
 
-libvorbisidec_la_SOURCES = mdct.c block.c \
-                        synthesis.c info.c misc.c \
+libvorbisidec_la_SOURCES = mdct.c dsp.c info.c misc.c \
                         floor1.c floor0.c vorbisfile.c \
                         res012.c mapping0.c codebook.c \
                         framing.c bitwise.c \

<p><p>1.5.6.6   +49 -8     Tremor/codec_internal.h

Index: codec_internal.h
===================================================================
RCS file: /usr/local/cvsroot/Tremor/codec_internal.h,v
retrieving revision 1.5.6.5
retrieving revision 1.5.6.6
diff -u -r1.5.6.5 -r1.5.6.6
--- codec_internal.h	14 Apr 2003 05:26:09 -0000	1.5.6.5
+++ codec_internal.h	22 Apr 2003 09:00:49 -0000	1.5.6.6
@@ -30,19 +30,45 @@
 
 typedef void vorbis_info_floor;
 
+/* vorbis_dsp_state buffers the current vorbis audio
+   analysis/synthesis state.  The DSP state belongs to a specific
+   logical bitstream ****************************************************/
+struct vorbis_dsp_state{
+  vorbis_info    *vi;
+  oggpack_buffer  opb;
+
+  ogg_int32_t   **work;
+  ogg_int32_t   **mdctright;
+  int             out_begin;
+  int             out_end;
+
+  long lW;
+  long W;
+
+  ogg_int64_t granulepos;
+  ogg_int64_t sequence;
+  ogg_int64_t sample_count;
+
+};
+
+
 /* Floor backend generic *****************************************/
 
 extern vorbis_info_floor *floor0_info_unpack(vorbis_info *,oggpack_buffer *);
 extern void floor0_free_info(vorbis_info_floor *);
-extern void *floor0_inverse1(struct vorbis_block *,vorbis_info_floor *);
-extern int floor0_inverse2 (struct vorbis_block *,vorbis_info_floor *,
-			    void *buffer,ogg_int32_t *);
+extern int floor0_memosize(vorbis_info_floor *);
+extern ogg_int32_t *floor0_inverse1(struct vorbis_dsp_state *,
+				    vorbis_info_floor *,ogg_int32_t *);
+extern int floor0_inverse2 (struct vorbis_dsp_state *,vorbis_info_floor *,
+			    ogg_int32_t *buffer,ogg_int32_t *);
 
 extern vorbis_info_floor *floor1_info_unpack(vorbis_info *,oggpack_buffer *);
 extern void floor1_free_info(vorbis_info_floor *);
-extern void *floor1_inverse1(struct vorbis_block *,vorbis_info_floor *);
-extern int floor1_inverse2 (struct vorbis_block *,vorbis_info_floor *,
-			    void *buffer,ogg_int32_t *);
+extern int floor1_memosize(vorbis_info_floor *);
+extern ogg_int32_t *floor1_inverse1(struct vorbis_dsp_state *,
+				    vorbis_info_floor *,ogg_int32_t *);
+extern int floor1_inverse2 (struct vorbis_dsp_state *,vorbis_info_floor *,
+			    ogg_int32_t *buffer,ogg_int32_t *);
 
 typedef struct{
   int   order;
@@ -99,7 +125,7 @@
 extern void res_clear_info(vorbis_info_residue *info);
 extern int res_unpack(vorbis_info_residue *info,
                       vorbis_info *vi,oggpack_buffer *opb);
-extern int res_inverse(vorbis_block *vb,vorbis_info_residue *info,
+extern int res_inverse(vorbis_dsp_state *,vorbis_info_residue *info,
                        ogg_int32_t **in,int *nonzero,int ch);
 
 /* mode ************************************************************/
@@ -132,7 +158,7 @@
 extern int mapping_info_unpack(vorbis_info_mapping *,vorbis_info *,
                                oggpack_buffer *);
 extern void mapping_clear_info(vorbis_info_mapping *);
-extern int mapping_inverse(struct vorbis_block *vb,vorbis_info_mapping *);
+extern int mapping_inverse(struct vorbis_dsp_state *,vorbis_info_mapping *);
 
 /* codec_setup_info contains all the setup information specific to the
    specific compression/decompression mode in progress (eg,
@@ -166,5 +192,20 @@
   codebook               *book_param;
 
 } codec_setup_info;
+
+extern vorbis_dsp_state *vorbis_dsp_create(vorbis_info *vi);
+extern void     vorbis_dsp_destroy(vorbis_dsp_state *v);
+extern int      vorbis_dsp_headerin(vorbis_info *vi,vorbis_comment *vc,
+				    ogg_packet *op);
+
+extern int      vorbis_dsp_restart(vorbis_dsp_state *v);
+extern int      vorbis_dsp_synthesis(vorbis_dsp_state *vd,
+				     ogg_packet *op,int decodep);
+extern int      vorbis_dsp_pcmout(vorbis_dsp_state *v,
+				  ogg_int16_t *pcm,int samples);
+extern int      vorbis_dsp_read(vorbis_dsp_state *v,int samples);
+extern long     vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
+
+
 
 #endif

<p><p>1.4.6.7   +17 -13    Tremor/floor0.c

Index: floor0.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/floor0.c,v
retrieving revision 1.4.6.6
retrieving revision 1.4.6.7
diff -u -r1.4.6.6 -r1.4.6.7
--- floor0.c	14 Apr 2003 01:55:13 -0000	1.4.6.6
+++ floor0.c	22 Apr 2003 09:00:49 -0000	1.4.6.7
@@ -365,25 +365,29 @@
   return(NULL);
 }
 
-void *floor0_inverse1(vorbis_block *vb,vorbis_info_floor *i){
+int floor0_memosize(vorbis_info_floor *i){
+  vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
+  return info->order+1;
+}
+
+ogg_int32_t *floor0_inverse1(vorbis_dsp_state *vd,vorbis_info_floor *i,
+			     ogg_int32_t *lsp){
   vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
   int j,k;
   
-  int ampraw=oggpack_read(&vb->opb,info->ampbits);
+  int ampraw=oggpack_read(&vd->opb,info->ampbits);
   if(ampraw>0){ /* also handles the -1 out of data case */
     long maxval=(1<<info->ampbits)-1;
     int amp=((ampraw*info->ampdB)<<4)/maxval;
-    int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks));
+    int booknum=oggpack_read(&vd->opb,_ilog(info->numbooks));
     
     if(booknum!=-1 && booknum<info->numbooks){ /* be paranoid */
-      codec_setup_info  *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
+      codec_setup_info  *ci=(codec_setup_info *)vd->vi->codec_setup;
       codebook *b=ci->book_param+info->books[booknum];
       ogg_int32_t last=0;
-      ogg_int32_t *lsp=
-	(ogg_int32_t *)_vorbis_block_alloc(vb,sizeof(*lsp)*(info->order+1));
             
       for(j=0;j<info->order;j+=b->dim)
-	if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim,-24)==-1)goto eop;
+	if(vorbis_book_decodev_set(b,lsp+j,&vd->opb,b->dim,-24)==-1)goto eop;
       for(j=0;j<info->order;){
         for(k=0;k<b->dim;k++,j++)lsp[j]+=last;
         last=lsp[j-1];
@@ -397,21 +401,21 @@
   return(NULL);
 }
 
-int floor0_inverse2(vorbis_block *vb,vorbis_info_floor *i,
-			   void *memo,ogg_int32_t *out){
+int floor0_inverse2(vorbis_dsp_state *vd,vorbis_info_floor *i,
+			   ogg_int32_t *lsp,ogg_int32_t *out){
   vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
+  codec_setup_info  *ci=(codec_setup_info *)vd->vi->codec_setup;
   
-  if(memo){
-    ogg_int32_t *lsp=(ogg_int32_t *)memo;
+  if(lsp){
     ogg_int32_t amp=lsp[info->order];
 
     /* take the coefficients back to a spectral envelope curve */
-    vorbis_lsp_to_curve(out,vb->pcmend/2,info->barkmap,
+    vorbis_lsp_to_curve(out,ci->blocksizes[vd->W]/2,info->barkmap,
                         lsp,info->order,amp,info->ampdB,
                         info->rate>>1);
     return(1);
   }
-  memset(out,0,sizeof(*out)*vb->pcmend/2);
+  memset(out,0,sizeof(*out)*ci->blocksizes[vd->W]/2);
   return(0);
 }
 

<p><p>1.6.6.7   +18 -16    Tremor/floor1.c

Index: floor1.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/floor1.c,v
retrieving revision 1.6.6.6
retrieving revision 1.6.6.7
diff -u -r1.6.6.6 -r1.6.6.7
--- floor1.c	14 Apr 2003 01:13:44 -0000	1.6.6.6
+++ floor1.c	22 Apr 2003 09:00:49 -0000	1.6.6.7
@@ -269,23 +269,26 @@
   }
 }
 
+int floor1_memosize(vorbis_info_floor *i){
+  vorbis_info_floor1 *info=(vorbis_info_floor1 *)i;
+  return info->posts;
+}
+
 static int quant_look[4]={256,128,86,64};
 
-void *floor1_inverse1(vorbis_block *vb,vorbis_info_floor *in){
+ogg_int32_t *floor1_inverse1(vorbis_dsp_state *vd,vorbis_info_floor *in,
+			     ogg_int32_t *fit_value){
   vorbis_info_floor1 *info=(vorbis_info_floor1 *)in;
-  codec_setup_info   *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
+  codec_setup_info   *ci=(codec_setup_info *)vd->vi->codec_setup;
   
   int i,j,k;
   codebook *books=ci->book_param;   
   int quant_q=quant_look[info->mult-1];
 
   /* unpack wrapped/predicted values from stream */
-  if(oggpack_read(&vb->opb,1)==1){
-    int *fit_value=
-      (int *)_vorbis_block_alloc(vb,(info->posts)*sizeof(*fit_value));
-    
-    fit_value[0]=oggpack_read(&vb->opb,ilog(quant_q-1));
-    fit_value[1]=oggpack_read(&vb->opb,ilog(quant_q-1));
+  if(oggpack_read(&vd->opb,1)==1){
+    fit_value[0]=oggpack_read(&vd->opb,ilog(quant_q-1));
+    fit_value[1]=oggpack_read(&vd->opb,ilog(quant_q-1));
     
     /* partition by partition */
     /* partition by partition */
@@ -298,7 +301,7 @@
 
       /* decode the partition's first stage cascade value */
       if(csubbits){
-	cval=vorbis_book_decode(books+info->class[classv].class_book,&vb->opb);
+	cval=vorbis_book_decode(books+info->class[classv].class_book,&vd->opb);
 
         if(cval==-1)goto eop;
       }
@@ -307,7 +310,7 @@
         int book=info->class[classv].class_subbook[cval&(csub-1)];
         cval>>=csubbits;
         if(book!=0xff){
-	  if((fit_value[j+k]=vorbis_book_decode(books+book,&vb->opb))==-1)
+	  if((fit_value[j+k]=vorbis_book_decode(books+book,&vd->opb))==-1)
             goto eop;
         }else{
           fit_value[j+k]=0;
@@ -359,17 +362,16 @@
   return(NULL);
 }
 
-int floor1_inverse2(vorbis_block *vb,vorbis_info_floor *in,void *memo,
-			  ogg_int32_t *out){
+int floor1_inverse2(vorbis_dsp_state *vd,vorbis_info_floor *in,
+		    ogg_int32_t *fit_value,ogg_int32_t *out){
   vorbis_info_floor1 *info=(vorbis_info_floor1 *)in;
 
-  codec_setup_info   *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
-  int                  n=ci->blocksizes[vb->W]/2;
+  codec_setup_info   *ci=(codec_setup_info *)vd->vi->codec_setup;
+  int                  n=ci->blocksizes[vd->W]/2;
   int j;
 
-  if(memo){
+  if(fit_value){
     /* render the lines */
-    int *fit_value=(int *)memo;
     int hx=0;
     int lx=0;
     int ly=fit_value[0]*info->mult;

<p><p>1.3.2.6   +1 -1      Tremor/info.c

Index: info.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/info.c,v
retrieving revision 1.3.2.5
retrieving revision 1.3.2.6
diff -u -r1.3.2.5 -r1.3.2.6
--- info.c	14 Apr 2003 06:40:51 -0000	1.3.2.5
+++ info.c	22 Apr 2003 09:00:49 -0000	1.3.2.6
@@ -284,7 +284,7 @@
    with bitstream comments and a third packet that holds the
    codebook. */
 
-int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){
+int vorbis_dsp_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){
   oggpack_buffer opb;
   
   if(op){

<p><p>1.3.2.3   +3 -98     Tremor/ivorbiscodec.h

Index: ivorbiscodec.h
===================================================================
RCS file: /usr/local/cvsroot/Tremor/ivorbiscodec.h,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -u -r1.3.2.2 -r1.3.2.3
--- ivorbiscodec.h	14 Apr 2003 06:40:51 -0000	1.3.2.2
+++ ivorbiscodec.h	22 Apr 2003 09:00:49 -0000	1.3.2.3
@@ -25,6 +25,9 @@
 
 #include "ogg.h"
 
+struct vorbis_dsp_state;
+typedef struct vorbis_dsp_state vorbis_dsp_state;
+
 typedef struct vorbis_info{
   int version;
   int channels;
@@ -53,76 +56,7 @@
   void *codec_setup;
 } vorbis_info;
 
-/* vorbis_dsp_state buffers the current vorbis audio
-   analysis/synthesis state.  The DSP state belongs to a specific
-   logical bitstream ****************************************************/
-typedef struct vorbis_dsp_state{
-  vorbis_info *vi;
-
-  ogg_int32_t **pcm;
-  ogg_int32_t **pcmret;
-  int      pcm_storage;
-  int      pcm_current;
-  int      pcm_returned;
-
-  long lW;
-  long W;
-  long nW;
-  long centerW;
-
-  ogg_int64_t granulepos;
-  ogg_int64_t sequence;
-  ogg_int64_t sample_count;
-
-} vorbis_dsp_state;
-
-typedef struct vorbis_block{
-  /* necessary stream state for linking to the framing abstraction */
-  ogg_int32_t  **pcm;       /* this is a pointer into local storage */ 
-  oggpack_buffer opb;
-  
-  long  lW;
-  long  W;
-  long  nW;
-  int   pcmend;
-  int   mode;
-
-  int         eofflag;
-  ogg_int64_t granulepos;
-  ogg_int64_t sequence;
-  vorbis_dsp_state *vd; /* For read-only access of configuration */
-
-  /* local storage to avoid remallocing; it's up to the mapping to
-     structure it */
-  void               *localstore;
-  long                localtop;
-  long                localalloc;
-  long                totaluse;
-  struct alloc_chain *reap;
-
-} vorbis_block;
-
-/* vorbis_block is a single block of data to be processed as part of
-the analysis/synthesis stream; it belongs to a specific logical
-bitstream, but is independant from other vorbis_blocks belonging to
-that logical bitstream. *************************************************/
-
-struct alloc_chain{
-  void *ptr;
-  struct alloc_chain *next;
-};
-
-/* vorbis_info contains all the setup information specific to the
-   specific compression/decompression mode in progress (eg,
-   psychoacoustic settings, channel setup, options, codebook
-   etc). vorbis_info and substructures are in backends.h.
-*********************************************************************/
-
-/* the comments are not part of vorbis_info so that vorbis_info can be
-   static storage */
 typedef struct vorbis_comment{
-  /* unlimited user comment fields.  libvorbis writes 'libvorbis'
-     whatever vendor is set to in encode */
   char **user_comments;
   int   *comment_lengths;
   int    comments;
@@ -131,18 +65,6 @@
 } vorbis_comment;
 
 
-/* libvorbis encodes in two abstraction layers; first we perform DSP
-   and produce a packet (see docs/analysis.txt).  The packet is then
-   coded into a framed OggSquish bitstream by the second layer (see
-   docs/framing.txt).  Decode is the reverse process; we sync/frame
-   the bitstream and extract individual packets, then decode the
-   packet back into PCM audio.
-
-   The extra framing/packetizing is used in streaming formats, such as
-   files.  Over the net (such as with UDP), the framing and
-   packetization aren't necessary as they're provided by the transport
-   and the streaming layer is not used */
-
 /* Vorbis PRIMITIVES: general ***************************************/
 
 extern void     vorbis_info_init(vorbis_info *vi);
@@ -155,23 +77,6 @@
 extern char    *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);
 extern int      vorbis_comment_query_count(vorbis_comment *vc, char *tag);
 extern void     vorbis_comment_clear(vorbis_comment *vc);
-
-extern vorbis_block *vorbis_block_create(vorbis_dsp_state *v);
-extern int      vorbis_block_destroy(vorbis_block *vb);
-
-extern vorbis_dsp_state *vorbis_dsp_create(vorbis_info *vi);
-extern void     vorbis_dsp_destroy(vorbis_dsp_state *v);
-
-/* Vorbis PRIMITIVES: synthesis layer *******************************/
-extern int      vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
-					  ogg_packet *op);
-
-extern int      vorbis_synthesis_restart(vorbis_dsp_state *v);
-extern int      vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep);
-extern int      vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
-extern int      vorbis_synthesis_pcmout(vorbis_dsp_state *v,ogg_int32_t ***pcm);
-extern int      vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
-extern long     vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
 
 /* Vorbis ERRORS and return codes ***********************************/
 

<p><p>1.3.2.2   +1 -2      Tremor/ivorbisfile.h

Index: ivorbisfile.h
===================================================================
RCS file: /usr/local/cvsroot/Tremor/ivorbisfile.h,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -u -r1.3.2.1 -r1.3.2.2
--- ivorbisfile.h	14 Apr 2003 06:40:51 -0000	1.3.2.1
+++ ivorbisfile.h	22 Apr 2003 09:00:49 -0000	1.3.2.2
@@ -79,7 +79,6 @@
   ogg_stream_state *os; /* take physical pages, weld into a logical
                           stream of packets */
   vorbis_dsp_state *vd; /* central working state for the packet->PCM decoder */
-  vorbis_block     *vb; /* local working space for packet->PCM decode */
 
   ov_callbacks callbacks;
 
@@ -118,7 +117,7 @@
 extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
 extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
 
-extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
+extern long ov_read(OggVorbis_File *vf,void *buffer,int length,
                     int *bitstream);
 
 #ifdef __cplusplus

<p><p>1.3.6.7   +20 -90    Tremor/mapping0.c

Index: mapping0.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/mapping0.c,v
retrieving revision 1.3.6.6
retrieving revision 1.3.6.7
diff -u -r1.3.6.6 -r1.3.6.7
--- mapping0.c	14 Apr 2003 05:26:09 -0000	1.3.6.6
+++ mapping0.c	22 Apr 2003 09:00:49 -0000	1.3.6.7
@@ -25,63 +25,6 @@
 #include "codec_internal.h"
 #include "codebook.h"
 #include "misc.h"
-#include "window_lookup.h"
-
-static const void *_vorbis_window(int left){
-  switch(left){
-  case 32:
-    return vwin64;
-  case 64:
-    return vwin128;
-  case 128:
-    return vwin256;
-  case 256:
-    return vwin512;
-  case 512:
-    return vwin1024;
-  case 1024:
-    return vwin2048;
-  case 2048:
-    return vwin4096;
-  case 4096:
-    return vwin8192;
-  default:
-    return(0);
-  }
-}
-
-static void _vorbis_apply_window(ogg_int32_t *d,
-				 long *blocksizes,
-				 int lW,int W,int nW){
-  
-  LOOKUP_T *window[2];
-  long n=blocksizes[W];
-  long ln=blocksizes[lW];
-  long rn=blocksizes[nW];
-
-  long leftbegin=n/4-ln/4;
-  long leftend=leftbegin+ln/2;
-
-  long rightbegin=n/2+n/4-rn/4;
-  long rightend=rightbegin+rn/2;
-  
-  int i,p;
-
-  window[0]=_vorbis_window(blocksizes[0]>>1);
-  window[1]=_vorbis_window(blocksizes[1]>>1);
-
-  for(i=0;i<leftbegin;i++)
-    d[i]=0;
-
-  for(p=0;i<leftend;i++,p++)
-    d[i]=MULT31(d[i],window[lW][p]);
-
-  for(i=rightbegin,p=rn/2-1;i<rightend;i++,p--)
-    d[i]=MULT31(d[i],window[nW][p]);
-
-  for(;i<n;i++)
-    d[i]=0;
-}
 
 void mapping_clear_info(vorbis_info_mapping *info){
   if(info){
@@ -158,13 +101,12 @@
   return -1;
 }
 
-int mapping_inverse(vorbis_block *vb,vorbis_info_mapping *info){
-  vorbis_dsp_state     *vd=vb->vd;
+int mapping_inverse(vorbis_dsp_state *vd,vorbis_info_mapping *info){
   vorbis_info          *vi=vd->vi;
   codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
 
   int                   i,j;
-  long                  n=vb->pcmend=ci->blocksizes[vb->W];
+  long                  n=ci->blocksizes[vd->W];
 
   ogg_int32_t **pcmbundle=
     (ogg_int32_t **)alloca(sizeof(*pcmbundle)*vi->channels);
@@ -172,7 +114,7 @@
     (int *)alloca(sizeof(*zerobundle)*vi->channels);
   int          *nonzero=
     (int *)alloca(sizeof(*nonzero)*vi->channels);
-  void        **floormemo=
+  ogg_int32_t **floormemo=
     (void **)alloca(sizeof(*floormemo)*vi->channels);
   
   /* recover the spectral envelope; store it in the PCM vector for now */
@@ -186,17 +128,21 @@
     
     if(ci->floor_type[floorno]){
       /* floor 1 */
-      floormemo[i]=floor1_inverse1(vb,ci->floor_param[floorno]);
+      floormemo[i]=alloca(sizeof(*floormemo[i])*
+			  floor1_memosize(ci->floor_param[floorno]));
+      floormemo[i]=floor1_inverse1(vd,ci->floor_param[floorno],floormemo[i]);
     }else{
       /* floor 0 */
-      floormemo[i]=floor0_inverse1(vb,ci->floor_param[floorno]);
+      floormemo[i]=alloca(sizeof(*floormemo[i])*
+			  floor0_memosize(ci->floor_param[floorno]));
+      floormemo[i]=floor0_inverse1(vd,ci->floor_param[floorno],floormemo[i]);
     }
-
+    
     if(floormemo[i])
       nonzero[i]=1;
     else
       nonzero[i]=0;      
-    memset(vb->pcm[i],0,sizeof(*vb->pcm[i])*n/2);
+    memset(vd->work[i],0,sizeof(*vd->work[i])*n/2);
   }
 
   /* channel coupling can 'dirty' the nonzero listing */
@@ -217,11 +163,11 @@
           zerobundle[ch_in_bundle]=1;
         else
           zerobundle[ch_in_bundle]=0;
-	pcmbundle[ch_in_bundle++]=vb->pcm[j];
+	pcmbundle[ch_in_bundle++]=vd->work[j];
       }
     }
     
-    res_inverse(vb,ci->residue_param+info->submaplist[i].residue,
+    res_inverse(vd,ci->residue_param+info->submaplist[i].residue,
                 pcmbundle,zerobundle,ch_in_bundle);
   }
 
@@ -230,8 +176,8 @@
 
   /* channel coupling */
   for(i=info->coupling_steps-1;i>=0;i--){
-    ogg_int32_t *pcmM=vb->pcm[info->coupling[i].mag];
-    ogg_int32_t *pcmA=vb->pcm[info->coupling[i].ang];
+    ogg_int32_t *pcmM=vd->work[info->coupling[i].mag];
+    ogg_int32_t *pcmA=vd->work[info->coupling[i].ang];
     
     for(j=0;j<n/2;j++){
       ogg_int32_t mag=pcmM[j];
@@ -261,7 +207,7 @@
 
   /* compute and apply spectral envelope */
   for(i=0;i<vi->channels;i++){
-    ogg_int32_t *pcm=vb->pcm[i];
+    ogg_int32_t *pcm=vd->work[i];
     int submap=0;
     int floorno;
 
@@ -271,10 +217,10 @@
 
     if(ci->floor_type[floorno]){
       /* floor 1 */
-      floor1_inverse2(vb,ci->floor_param[floorno],floormemo[i],pcm);
+      floor1_inverse2(vd,ci->floor_param[floorno],floormemo[i],pcm);
     }else{
       /* floor 0 */
-      floor0_inverse2(vb,ci->floor_param[floorno],floormemo[i],pcm);
+      floor0_inverse2(vd,ci->floor_param[floorno],floormemo[i],pcm);
     }
   }
 
@@ -283,27 +229,11 @@
 
   /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
   /* only MDCT right now.... */
-  for(i=0;i<vi->channels;i++){
-    ogg_int32_t *pcm=vb->pcm[i];
-    mdct_backward(n,pcm,pcm);
-  }
+  for(i=0;i<vi->channels;i++)
+    mdct_backward(n,vd->work[i]);
 
   //for(j=0;j<vi->channels;j++)
   //_analysis_output("imdct",seq+j,vb->pcm[j],-24,n,0,0);
-
-  /* window the data */
-  for(i=0;i<vi->channels;i++){
-    ogg_int32_t *pcm=vb->pcm[i];
-    if(nonzero[i])
-      _vorbis_apply_window(pcm,ci->blocksizes,vb->lW,vb->W,vb->nW);
-    else
-      for(j=0;j<n;j++)
-	pcm[j]=0;
-    
-  }
-
-  //for(j=0;j<vi->channels;j++)
-  //_analysis_output("window",seq+j,vb->pcm[j],-24,n,0,0);
 
   /* all done! */
   return(0);

<p><p>1.9.6.4   +2 -2      Tremor/mdct.c

Index: mdct.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/mdct.c,v
retrieving revision 1.9.6.3
retrieving revision 1.9.6.4
diff -u -r1.9.6.3 -r1.9.6.4
--- mdct.c	22 Apr 2003 06:58:24 -0000	1.9.6.3
+++ mdct.c	22 Apr 2003 09:00:49 -0000	1.9.6.4
@@ -13,7 +13,7 @@
 
  function: normalized modified discrete cosine transform
            power of two length transform only [64 <= n ]
- last mod: $Id: mdct.c,v 1.9.6.3 2003/04/22 06:58:24 xiphmont Exp $
+ last mod: $Id: mdct.c,v 1.9.6.4 2003/04/22 09:00:49 xiphmont Exp $
 
  Original algorithm adapted long ago from _The use of multirate filter
  banks for coding of high quality digital audio_, by T. Sporer,
@@ -434,7 +434,7 @@
     start -= off;
     end   -= n;
     while(r>post){
-      out++ = CLIP_TO_15((*--r)>>9);
+      *out = CLIP_TO_15((*--r)>>9);
       out+=step;
     }
   }

<p><p>1.2.6.3   +9 -9      Tremor/res012.c

Index: res012.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/res012.c,v
retrieving revision 1.2.6.2
retrieving revision 1.2.6.3
diff -u -r1.2.6.2 -r1.2.6.3
--- res012.c	13 Apr 2003 09:03:09 -0000	1.2.6.2
+++ res012.c	22 Apr 2003 09:00:49 -0000	1.2.6.3
@@ -88,11 +88,11 @@
   return 1;
 }
 
-int res_inverse(vorbis_block *vb,vorbis_info_residue *info,
+int res_inverse(vorbis_dsp_state *vd,vorbis_info_residue *info,
                 ogg_int32_t **in,int *nonzero,int ch){
   
   int i,j,k,s,used=0;
-  codec_setup_info     *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
+  codec_setup_info     *ci=(codec_setup_info *)vd->vi->codec_setup;
   codebook *phrasebook=ci->book_param+info->groupbook;
   int samples_per_partition=info->grouping;
   int partitions_per_word=phrasebook->dim;
@@ -128,8 +128,8 @@
                 partword[j][i+k]=partword[j-1][i+k];
             
             for(j=0;j<ch;j++){
-	      int temp=vorbis_book_decode(phrasebook,&vb->opb);
-	      if(oggpack_eop(&vb->opb))goto eopbreak;
+	      int temp=vorbis_book_decode(phrasebook,&vd->opb);
+	      if(oggpack_eop(&vd->opb))goto eopbreak;
               
               /* this can be done quickly in assembly due to the quotient
                  always being at most six bits */
@@ -150,11 +150,11 @@
                 codebook *stagebook=ci->book_param+
                   info->stagebooks[(partword[j][i]<<3)+s];
                 if(info->type){
-		  if(vorbis_book_decodev_add(stagebook,in[j]+offset,&vb->opb,
+		  if(vorbis_book_decodev_add(stagebook,in[j]+offset,&vd->opb,
                                              samples_per_partition,-8)==-1)
                     goto eopbreak;
                 }else{
-		  if(vorbis_book_decodevs_add(stagebook,in[j]+offset,&vb->opb,
+		  if(vorbis_book_decodevs_add(stagebook,in[j]+offset,&vd->opb,
                                               samples_per_partition,-8)==-1)
                     goto eopbreak;
                 }
@@ -184,8 +184,8 @@
             partword[i+k]=partword[i+k+1]*info->partitions;
           
           /* fetch the partition word */
-	  temp=vorbis_book_decode(phrasebook,&vb->opb);
-	  if(oggpack_eop(&vb->opb))goto eopbreak;
+	  temp=vorbis_book_decode(phrasebook,&vd->opb);
+	  if(oggpack_eop(&vd->opb))goto eopbreak;
           
           /* this can be done quickly in assembly due to the quotient
              always being at most six bits */
@@ -203,7 +203,7 @@
               info->stagebooks[(partword[i]<<3)+s];
             if(vorbis_book_decodevv_add(stagebook,in,
                                         i*samples_per_partition+beginoff,ch,
-					&vb->opb,
+					&vd->opb,
                                         samples_per_partition,-8)==-1)
               goto eopbreak;
           }

<p><p>1.6.2.3   +27 -67    Tremor/vorbisfile.c

Index: vorbisfile.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/vorbisfile.c,v
retrieving revision 1.6.2.2
retrieving revision 1.6.2.3
diff -u -r1.6.2.2 -r1.6.2.3
--- vorbisfile.c	14 Apr 2003 06:40:51 -0000	1.6.2.2
+++ vorbisfile.c	22 Apr 2003 09:00:49 -0000	1.6.2.3
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.c,v 1.6.2.2 2003/04/14 06:40:51 xiphmont Exp $
+ last mod: $Id: vorbisfile.c,v 1.6.2.3 2003/04/22 09:00:49 xiphmont Exp $
 
  ********************************************************************/
 
@@ -22,7 +22,7 @@
 #include <string.h>
 #include <math.h>
 
-#include "ivorbiscodec.h"
+#include "codec_internal.h"
 #include "ivorbisfile.h"
 
 #include "os.h"
@@ -269,7 +269,7 @@
         ret=OV_EBADHEADER;
         goto bail_header;
       }
-      if((ret=vorbis_synthesis_headerin(vi,vc,&op))){
+      if((ret=vorbis_dsp_headerin(vi,vc,&op))){
         goto bail_header;
       }
       i++;
@@ -413,7 +413,6 @@
   }else{
     vf->vd=vorbis_dsp_create(vf->vi);
   }    
-  vf->vb=vorbis_block_create(vf->vd);
   vf->ready_state=INITSET;
   vf->bittrack=0;
   vf->samptrack=0;
@@ -462,9 +461,7 @@
 /* clear out the current logical bitstream decoder */ 
 static void _decode_clear(OggVorbis_File *vf){
   vorbis_dsp_destroy(vf->vd);
-  vorbis_block_destroy(vf->vb);
   vf->vd=0;
-  vf->vb=0;
   vf->ready_state=OPENED;
 }
 
@@ -504,28 +501,16 @@
         if(result>0){
           /* got a packet.  process it */
           granulepos=op.granulepos;
-	  if(!vorbis_synthesis(vf->vb,&op,1)){ /* lazy check for lazy
+	  if(!vorbis_dsp_synthesis(vf->vd,&op,1)){ /* lazy check for lazy
                                                       header handling.  The
                                                       header packets aren't
                                                       audio, so if/when we
                                                       submit them,
                                                       vorbis_synthesis will
                                                       reject them */
-
-	    /* suck in the synthesis data and track bitrate */
-	    {
-	      int oldsamples=vorbis_synthesis_pcmout(vf->vd,NULL);
-	      /* for proper use of libvorbis within libvorbisfile,
-                 oldsamples will always be zero. */
-	      if(oldsamples){
-		ret=OV_EFAULT;
-		goto cleanup;
-	      }
-
-	      vorbis_synthesis_blockin(vf->vd,vf->vb);
-	      vf->samptrack+=vorbis_synthesis_pcmout(vf->vd,NULL)-oldsamples;
-	      vf->bittrack+=op.bytes*8;
-	    }
+	    
+	    vf->samptrack+=vorbis_dsp_pcmout(vf->vd,NULL,0);
+	    vf->bittrack+=op.bytes*8;
           
             /* update the pcm offset. */
             if(granulepos!=-1 && !op.e_o_s){
@@ -552,7 +537,7 @@
                                                here unless the stream
                                                is very broken */
 
-	      samples=vorbis_synthesis_pcmout(vf->vd,NULL);
+	      samples=vorbis_dsp_pcmout(vf->vd,NULL,0);
             
               granulepos-=samples;
               for(i=0;i<link;i++)
@@ -728,10 +713,8 @@
 /* clear out the OggVorbis_File struct */
 int ov_clear(OggVorbis_File *vf){
   if(vf){
-    vorbis_block_destroy(vf->vb);
     vorbis_dsp_destroy(vf->vd);
     vf->vd=0;
-    vf->vb=0;
     ogg_stream_destroy(vf->os);
     
     if(vf->vi && vf->links){
@@ -974,7 +957,7 @@
   vf->pcm_offset=-1;
   ogg_stream_reset_serialno(vf->os,
                             vf->current_serialno); /* must set serialno */
-  vorbis_synthesis_restart(vf->vd);
+  vorbis_dsp_restart(vf->vd);
     
   _seek_helper(vf,pos);
 
@@ -1218,7 +1201,7 @@
         vf->ready_state=STREAMSET;
         
       }else{
-	vorbis_synthesis_restart(vf->vd);
+	vorbis_dsp_restart(vf->vd);
       }
 
       ogg_stream_reset_serialno(vf->os,vf->current_serialno);
@@ -1313,10 +1296,9 @@
       
       /* remove the packet from packet queue and track its granulepos */
       ogg_stream_packetout(vf->os,NULL);
-      vorbis_synthesis(vf->vb,&op,0);  /* set up a vb with
-					   only tracking, no
-					   pcm_decode */
-      vorbis_synthesis_blockin(vf->vd,vf->vb); 
+      vorbis_dsp_synthesis(vf->vd,&op,0);  /* set up a vb with
+					      only tracking, no
+					      pcm_decode */
       
       /* end of logical stream case is hard, especially with exact
          length positioning. */
@@ -1368,10 +1350,10 @@
      logical bitstream boundary with abandon is OK. */
   while(vf->pcm_offset<pos){
     ogg_int64_t target=pos-vf->pcm_offset;
-    long samples=vorbis_synthesis_pcmout(vf->vd,NULL);
+    long samples=vorbis_dsp_pcmout(vf->vd,NULL,0);
 
     if(samples>target)samples=target;
-    vorbis_synthesis_read(vf->vd,samples);
+    vorbis_dsp_read(vf->vd,samples);
     vf->pcm_offset+=samples;
     
     if(samples<target)
@@ -1543,18 +1525,27 @@
 
             *section) set to the logical bitstream number */
 
-long ov_read(OggVorbis_File *vf,char *buffer,int bytes_req,int *bitstream){
+long ov_read(OggVorbis_File *vf,void *buffer,int bytes_req,int *bitstream){
   int i,j;
 
-  ogg_int32_t **pcm;
   long samples;
+  long channels;
 
   if(vf->ready_state<OPENED)return(OV_EINVAL);
 
   while(1){
     if(vf->ready_state==INITSET){
-      samples=vorbis_synthesis_pcmout(vf->vd,&pcm);
-      if(samples)break;
+      channels=ov_info(vf,-1)->channels;
+      samples=vorbis_dsp_pcmout(vf->vd,buffer,(bytes_req>>1)/channels);
+      if(samples){
+	if(samples>0){
+	  vorbis_dsp_read(vf->vd,samples);
+	  vf->pcm_offset+=samples;
+	  if(bitstream)*bitstream=vf->current_link;
+	  return(samples*2*channels);
+	}
+	return(samples);
+      }
     }
 
     /* suck in another packet */
@@ -1566,36 +1557,5 @@
         return(ret);
     }
 
-  }
-
-  if(samples>0){
-  
-    /* yay! proceed to pack data into the byte buffer */
-    
-    long channels=ov_info(vf,-1)->channels;
-
-    if(channels==1){
-      if(samples>(bytes_req/2))
-        samples=bytes_req/2;      
-    }else{
-      if(samples>(bytes_req/4))
-        samples=bytes_req/4;
-    }
-    
-    for(i=0;i<channels;i++) { /* It's faster in this order */
-      ogg_int32_t *src=pcm[i];
-      short *dest=((short *)buffer)+i;
-      for(j=0;j<samples;j++) {
-        *dest=CLIP_TO_15(src[j]>>9);
-        dest+=channels;
-      }
-    }
-    
-    vorbis_synthesis_read(vf->vd,samples);
-    vf->pcm_offset+=samples;
-    if(bitstream)*bitstream=vf->current_link;
-    return(samples*2*channels);
-  }else{
-    return(samples);
   }
 }

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list