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

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Thu Nov 22 07:08:00 PST 2007


Author: xiphmont
Date: 2007-11-22 07:08:00 -0800 (Thu, 22 Nov 2007)
New Revision: 14216

Modified:
   branches/theora-thusnelda/lib/enc/codec_internal.h
   branches/theora-thusnelda/lib/enc/encode.c
   branches/theora-thusnelda/lib/enc/encoder_toplevel.c
   branches/theora-thusnelda/lib/enc/frinit.c
Log:
Dead code removal



Modified: branches/theora-thusnelda/lib/enc/codec_internal.h
===================================================================
--- branches/theora-thusnelda/lib/enc/codec_internal.h	2007-11-22 11:18:25 UTC (rev 14215)
+++ branches/theora-thusnelda/lib/enc/codec_internal.h	2007-11-22 15:08:00 UTC (rev 14216)
@@ -77,17 +77,6 @@
 
 #define MAX_MV_EXTENT 31  /* Max search distance in half pixel increments */
 
-typedef struct CONFIG_TYPE2{
-  double       OutputFrameRate;
-  ogg_uint32_t TargetBandwidth;
-
-  ogg_uint32_t FirstFrameQ;
-  ogg_uint32_t BaseQ;
-  ogg_uint32_t MaxQ;            /* Absolute Max Q allowed. */
-  ogg_uint32_t ActiveMaxQ;      /* Currently active Max Q */
-
-} CONFIG_TYPE2;
-
 typedef struct coeffNode{
   int i;
   struct coeffNode *next;
@@ -315,22 +304,22 @@
      is the only assumption that library makes about our internal format.*/
   oc_state_dispatch_vtbl dispatch_vtbl;
 
+  unsigned char   *yuvptr;
+
   /* Compressor Configuration */
-  CONFIG_TYPE2     Configuration;
+  int              BaseQ;
   int              GoldenFrameEnabled;
   int              InterPrediction;
   int              MotionCompensation;
 
-  ogg_uint32_t     LastKeyFrame ;
+  ogg_uint32_t     LastKeyFrame;
 
   /* Compressor Statistics */
   ogg_int64_t      KeyFrameCount; /* Count of key frames. */
   ogg_int64_t      TotKeyFrameBytes;
 
   /* Frame Statistics  */
-  signed char      InterCodeCount;
   ogg_int64_t      CurrentFrame;
-  ogg_uint32_t     FrameBitCount;
   int              ThisIsFirstFrame;
   int              ThisIsKeyFrame;
 
@@ -342,11 +331,7 @@
   ogg_uint32_t     MinImprovementForFourMV;
   ogg_uint32_t     FourMVThreshold;
 
-   /*********************************************************************/
-  unsigned char    *yuvptr;
   /*********************************************************************/
-
-  /*********************************************************************/
   /* Token Buffers */
   ogg_uint32_t     *OptimisedTokenListEb; /* Optimised token list extra bits */
   unsigned char    *OptimisedTokenList;   /* Optimised token list. */
@@ -434,9 +419,6 @@
 
 #define clamp255(x) ((unsigned char)((((x)<0)-1) & ((x) | -((x)>255))))
 
-extern void InitPBInstance(PB_INSTANCE *pbi);
-extern void ClearPBInstance(PB_INSTANCE *pbi);
-
 extern void IDct1( ogg_int16_t * InputData,
                    ogg_int16_t *QuantMatrix,
                    ogg_int16_t * OutputData );
@@ -455,9 +437,6 @@
                                   ogg_uint32_t LineStep ) ;
 
 extern void SetupLoopFilter(PB_INSTANCE *pbi);
-extern void CopyBlock(unsigned char *src,
-                      unsigned char *dest,
-                      unsigned int srcstride);
 extern void LoopFilter(PB_INSTANCE *pbi);
 extern void ReconRefFrames (PB_INSTANCE *pbi);
 extern void ExpandToken( ogg_int16_t * ExpandedBlock,
@@ -476,25 +455,17 @@
                                        ogg_int32_t FragIndex);
 extern void TransformQuantizeBlock (CP_INSTANCE *cpi, ogg_int32_t FragIndex,
                                     ogg_uint32_t PixelsPerLine ) ;
