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

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Nov 27 17:15:16 PST 2007


Author: xiphmont
Date: 2007-11-27 17:15:16 -0800 (Tue, 27 Nov 2007)
New Revision: 14243

Removed:
   branches/theora-thusnelda/lib/enc/block_inline.h
   branches/theora-thusnelda/lib/enc/blockmap.c
Modified:
   branches/theora-thusnelda/lib/enc/codec_internal.h
   branches/theora-thusnelda/lib/enc/encode.c
   branches/theora-thusnelda/lib/enc/frarray.c
   branches/theora-thusnelda/lib/enc/frinit.c
   branches/theora-thusnelda/lib/enc/mcomp.c
Log:
Eliminate the now-dead blockmap code.



Deleted: branches/theora-thusnelda/lib/enc/block_inline.h
===================================================================
--- branches/theora-thusnelda/lib/enc/block_inline.h	2007-11-27 22:56:03 UTC (rev 14242)
+++ branches/theora-thusnelda/lib/enc/block_inline.h	2007-11-28 01:15:16 UTC (rev 14243)
@@ -1,37 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggTheora 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 Theora SOURCE CODE IS COPYRIGHT (C) 2002-2007                *
- * by the Xiph.Org Foundation http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
-  function:
-  last mod: $Id$
-
- ********************************************************************/
-
-#include "codec_internal.h"
-
-static const ogg_int32_t MBOrderMap[4] = { 0, 2, 3, 1 };
-static const ogg_int32_t BlockOrderMap1[4][4] = {
-  { 0, 1, 3, 2 },
-  { 0, 2, 3, 1 },
-  { 0, 2, 3, 1 },
-  { 3, 2, 0, 1 }
-};
-
-static ogg_int32_t QuadMapToIndex1( ogg_int32_t (*BlockMap)[4][4],
-                                    ogg_uint32_t SB, ogg_uint32_t MB,
-                                    ogg_uint32_t B ){
-  return BlockMap[SB][MBOrderMap[MB]][BlockOrderMap1[MB][B]];
-}
-
-static ogg_int32_t QuadMapToMBTopLeft( ogg_int32_t (*BlockMap)[4][4],
-                                       ogg_uint32_t SB, ogg_uint32_t MB ){
-  return BlockMap[SB][MBOrderMap[MB]][0];
-}

