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

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Mon Nov 26 11:02:35 PST 2007


Author: xiphmont
Date: 2007-11-26 11:02:35 -0800 (Mon, 26 Nov 2007)
New Revision: 14234

Modified:
   branches/theora-thusnelda/lib/enc/codec_internal.h
   branches/theora-thusnelda/lib/enc/encoder_toplevel.c
Log:
In progress refactoring of macroblock setup, don't use it yet.


Modified: branches/theora-thusnelda/lib/enc/codec_internal.h
===================================================================
--- branches/theora-thusnelda/lib/enc/codec_internal.h	2007-11-26 17:06:55 UTC (rev 14233)
+++ branches/theora-thusnelda/lib/enc/codec_internal.h	2007-11-26 19:02:35 UTC (rev 14234)
@@ -114,7 +114,7 @@
 typedef struct fragment {
   int coded;
   mv_t mv;
-  ogg_int16_t dc;
+  ogg_int16_t pred_dc;
   ogg_int16_t dct[64];
 
   ogg_uint32_t raw_index;
@@ -167,10 +167,6 @@
   ogg_uint32_t  ReconYDataOffset;
   ogg_uint32_t  ReconUDataOffset;
   ogg_uint32_t  ReconVDataOffset;
-  ogg_uint32_t  YSuperBlocks;   /* Number of SuperBlocks in a Y frame */
-  ogg_uint32_t  UVSuperBlocks;  /* Number of SuperBlocks in a U or V frame */
-  ogg_uint32_t  SuperBlocks;    /* Total number of SuperBlocks in a
-                                   Y,U,V frame */
 
   ogg_uint32_t  YSBRows;        /* Number of rows of SuperBlocks in a
                                    Y frame */
@@ -181,8 +177,6 @@
   ogg_uint32_t  UVSBCols;       /* Number of cols of SuperBlocks in a
                                    U or V frame */
 
-  ogg_uint32_t  MacroBlocks;    /* Total number of Macro-Blocks */
-
   /**********************************************************************/
   /* Frames  */
   unsigned char *ThisFrameRecon;
@@ -328,6 +322,34 @@
   ogg_int32_t       TokensCoded;
   /********************************************************************/
   /* SuperBlock, MacroBLock and Fragment Information */
+  fragment_t       *yfrag;
+  fragment_t       *ufrag;
+  fragment_t       *vfrag;
+  macroblock_t     *macrob;
+  superblock_t     *ysuper;
+  superblock_t     *usuper;
+  superblock_t     *vsuper;
+
+  ogg_uint32_t      yfrag_h;
+  ogg_uint32_t      yfrag_v;
+  ogg_uint32_t      yfrag_n;
+  ogg_uint32_t      uvfrag_h;
+  ogg_uint32_t      uvfrag_v;
+  ogg_uint32_t      uvfrag_n;
+  ogg_uint32_t      frag_n;
+
+  ogg_uint32_t      macrob_h;
+  ogg_uint32_t      macrob_v;
+  ogg_uint32_t      macrob_n;
+  
+  ogg_uint32_t      ysuper_h;
+  ogg_uint32_t      ysuper_v;
+  ogg_uint32_t      ysuper_n;
+  ogg_uint32_t      uvsuper_h;
+  ogg_uint32_t      uvsuper_v;
+  ogg_uint32_t      uvsuper_n;
+  ogg_uint32_t      super_n;
+
   /* Coded flag arrays and counters for them */
   unsigned char    *PartiallyCodedFlags;
   unsigned char    *PartiallyCodedMbPatterns;

Modified: branches/theora-thusnelda/lib/enc/encoder_toplevel.c
===================================================================
--- branches/theora-thusnelda/lib/enc/encoder_toplevel.c	2007-11-26 17:06:55 UTC (rev 14233)
+++ branches/theora-thusnelda/lib/enc/encoder_toplevel.c	2007-11-26 19:02:35 UTC (rev 14234)
@@ -156,6 +156,21 @@
     _ogg_free(cpi->OptimisedTokenListPl);
   cpi->OptimisedTokenListPl = 0;
 
+  if(cpi->yfrag)_ogg_free(cpi->yfrag);
+  if(cpi->ufrag)_ogg_free(cpi->ufrag);
+  if(cpi->vfrag)_ogg_free(cpi->vfrag);
+  if(cpi->macrob)_ogg_free(cpi->macrob);
+  if(cpi->ysuper)_ogg_free(cpi->ysuper);
+  if(cpi->usuper)_ogg_free(cpi->usuper);
+  if(cpi->vsuper)_ogg_free(cpi->vsuper);
+  cpi->yfrag = 0;
+  cpi->ufrag = 0;
+  cpi->vfrag = 0;
+  cpi->macrob = 0;
+  cpi->ysuper = 0;
+  cpi->usuper = 0;
+  cpi->vsuper = 0;
+
 }
 
 static void EInitFrameInfo(CP_INSTANCE * cpi){
@@ -180,6 +195,60 @@
   cpi->OptimisedTokenListPl =
     _ogg_malloc(FrameSize*
                 sizeof(*cpi->OptimisedTokenListPl));
+
+  /* new block abstraction setup... babysteps... */
+  cpi->yfrag_h = (cpi->info.width >> 3);
+  cpi->yfrag_v = (cpi->info.height >> 3);
+  cpi->yfrag_n = cpi->yfrag_h * cpi->yfrag_v;
+  cpi->uvfrag_h = (cpi->yfrag_h >> 1);
+  cpi->uvfrag_v = (cpi->yfrag_v >> 1);
+  cpi->uvfrag_n = cpi->uvfrag_h * cpi->uvfrag_v;
+  cpi->frag_n = cpi->yfrag_n + cpi->uvfrag_n*2;
+
+  cpi->macrob_h = (cpi->yfrag_h >> 1);
+  cpi->macrob_v = (cpi->yfrag_v >> 1);
+  cpi->macrob_n = cpi->macrob_h * cpi->macrob_v;
+
+  cpi->ysuper_h = (cpi->info.width >> 5) + ((cpi->info.width & 0x1f) ? 1 : 0);
+  cpi->ysuper_v = (cpi->info.height >> 5) + ((cpi->info.height & 0x1f) ? 1 : 0);
+  cpi->ysuper_n = cpi->ysuper_h * cpi->ysuper_v;
+  cpi->uvsuper_h = (cpi->info.width >> 6) + ((cpi->info.width & 0x3f) ? 1 : 0);
+  cpi->uvsuper_v = (cpi->info.height >> 6) + ((cpi->info.height & 0x3f) ? 1 : 0);
+  cpi->uvsuper_n = cpi->uvsuper_h * cpi->uvsuper_v;
+  cpi->super_n = cpi->ysuper_n + cpi->uvsuper_n*2;
+
+  cpi->yfrag = calloc(cpi->yfrag_n, sizeof(*cpi->yfrag));
+  cpi->ufrag = calloc(cpi->uvfrag_n, sizeof(*cpi->ufrag));
+  cpi->vfrag = calloc(cpi->uvfrag_n, sizeof(*cpi->vfrag));
+
+  cpi->macrob = calloc(cpi->macrob_n, sizeof(*cpi->macrob));
+
+  cpi->ysuper = calloc(cpi->ysuper_n, sizeof(*cpi->ysuper));
+  cpi->usuper = calloc(cpi->uvsuper_n, sizeof(*cpi->usuper));
+  cpi->vsuper = calloc(cpi->uvsuper_n, sizeof(*cpi->vsuper));
+
+  /* fill in superblock fragment pointers */
+
+  /* complicated for one bad reason; superblock (and fragment) zero is
+     the bottom-left-most, but any uncoded 'extra' space needed to pad
+     out to multiples of 32 pixels hangs off the bottom of the image,
+     not the top. What exactly was VP3 thinking? */
+
+  {
+    int row,col,frag;
+    int hilbertx[16] = {0,1,1,0,0,0,1,1,2,2,3,3,3,2,2,3};
+    int hilberty[16] = {0,0,1,1,2,3,3,2,2,3,3,2,1,1,0,0};
+
+    /* Y */
+    for(row=0;row<cpi->ysuper_v;row++){
+      for(col=0;row<cpi->ysuper_h;col++){
+	for(frag=0;frag<16;frag++){
+	  /* translate to fragment index */
+	  
+	}
+      }
+    }
+  }
 }
 
 static void SetupKeyFrame(CP_INSTANCE *cpi) {



More information about the commits mailing list