-extern void ClearFragmentInfo(PB_INSTANCE * pbi);
-extern void InitFragmentInfo(PB_INSTANCE * pbi);
-extern void ClearFrameInfo(PB_INSTANCE * pbi);
-extern void InitFrameInfo(PB_INSTANCE * pbi, unsigned int FrameSize);
-extern void InitializeFragCoordinates(PB_INSTANCE *pbi);
 extern void InitFrameDetails(PB_INSTANCE *pbi);
 extern void WriteQTables(PB_INSTANCE *pbi,oggpack_buffer *opb);
 extern void InitQTables( PB_INSTANCE *pbi );
-extern void quant_tables_init( PB_INSTANCE *pbi, const th_quant_info *qinfo);
 extern void InitHuffmanSet( PB_INSTANCE *pbi );
 extern void ClearHuffmanSet( PB_INSTANCE *pbi );
 extern void WriteHuffmanTrees(HUFF_ENTRY *HuffRoot[NUM_HUFF_TABLES],
                               oggpack_buffer *opb);
-extern void QuadDecodeDisplayFragments ( PB_INSTANCE *pbi );
 extern void PackAndWriteDFArray( CP_INSTANCE *cpi );
-extern void UpdateFragQIndex(PB_INSTANCE *pbi);
-extern void PostProcess(PB_INSTANCE *pbi);
 extern void InitMotionCompensation ( CP_INSTANCE *cpi );
