[xiph-commits] r15095 - branches/theora-thusnelda/lib/enc

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Jul 1 01:48:17 PDT 2008


Author: xiphmont
Date: 2008-07-01 01:48:16 -0700 (Tue, 01 Jul 2008)
New Revision: 15095

Modified:
   branches/theora-thusnelda/lib/enc/codec_internal.h
   branches/theora-thusnelda/lib/enc/dct_encode.c
   branches/theora-thusnelda/lib/enc/frinit.c
   branches/theora-thusnelda/lib/enc/mode.c
Log:
full-frame dct coeff storage array eliminated.  Tokenization is 
successfully moved to within the single transform pass.



Modified: branches/theora-thusnelda/lib/enc/codec_internal.h
===================================================================
--- branches/theora-thusnelda/lib/enc/codec_internal.h	2008-07-01 00:30:39 UTC (rev 15094)
+++ branches/theora-thusnelda/lib/enc/codec_internal.h	2008-07-01 08:48:16 UTC (rev 15095)
@@ -100,10 +100,6 @@
   ogg_uint32_t       Frequency;
 } HUFF_ENTRY;
 
-typedef struct {
-  ogg_int16_t data[64];
-} dct_t;
-
 typedef struct{
   ogg_int32_t   x;
   ogg_int32_t   y;
@@ -206,7 +202,6 @@
   unsigned char   *frag_coded;
   ogg_uint32_t    *frag_buffer_index;
   ogg_int16_t     *frag_dc;
-  dct_t           *frag_dct;
 
   macroblock_t    *macro;
   superblock_t    *super[3];
@@ -322,7 +317,7 @@
 extern void fdct_short ( ogg_int16_t *InputData, ogg_int16_t *OutputData );
 
 extern void dct_tokenize_init (CP_INSTANCE *cpi);
-extern void dct_tokenize_AC (CP_INSTANCE *cpi, int fi, int chroma);
+extern void dct_tokenize_AC (CP_INSTANCE *cpi, int fi, ogg_int16_t *dct, int chroma);
 extern void dct_tokenize_finish (CP_INSTANCE *cpi);
 
 extern void WriteQTables(CP_INSTANCE *cpi,oggpack_buffer *opb);

Modified: branches/theora-thusnelda/lib/enc/dct_encode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/dct_encode.c	2008-07-01 00:30:39 UTC (rev 15094)
+++ branches/theora-thusnelda/lib/enc/dct_encode.c	2008-07-01 08:48:16 UTC (rev 15095)
@@ -308,17 +308,16 @@
    not a true assumption but it can be fixed-up as DC is tokenized
    later */
 
-void dct_tokenize_AC(CP_INSTANCE *cpi, int fi, int chroma){
+void dct_tokenize_AC(CP_INSTANCE *cpi, int fi, ogg_int16_t *dct, int chroma){
   int coeff = 1; /* skip DC for now */
-  dct_t *dct = &cpi->frag_dct[fi];
   
   while(coeff < BLOCK_SIZE){
-    ogg_int16_t val = dct->data[coeff];
+    ogg_int16_t val = dct[coeff];
     int zero_run;
     int i = coeff;
     
     while( !val && (++i < BLOCK_SIZE) )
-      val = dct->data[i];
+      val = dct[i];
     
     if ( i == BLOCK_SIZE ){
       

Modified: branches/theora-thusnelda/lib/enc/frinit.c
===================================================================
--- branches/theora-thusnelda/lib/enc/frinit.c	2008-07-01 00:30:39 UTC (rev 15094)
+++ branches/theora-thusnelda/lib/enc/frinit.c	2008-07-01 08:48:16 UTC (rev 15095)
@@ -30,7 +30,6 @@
   if(cpi->dct_token_eb_storage) _ogg_free(cpi->dct_token_eb_storage);
   if(cpi->frag_coded) _ogg_free(cpi->frag_coded);
   if(cpi->frag_buffer_index) _ogg_free(cpi->frag_buffer_index);
-  if(cpi->frag_dct) _ogg_free(cpi->frag_dct);
   if(cpi->frag_dc) _ogg_free(cpi->frag_dc);
 #ifdef COLLECT_METRICS
   if(cpi->frag_mbi) _ogg_free(cpi->frag_mbi);
@@ -120,7 +119,6 @@
   /* +1; the last entry is the 'invalid' frag, which is always set to not coded as it doesn't really exist */
   cpi->frag_coded = calloc(cpi->frag_total+1, sizeof(*cpi->frag_coded)); 
   cpi->frag_buffer_index = calloc(cpi->frag_total, sizeof(*cpi->frag_buffer_index));
-  cpi->frag_dct = calloc(cpi->frag_total, sizeof(*cpi->frag_dct));
   cpi->frag_dc = calloc(cpi->frag_total, sizeof(*cpi->frag_dc));
 
   /* +1; the last entry is the 'invalid' mb, which contains only 'invalid' frags */

Modified: branches/theora-thusnelda/lib/enc/mode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/mode.c	2008-07-01 00:30:39 UTC (rev 15094)
+++ branches/theora-thusnelda/lib/enc/mode.c	2008-07-01 08:48:16 UTC (rev 15095)
@@ -553,13 +553,13 @@
 }
 
 static int TQB (CP_INSTANCE *cpi, plane_state_t *ps, int mode, int fi, mv_t mv, 
-		int uncoded_overhead, int coded_overhead, rd_metric_t *mo, long *rho_count){
+		int uncoded_overhead, int coded_overhead, rd_metric_t *mo, long *rho_count,
+		ogg_int16_t *data){
   
   int keyframe = (cpi->FrameType == KEY_FRAME);
   int qi = ps->qi;
   ogg_int32_t *iq = ps->iq[mode != CODE_INTRA];
   ogg_int16_t buffer[64];
-  ogg_int16_t *data = cpi->frag_dct[fi].data;
   int bi = cpi->frag_buffer_index[fi];
   int stride = cpi->stride[ps->plane];
   unsigned char *frame_ptr = &cpi->frame[bi];
@@ -726,6 +726,7 @@
   int coded = 0;
   int i;
   fr_state_t fr_checkpoint;
+  ogg_int16_t dct[4][64];
 
   rd_metric_t mo;
   memset(&mo,0,sizeof(mo));
@@ -738,7 +739,7 @@
        raster order just to make it more difficult. */
     int bi = macroblock_phase_Y[mb_phase][i];
     int fi = mb->Ryuv[0][bi];
-    if(TQB(cpi,ps,mode,fi,mb->mv[bi],0,0,&mo,rc)){
+    if(TQB(cpi,ps,mode,fi,mb->mv[bi],0,0,&mo,rc,dct[i])){
       fr_codeblock(cpi,fr);
       coded++;
     }else{
@@ -803,7 +804,7 @@
   for ( i=0; i<4; i++ ){
     int fi = mb->Hyuv[0][i];
     if(cp[fi]) 
-      dct_tokenize_AC(cpi, fi,0);
+      dct_tokenize_AC(cpi, fi, dct[i], 0);
   }
 
   return coded;  
@@ -818,6 +819,7 @@
   int coded = 0;
   unsigned char *cp=cpi->frag_coded;
   rd_metric_t mo;
+  ogg_int16_t dct[64];
   memset(&mo,0,sizeof(mo));
 
   for(i=0;i<16;i++){
@@ -856,9 +858,9 @@
       }else
 	mv = mb->mv[0];
 	
-      if(TQB(cpi,ps,mb->mode,fi,mv,0,0,&mo,rc)){
+      if(TQB(cpi,ps,mb->mode,fi,mv,0,0,&mo,rc,dct)){
 	fr_codeblock(cpi,fr);
-	dct_tokenize_AC(cpi, fi, 1);
+	dct_tokenize_AC(cpi, fi, dct, 1);
 	coded++;
       }else{
 	fr_skipblock(cpi,fr);



More information about the commits mailing list