Deleted: branches/theora-thusnelda/lib/enc/blockmap.c
===================================================================
--- branches/theora-thusnelda/lib/enc/blockmap.c	2007-11-27 22:56:03 UTC (rev 14242)
+++ branches/theora-thusnelda/lib/enc/blockmap.c	2007-11-28 01:15:16 UTC (rev 14243)
@@ -1,99 +0,0 @@
-/********************************************************************
- *                                                                  *
- * THIS FILE IS PART OF THE OggTheora 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 Theora SOURCE CODE IS COPYRIGHT (C) 2002-2007                *
- * by the Xiph.Org Foundation http://www.xiph.org/                  *
- *                                                                  *
- ********************************************************************
-
-  function:
-  last mod: $Id$
-
- ********************************************************************/
-
-#include "codec_internal.h"
-
-static void CreateMapping ( ogg_int32_t (*BlockMap)[4][4],
-                            ogg_uint32_t FirstSB,
-                            ogg_uint32_t FirstFrag, ogg_uint32_t HFrags,
-                            ogg_uint32_t VFrags ){
-  ogg_uint32_t i, j = 0;
-  ogg_uint32_t xpos;
-  ogg_uint32_t ypos;
-  ogg_uint32_t SBrow, SBcol;
-  ogg_uint32_t SBRows, SBCols;
-  ogg_uint32_t MB, B;
-
-  ogg_uint32_t SB=FirstSB;
-  ogg_uint32_t FragIndex=FirstFrag;
-
-  /* Set Super-Block dimensions */
-  SBRows = VFrags/4 + ( VFrags%4 ? 1 : 0 );
-  SBCols = HFrags/4 + ( HFrags%4 ? 1 : 0 );
-
-  /* Map each Super-Block */
-  for ( SBrow=0; SBrow<SBRows; SBrow++ ){
-    for ( SBcol=0; SBcol<SBCols; SBcol++ ){
-      /* Y co-ordinate of Super-Block in Block units */
-      ypos = SBrow<<2;
-
-      /* Map Blocks within this Super-Block */
-      for ( i=0; (i<4) && (ypos<VFrags); i++, ypos++ ){
-        /* X co-ordinate of Super-Block in Block units */
-        xpos = SBcol<<2;
-
-        for ( j=0; (j<4) && (xpos<HFrags); j++, xpos++ ){
-          if ( i<2 ){
-            MB = ( j<2 ? 0 : 1 );
-          }else{
-            MB = ( j<2 ? 2 : 3 );
-          }
-
-          if ( i%2 ){
-            B = ( j%2 ? 3 : 2 );
-          }else{
-            B = ( j%2 ? 1 : 0 );
-          }
-
-          /* Set mapping and move to next fragment */
-          BlockMap[SB][MB][B] = FragIndex++;
-        }
-
-        /* Move to first fragment in next row in Super-Block */
-        FragIndex += HFrags-j;
-      }
-
-      /* Move on to next Super-Block */
-      SB++;
-      FragIndex -= i*HFrags-j;
-    }
-
-    /* Move to first Super-Block in next row */
-    FragIndex += 3*HFrags;
-  }
-}
-
-void CreateBlockMapping ( ogg_int32_t  (*BlockMap)[4][4],
-                          ogg_uint32_t YSuperBlocks,
-                          ogg_uint32_t UVSuperBlocks,
-                          ogg_uint32_t HFrags, ogg_uint32_t VFrags ) {
-  ogg_uint32_t i, j;
-
-  for ( i=0; i<YSuperBlocks + UVSuperBlocks * 2; i++ ){
-    for ( j=0; j<4; j++ ) {
-      BlockMap[i][j][0] = -1;
-      BlockMap[i][j][1] = -1;
-      BlockMap[i][j][2] = -1;
-      BlockMap[i][j][3] = -1;
-    }
-  }
-
-  CreateMapping ( BlockMap, 0, 0, HFrags, VFrags );
-  CreateMapping ( BlockMap, YSuperBlocks, HFrags*VFrags, HFrags/2, VFrags/2 );
-  CreateMapping ( BlockMap, YSuperBlocks + UVSuperBlocks, (HFrags*VFrags*5)/4,
-                  HFrags/2, VFrags/2 );
-}

Modified: branches/theora-thusnelda/lib/enc/codec_internal.h
===================================================================
--- branches/theora-thusnelda/lib/enc/codec_internal.h	2007-11-27 22:56:03 UTC (rev 14242)
+++ branches/theora-thusnelda/lib/enc/codec_internal.h	2007-11-28 01:15:16 UTC (rev 14243)
@@ -187,11 +187,6 @@
   fragment_t   **CodedBlockList;           
 
   /***********************************************************************/
-  /* Macro Block and SuperBlock Information */
-  ogg_int32_t  (*BlockMap)[4][4];               /* super block + sub macro
-                                                   block + sub frag ->
-                                                   FragIndex */
-
   /* Coded flag arrays and counters for them */
   unsigned char *SBCodedFlags;
   unsigned char *SBFullyFlags;
@@ -445,11 +440,6 @@
                               ogg_uint32_t *InterError,
                               ogg_uint32_t *IntraError);
 
-extern void CreateBlockMapping ( ogg_int32_t  (*BlockMap)[4][4],
-                                 ogg_uint32_t YSuperBlocks,
-                                 ogg_uint32_t UVSuperBlocks,
-                                 ogg_uint32_t HFrags, ogg_uint32_t VFrags );
-
 extern void ClearFragmentInfo (CP_INSTANCE *cpi);
 extern void ClearFrameInfo (CP_INSTANCE *cpi);
 