-extern ogg_uint32_t GetMBIntraError (CP_INSTANCE *cpi, ogg_uint32_t FragIndex,
+extern ogg_uint32_t GetMBIntraError (CP_INSTANCE *cpi, 
+				     ogg_uint32_t FragIndex,
                                      ogg_uint32_t PixelsPerLine ) ;
 extern ogg_uint32_t GetMBInterError (CP_INSTANCE *cpi,
                                      unsigned char * SrcPtr,
@@ -531,7 +502,6 @@
                               ogg_uint32_t *InterError,
                               ogg_uint32_t *IntraError);
 
-extern CODING_MODE FrArrayUnpackMode(PB_INSTANCE *pbi);
 extern void CreateBlockMapping ( ogg_int32_t  (*BlockMap)[4][4],
                                  ogg_uint32_t YSuperBlocks,
                                  ogg_uint32_t UVSuperBlocks,
@@ -540,7 +510,4 @@
 extern void UpdateUMVBorder( PB_INSTANCE *pbi,
                              unsigned char * DestReconPtr );
 
-extern void ClearTmpBuffers(PB_INSTANCE * pbi);
-extern void InitTmpBuffers(PB_INSTANCE * pbi);
-
 #endif /* ENCODER_INTERNAL_H */

Modified: branches/theora-thusnelda/lib/enc/encode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/encode.c	2007-11-22 11:18:25 UTC (rev 14215)
+++ branches/theora-thusnelda/lib/enc/encode.c	2007-11-22 15:08:00 UTC (rev 14216)
@@ -301,7 +301,6 @@
       HuffIndex = (ogg_uint32_t)DC_HUFF_OFFSET + (ogg_uint32_t)DcHuffChoice[1];
 
     /* Add the bits to the encode holding buffer. */
-    cpi->FrameBitCount += cpi->pb.HuffCodeLengthArray_VP3x[HuffIndex][Token];
     oggpackB_write( opb, cpi->pb.HuffCodeArray_VP3x[HuffIndex][Token],
                      (ogg_uint32_t)cpi->
                      pb.HuffCodeLengthArray_VP3x[HuffIndex][Token] );
@@ -309,7 +308,6 @@
     /* If the token is followed by an extra bits token then code it */
     if ( cpi->pb.ExtraBitLengths_VP3x[Token] > 0 ) {
       /* Add the bits to the encode holding buffer.  */
-      cpi->FrameBitCount += cpi->pb.ExtraBitLengths_VP3x[Token];
       oggpackB_write( opb, ExtraBitsToken,
                        (ogg_uint32_t)cpi->pb.ExtraBitLengths_VP3x[Token] );
     }
@@ -382,7 +380,6 @@
       AcHuffChoice[cpi->OptimisedTokenListPl[i]];
 
     /* Add the bits to the encode holding buffer. */
-    cpi->FrameBitCount += cpi->pb.HuffCodeLengthArray_VP3x[HuffIndex][Token];
     oggpackB_write( opb, cpi->pb.HuffCodeArray_VP3x[HuffIndex][Token],
                      (ogg_uint32_t)cpi->
                      pb.HuffCodeLengthArray_VP3x[HuffIndex][Token] );
@@ -390,7 +387,6 @@
     /* If the token is followed by an extra bits token then code it */
     if ( cpi->pb.ExtraBitLengths_VP3x[Token] > 0 ) {
       /* Add the bits to the encode holding buffer. */
-      cpi->FrameBitCount += cpi->pb.ExtraBitLengths_VP3x[Token];
       oggpackB_write( opb, ExtraBitsToken,
                        (ogg_uint32_t)cpi->pb.ExtraBitLengths_VP3x[Token] );
     }
@@ -753,9 +749,6 @@
     PackAndWriteDFArray( cpi );
   }
 
-  /* Note the number of bits used to code the tree itself. */
-  cpi->FrameBitCount = oggpackB_bytes(cpi->oggbuffer) << 3;
-
   /* Mode and MV data not needed for key frames. */
   if ( cpi->pb.FrameType != KEY_FRAME ){
     /* Pack and code the mode list. */
@@ -764,8 +757,6 @@
     PackMotionVectors (cpi);
   }
 
-  cpi->FrameBitCount = oggpackB_bytes(cpi->oggbuffer) << 3;
-
   /* Optimise the DC tokens */
   for ( i = 0; i < cpi->pb.CodedBlockIndex; i++ ) {
     /* Get the linear index for the current fragment. */

Modified: branches/theora-thusnelda/lib/enc/encoder_toplevel.c
===================================================================
--- branches/theora-thusnelda/lib/enc/encoder_toplevel.c	2007-11-22 11:18:25 UTC (rev 14215)
+++ branches/theora-thusnelda/lib/enc/encoder_toplevel.c	2007-11-22 15:08:00 UTC (rev 14216)
@@ -232,14 +232,13 @@
   SetupKeyFrame(cpi);
 
   cpi->pb.ThisFrameQualityValue = 
-    cpi->pb.quant_info.ac_scale[cpi->Configuration.BaseQ];
+    cpi->pb.quant_info.ac_scale[cpi->BaseQ];
 
   /* Initialise quantizer. */
   UpdateQC(cpi, cpi->pb.ThisFrameQualityValue );
 
   /* Compress and output the frist frame. */
-  PickIntra( cpi,
-             cpi->pb.YSBRows, cpi->pb.YSBCols);
+  PickIntra( cpi, cpi->pb.YSBRows, cpi->pb.YSBCols);
   UpdateFrame(cpi);
 
 }
@@ -255,13 +254,12 @@
   UpdateQC(cpi, cpi->pb.ThisFrameQualityValue );
 
   /* Compress and output the frist frame. */
-  PickIntra( cpi,
-             cpi->pb.YSBRows, cpi->pb.YSBCols);
+  PickIntra( cpi, cpi->pb.YSBRows, cpi->pb.YSBCols);
   UpdateFrame(cpi);
 
 }
 
-static int CompressFrame( CP_INSTANCE *cpi) {
+static int CompressFrame( CP_INSTANCE *cpi ) {
   ogg_uint32_t  i;
   ogg_uint32_t  KFIndicator = 0;
 
@@ -286,8 +284,7 @@
     /* for now, mark all blocks to be coded... */
     for(i=0;i<cpi->pb.UnitFragments;i++)
       cpi->pb.display_fragments[i]=1;
-
-
+    
     /* Select modes and motion vectors for each of the blocks : return
        an error score for inter and intra */
     PickModes( cpi, cpi->pb.YSBRows, cpi->pb.YSBCols,
@@ -352,17 +349,11 @@
   c->version_minor=TH_VERSION_MINOR;
   c->version_subminor=TH_VERSION_SUB;
 
-  /* Initialise Configuration structure to legal values */
   if(c->quality>63)c->quality=63;
   if(c->quality<0)c->quality=32;
   if(c->target_bitrate<0)c->target_bitrate=0;
-  /* we clamp target_bitrate to 24 bits after setting up the encoder */
+  cpi->BaseQ = c->quality;
 
-  cpi->Configuration.BaseQ = c->quality;
-  cpi->Configuration.FirstFrameQ = c->quality;
-  cpi->Configuration.MaxQ = c->quality;
-  cpi->Configuration.ActiveMaxQ = c->quality;
-
   cpi->MVChangeFactor    =    14;
   cpi->FourMvChangeFactor =   8;
   cpi->MinImprovementForNewMV = 25;
@@ -371,7 +362,6 @@
   cpi->FourMVThreshold = 10000;
   cpi->InterTripOutThresh = 5000;
   cpi->MVEnabled = 1;
-  cpi->InterCodeCount = 127;
   cpi->GoldenFrameEnabled = 1;
   cpi->InterPrediction = 1;
   cpi->MotionCompensation = 1;
@@ -414,13 +404,6 @@
   oggpackB_writeinit(cpi->oggbuffer, cpi->oggbufferstate);
 #endif 
 
-  /* Set data rate related variables. */
-  cpi->Configuration.TargetBandwidth = (c->target_bitrate) / 8;
-
-  cpi->Configuration.OutputFrameRate =
-    (double)( c->fps_numerator /
-              c->fps_denominator );
-
   InitFrameDetails(&cpi->pb);
   EInitFragmentInfo(cpi);
   EInitFrameInfo(cpi);
@@ -464,7 +447,6 @@
       yuv->y_width != (int)cpi->pb.info.width )
     return(-1);
 
-
   /* Copy over input YUV to internal YUV buffers. */
   /* we invert the image for backward compatibility with VP3 */
   /* First copy over the Y data */
@@ -515,7 +497,7 @@
       cpi->ThisIsKeyFrame = 0;
     } else  {
       /* Compress the frame. */
-      dropped = CompressFrame( cpi );
+      dropped = CompressFrame(cpi);
     }
 
   }
@@ -737,8 +719,6 @@
   if(cpi){
 
     ClearHuffmanSet(&cpi->pb);
-    ClearFragmentInfo(&cpi->pb);
-    ClearFrameInfo(&cpi->pb);
     EClearFragmentInfo(cpi);
     EClearFrameInfo(cpi);
 

Modified: branches/theora-thusnelda/lib/enc/frinit.c
===================================================================
--- branches/theora-thusnelda/lib/enc/frinit.c	2007-11-22 11:18:25 UTC (rev 14215)
+++ branches/theora-thusnelda/lib/enc/frinit.c	2007-11-22 15:08:00 UTC (rev 14216)
@@ -46,6 +46,7 @@
 
   /************************************************************************/
   /* Now calculate the pixel index table for image reconstruction buffers */
+
   PixelIndexTablePtr = pbi->recon_pixel_index_table;
   for ( i = 0; i < pbi->YPlaneFragments; i++ ){
     PixelIndexTablePtr[ i ] =
@@ -82,7 +83,7 @@
   }
 }
 
-void ClearFragmentInfo(PB_INSTANCE * pbi){
+static void ClearFragmentInfo(PB_INSTANCE * pbi){
 
   /* free prior allocs if present */
   if(pbi->display_fragments) _ogg_free(pbi->display_fragments);
@@ -142,7 +143,7 @@
   pbi->FragMVect = 0;
 }
 
-void InitFragmentInfo(PB_INSTANCE * pbi){
+static void InitFragmentInfo(PB_INSTANCE * pbi){
 
   /* clear any existing info */
   ClearFragmentInfo(pbi);
@@ -213,7 +214,7 @@
 
 }
 
-void ClearFrameInfo(PB_INSTANCE * pbi){
+static void ClearFrameInfo(PB_INSTANCE * pbi){
   if(pbi->ThisFrameRecon )
     _ogg_free(pbi->ThisFrameRecon );
   if(pbi->GoldenFrame)
@@ -226,7 +227,7 @@
   pbi->LastFrameRecon = 0;
 }
 
-void InitFrameInfo(PB_INSTANCE * pbi, unsigned int FrameSize){
+static void InitFrameInfo(PB_INSTANCE * pbi, unsigned int FrameSize){
 
   /* clear any existing info */
   ClearFrameInfo(pbi);



More information about the commits mailing list