Modified: branches/theora-thusnelda/lib/enc/encode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/encode.c	2007-11-27 22:56:03 UTC (rev 14242)
+++ branches/theora-thusnelda/lib/enc/encode.c	2007-11-28 01:15:16 UTC (rev 14243)
@@ -19,7 +19,6 @@
 #include <string.h>
 #include "codec_internal.h"
 #include "encoder_lookup.h"
-#include "block_inline.h"
 
 static void PredictDC(CP_INSTANCE *cpi){
   ogg_int32_t plane;
@@ -854,9 +853,6 @@
                        ogg_uint32_t SBRows, ogg_uint32_t SBCols,
                        ogg_uint32_t PixelsPerLine,
                        ogg_uint32_t *InterError, ogg_uint32_t *IntraError) {
-  ogg_int32_t   YFragIndex;
-  ogg_int32_t   UFragIndex;
-  ogg_int32_t   VFragIndex;
   ogg_uint32_t  MB, B;      /* Macro-Block, Block indices */
   ogg_uint32_t  SBrow;      /* Super-Block row number */
   ogg_uint32_t  SBcol;      /* Super-Block row number */
@@ -880,60 +876,24 @@
                                            block */
   ogg_uint32_t  BestError;              /* Best error so far. */
 
-  mv_t          FourMVect[6];     /* storage for last used vectors (one
-                                     entry for each block in MB) */
-  mv_t          LastInterMVect;   /* storage for last used Inter frame
-                                     MB motion vector */
-  mv_t          PriorLastInterMVect;  /* storage for prior last used
-                                         Inter frame MB motion vector */
-  mv_t          TmpMVect;         /* Temporary MV storage */
-  mv_t          LastGFMVect;      /* storage for last used Golden
-                                     Frame MB motion vector */
-  mv_t          InterMVect;       /* storage for motion vector */
-  mv_t          InterMVectEx;     /* storage for motion vector result
-                                     from exhaustive search */
-  mv_t          GFMVect;          /* storage for motion vector */
-  mv_t          ZeroVect;
+  mv_t          FourMVect[6] = {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}};
+  mv_t          LastInterMVect = {0,0};
+  mv_t          PriorLastInterMVect = {0,0};
+  mv_t          TmpMVect = {0,0};  
+  mv_t          LastGFMVect = {0,0};
+  mv_t          InterMVect = {0,0};
+  mv_t          InterMVectEx = {0,0};
+  mv_t          GFMVect = {0,0};
+  mv_t          ZeroVect = {0,0};
 
-  ogg_uint32_t UVRow;
-  ogg_uint32_t UVColumn;
-  ogg_uint32_t UVFragOffset;
-
-  int          MBCodedFlag;
+  int           MBCodedFlag;
   unsigned char QIndex = cpi->BaseQ; // temporary
 
   /* initialize error scores */
   *InterError = 0;
   *IntraError = 0;
-
-  /* clear down the default motion vector. */
   cpi->MvListCount = 0;
-  FourMVect[0].x = 0;
-  FourMVect[0].y = 0;
-  FourMVect[1].x = 0;
-  FourMVect[1].y = 0;
-  FourMVect[2].x = 0;
-  FourMVect[2].y = 0;
-  FourMVect[3].x = 0;
-  FourMVect[3].y = 0;
-  FourMVect[4].x = 0;
-  FourMVect[4].y = 0;
-  FourMVect[5].x = 0;
-  FourMVect[5].y = 0;
-  LastInterMVect.x = 0;
-  LastInterMVect.y = 0;
-  PriorLastInterMVect.x = 0;
-  PriorLastInterMVect.y = 0;
-  LastGFMVect.x = 0;
-  LastGFMVect.y = 0;
-  InterMVect.x = 0;
-  InterMVect.y = 0;
-  GFMVect.x = 0;
-  GFMVect.y = 0;
-
-  ZeroVect.x = 0;
-  ZeroVect.y = 0;
-
+  
   /* change the quatization matrix to the one at best Q to compute the
      new error score */
   cpi->MinImprovementForNewMV = (MvThreshTable[QIndex] << 12);
@@ -977,16 +937,6 @@
         /* This one isn't coded go to the next one */
         if(!MBCodedFlag) continue;
 
-        /* Calculate U and V FragIndex from YFragIndex */
-        YFragIndex = QuadMapToMBTopLeft(cpi->pb.BlockMap, SB,MB);
-        UVRow = (YFragIndex / (cpi->pb.HFragments * 2));
-        UVColumn = (YFragIndex % cpi->pb.HFragments) / 2;
-        UVFragOffset = (UVRow * (cpi->pb.HFragments / 2)) + UVColumn;
-        UFragIndex = cpi->pb.YPlaneFragments + UVFragOffset;
-        VFragIndex = cpi->pb.YPlaneFragments + cpi->pb.UVPlaneFragments +
-          UVFragOffset;
-
-
         /**************************************************************
          Find the block choice with the lowest error
 

Modified: branches/theora-thusnelda/lib/enc/frarray.c
===================================================================
--- branches/theora-thusnelda/lib/enc/frarray.c	2007-11-27 22:56:03 UTC (rev 14242)
+++ branches/theora-thusnelda/lib/enc/frarray.c	2007-11-28 01:15:16 UTC (rev 14243)
@@ -17,7 +17,6 @@
 
 #include <string.h>
 #include "codec_internal.h"
-#include "block_inline.h"
 
 /* Long run bit string coding */
 static ogg_uint32_t FrArrayCodeSBRun( CP_INSTANCE *cpi, ogg_uint32_t value){

Modified: branches/theora-thusnelda/lib/enc/frinit.c
===================================================================
--- branches/theora-thusnelda/lib/enc/frinit.c	2007-11-27 22:56:03 UTC (rev 14242)
+++ branches/theora-thusnelda/lib/enc/frinit.c	2007-11-28 01:15:16 UTC (rev 14243)
@@ -50,7 +50,6 @@
   pbi->QFragFREQ = 0;
   pbi->QFragQUAN = 0;
 #endif
-  if(pbi->BlockMap) _ogg_free(pbi->BlockMap);
 
   if(pbi->SBCodedFlags) _ogg_free(pbi->SBCodedFlags);
   if(pbi->SBFullyFlags) _ogg_free(pbi->SBFullyFlags);
@@ -60,7 +59,6 @@
   pbi->CodedBlockList = 0;
   pbi->MBCodedFlags = 0;
   pbi->MBFullyFlags = 0;
-  pbi->BlockMap = 0;
 
   pbi->SBCodedFlags = 0;
   pbi->SBFullyFlags = 0;
@@ -163,9 +161,6 @@
   pbi->MBFullyFlags =
     _ogg_malloc(pbi->MacroBlocks * sizeof(*pbi->MBFullyFlags));
 
-  pbi->BlockMap =
-    _ogg_malloc(pbi->SuperBlocks * sizeof(*pbi->BlockMap));
-
 }
 
 void ClearFrameInfo(CP_INSTANCE *cpi){
@@ -409,12 +404,7 @@
   InitFragmentInfo(cpi);
   InitFrameInfo(cpi, FrameSize);
 
-  /* Configure mapping between quad-tree and fragments */
-  CreateBlockMapping ( pbi->BlockMap, pbi->YSuperBlocks,
-                       pbi->UVSuperBlocks, pbi->HFragments, pbi->VFragments);
-
   /* Re-initialise the pixel index table. */
-
   CalcPixelIndexTable( cpi );
 
 }

Modified: branches/theora-thusnelda/lib/enc/mcomp.c
===================================================================
--- branches/theora-thusnelda/lib/enc/mcomp.c	2007-11-27 22:56:03 UTC (rev 14242)
+++ branches/theora-thusnelda/lib/enc/mcomp.c	2007-11-28 01:15:16 UTC (rev 14243)
@@ -252,9 +252,6 @@
   unsigned char *SrcPtr[4] = {NULL, NULL, NULL, NULL};
   unsigned char *RefPtr[4] = {NULL, NULL, NULL, NULL};
   int            BestBlockOffset=0;
-
-  ogg_uint32_t  RefRow2Offset = cpi->recon_stride[0] * 8;
-
   int           disp[4];
   int           off = 0;
 



More information about the commits mailing list