[xiph-commits] r14249 - branches/theora-thusnelda/lib/enc
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Thu Nov 29 08:31:04 PST 2007
Author: xiphmont
Date: 2007-11-29 08:31:03 -0800 (Thu, 29 Nov 2007)
New Revision: 14249
Modified:
branches/theora-thusnelda/lib/enc/codec_internal.h
branches/theora-thusnelda/lib/enc/dct_decode.c
branches/theora-thusnelda/lib/enc/dct_encode.c
branches/theora-thusnelda/lib/enc/encode.c
branches/theora-thusnelda/lib/enc/encoder_huffman.c
branches/theora-thusnelda/lib/enc/encoder_quant.c
branches/theora-thusnelda/lib/enc/encoder_toplevel.c
branches/theora-thusnelda/lib/enc/frinit.c
Log:
Finish eliminating PB_INSTANCE
Modified: branches/theora-thusnelda/lib/enc/codec_internal.h
===================================================================
--- branches/theora-thusnelda/lib/enc/codec_internal.h 2007-11-29 08:10:27 UTC (rev 14248)
+++ branches/theora-thusnelda/lib/enc/codec_internal.h 2007-11-29 16:31:03 UTC (rev 14249)
@@ -152,35 +152,6 @@
typedef ogg_int32_t iquant_table[64];
typedef iquant_table iquant_tables[64];
-/** Decoder (Playback) instance -- installed in a theora_state */
-typedef struct PB_INSTANCE {
-
- ogg_uint32_t EOB_Run;
-
- ogg_int32_t ReconPtr2Offset; /* Offset for second reconstruction
- in half pixel MC */
- ogg_uint32_t DcHuffChoice; /* Huffman table selection variables */
- unsigned char ACHuffChoice;
-
- /* Loop filter bounding values */
- ogg_int16_t FiltBoundingValue[256];
-
- HUFF_ENTRY *HuffRoot_VP3x[NUM_HUFF_TABLES];
- ogg_uint32_t *HuffCodeArray_VP3x[NUM_HUFF_TABLES];
- unsigned char *HuffCodeLengthArray_VP3x[NUM_HUFF_TABLES];
- const unsigned char *ExtraBitLengths_VP3x;
-
- th_quant_info quant_info;
- quant_tables quant_tables[2][3];
- iquant_tables iquant_tables[2][3];
-
- /* Predictor used in choosing entropy table for decoding block patterns. */
- unsigned char BlockPatternPredictor;
-
- DspFunctions dsp; /* Selected functions for this platform */
-
-} PB_INSTANCE;
-
/* Encoder (Compressor) instance -- installed in a theora_state */
typedef struct CP_INSTANCE {
/*This structure must be first.
@@ -299,9 +270,17 @@
signed char HalfPixelXOffset[9]; /* Half pixel MV offsets for X */
signed char HalfPixelYOffset[9]; /* Half pixel MV offsets for Y */
- /* instances (used for reconstructing buffers and to hold tokens etc.) */
- PB_INSTANCE pb; /* playback */
+ /* hufftables and quant setup ****************************************/
+ HUFF_ENTRY *HuffRoot_VP3x[NUM_HUFF_TABLES];
+ ogg_uint32_t *HuffCodeArray_VP3x[NUM_HUFF_TABLES];
+ unsigned char *HuffCodeLengthArray_VP3x[NUM_HUFF_TABLES];
+ const unsigned char *ExtraBitLengths_VP3x;
+
+ th_quant_info quant_info;
+ quant_tables quant_tables[2][3];
+ iquant_tables iquant_tables[2][3];
+
/* ogg bitpacker for use in packet coding, other API state */
oggpack_buffer *oggbuffer;
#ifdef LIBOGG2 /* Remember, this is just until we drop libogg1 */
@@ -321,25 +300,8 @@
ogg_int16_t *QuantMatrix,
ogg_int16_t * OutputData );
-extern void ReconIntra( PB_INSTANCE *pbi, unsigned char * ReconPtr,
- ogg_int16_t * ChangePtr, ogg_uint32_t LineStep );
-
-extern void ReconInter( PB_INSTANCE *pbi, unsigned char * ReconPtr,
- unsigned char * RefPtr, ogg_int16_t * ChangePtr,
- ogg_uint32_t LineStep ) ;
-
-extern void ReconInterHalfPixel2( PB_INSTANCE *pbi, unsigned char * ReconPtr,
- unsigned char * RefPtr1,
- unsigned char * RefPtr2,
- ogg_int16_t * ChangePtr,
- ogg_uint32_t LineStep ) ;
-
extern void ReconRefFrames (CP_INSTANCE *cpi);
-extern void ExpandToken( ogg_int16_t * ExpandedBlock,
- unsigned char * CoeffIndex, ogg_uint32_t Token,
- ogg_int32_t ExtraBits );
-
-extern void quantize( PB_INSTANCE *pbi,
+extern void quantize( CP_INSTANCE *cpi,
ogg_int32_t *iquant_table,
ogg_int16_t * DCT_block,
ogg_int16_t * quantized_list);
@@ -349,10 +311,10 @@
extern void TransformQuantizeBlock (CP_INSTANCE *cpi, fragment_t *fp,
ogg_uint32_t PixelsPerLine ) ;
extern void InitFrameDetails(CP_INSTANCE *cpi);
-extern void WriteQTables(PB_INSTANCE *pbi,oggpack_buffer *opb);
-extern void InitQTables( PB_INSTANCE *pbi );
-extern void InitHuffmanSet( PB_INSTANCE *pbi );
-extern void ClearHuffmanSet( PB_INSTANCE *pbi );
+extern void WriteQTables(CP_INSTANCE *cpi,oggpack_buffer *opb);
+extern void InitQTables( CP_INSTANCE *cpi );
+extern void InitHuffmanSet( CP_INSTANCE *cpi );
+extern void ClearHuffmanSet( CP_INSTANCE *cpi );
extern void WriteHuffmanTrees(HUFF_ENTRY *HuffRoot[NUM_HUFF_TABLES],
oggpack_buffer *opb);
extern void PackAndWriteDFArray( CP_INSTANCE *cpi );
Modified: branches/theora-thusnelda/lib/enc/dct_decode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/dct_decode.c 2007-11-29 08:10:27 UTC (rev 14248)
+++ branches/theora-thusnelda/lib/enc/dct_decode.c 2007-11-29 16:31:03 UTC (rev 14249)
@@ -20,39 +20,37 @@
#include "codec_internal.h"
#include "quant_lookup.h"
-static void SetupBoundingValueArray_Generic(PB_INSTANCE *pbi,
+static void SetupBoundingValueArray_Generic(ogg_int16_t *BoundingValuePtr,
ogg_int32_t FLimit){
- ogg_int16_t * BoundingValuePtr = pbi->FiltBoundingValue+127;
ogg_int32_t i;
/* Set up the bounding value array. */
- memset ( pbi->FiltBoundingValue, 0, (256*sizeof(*pbi->FiltBoundingValue)) );
+ memset ( BoundingValuePtr, 0, (256*sizeof(*BoundingValuePtr)) );
for ( i = 0; i < FLimit; i++ ){
- BoundingValuePtr[-i-FLimit] = (-FLimit+i);
- BoundingValuePtr[-i] = -i;
- BoundingValuePtr[i] = i;
- BoundingValuePtr[i+FLimit] = FLimit-i;
+ BoundingValuePtr[127-i-FLimit] = (-FLimit+i);
+ BoundingValuePtr[127-i] = -i;
+ BoundingValuePtr[127+i] = i;
+ BoundingValuePtr[127+i+FLimit] = FLimit-i;
}
}
static void ExpandBlock ( CP_INSTANCE *cpi, fragment_t *fp, ogg_int32_t FragmentNumber){
- PB_INSTANCE *pbi = &cpi->pb;
int mode = fp->mode;
int qi = cpi->BaseQ; // temporary
int plane = (fp<cpi->frag[1] ? 0 : (fp<cpi->frag[2] ? 1 : 2));
ogg_uint32_t ReconPixelsPerLine = cpi->recon_stride[plane];
int inter = (mode != CODE_INTRA);
ogg_int16_t reconstruct[64];
- ogg_int16_t *quantizers = pbi->quant_tables[inter][plane][qi];
+ ogg_int16_t *quantizers = cpi->quant_tables[inter][plane][qi];
ogg_int16_t *data = fp->dct;
#ifdef _TH_DEBUG_
{
int i;
for(i=0;i<64;i++)
- pbi->QFragFREQ[FragmentNumber][dezigzag_index[i]]=
- pbi->quantized_list[i] * quantizers[i];
+ fp->FREQ[FragmentNumber][dezigzag_index[i]]=
+ cpi->quantized_list[i] * quantizers[i];
}
#endif
@@ -62,25 +60,25 @@
IDct1( data, quantizers, reconstruct );
break;
case 2: case 3:
- dsp_IDct3(pbi->dsp, data, quantizers, reconstruct );
+ dsp_IDct3(cpi->dsp, data, quantizers, reconstruct );
break;
case 4:case 5:case 6:case 7:case 8: case 9:case 10:
- dsp_IDct10(pbi->dsp, data, quantizers, reconstruct );
+ dsp_IDct10(cpi->dsp, data, quantizers, reconstruct );
break;
default:
- dsp_IDctSlow(pbi->dsp, data, quantizers, reconstruct );
+ dsp_IDctSlow(cpi->dsp, data, quantizers, reconstruct );
}
#ifdef _TH_DEBUG_
{
int i;
for(i=0;i<64;i++)
- pbi->QFragTIME[FragmentNumber][i]= reconstruct[i];
+ cpi->TIME[FragmentNumber][i]= reconstruct[i];
}
#endif
/* Convert fragment number to a pixel offset in a reconstruction buffer. */
- dsp_recon8x8 (pbi->dsp, &cpi->ThisFrameRecon[fp->recon_index],
+ dsp_recon8x8 (cpi->dsp, &cpi->ThisFrameRecon[fp->recon_index],
reconstruct, ReconPixelsPerLine);
}
@@ -191,7 +189,7 @@
int pi= fp->recon_index;
unsigned char *src = &SrcReconPtr[ pi ];
unsigned char *dst = &DestReconPtr[ pi ];
- dsp_copy8x8 (cpi->pb.dsp, src, dst, PlaneLineStep);
+ dsp_copy8x8 (cpi->dsp, src, dst, PlaneLineStep);
}
}
}
@@ -210,7 +208,7 @@
int pi= fp->recon_index;
unsigned char *src = &SrcReconPtr[ pi ];
unsigned char *dst = &DestReconPtr[ pi ];
- dsp_copy8x8 (cpi->pb.dsp, src, dst, PlaneLineStep);
+ dsp_copy8x8 (cpi->dsp, src, dst, PlaneLineStep);
}
}
}
@@ -264,15 +262,15 @@
}
static void LoopFilter(CP_INSTANCE *cpi){
- PB_INSTANCE *pbi = &cpi->pb;
- ogg_int16_t *BoundingValuePtr=pbi->FiltBoundingValue+127;
- ogg_int32_t FLimit = cpi->pb.quant_info.loop_filter_limits[cpi->BaseQ]; // temp
+ ogg_int16_t BoundingValues[256];
+ ogg_int16_t *BoundingValuePtr = BoundingValues+127;
+ ogg_int32_t FLimit = cpi->quant_info.loop_filter_limits[cpi->BaseQ]; // temp
int j,m,n;
fragment_t *fp;
if ( FLimit == 0 ) return;
- SetupBoundingValueArray_Generic(pbi, FLimit);
+ SetupBoundingValueArray_Generic(BoundingValues, FLimit);
for ( j = 0; j < 3 ; j++){
ogg_int32_t LineFragments = cpi->frag_h[j];
@@ -289,14 +287,14 @@
/* Filter right hand border only if the block to the right is
not coded */
if ( !fp[1].coded ){
- dsp_FilterHoriz(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterHoriz(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index+6,
LineLength,BoundingValuePtr);
}
/* Bottom done if next row set */
if( !fp[LineFragments].coded ){
- dsp_FilterVert(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterVert(cpi->dsp,cpi->LastFrameRecon+
fp[LineFragments].recon_index,
LineLength, BoundingValuePtr);
}
@@ -308,21 +306,21 @@
for ( n = 1 ; n < cpi->frag_h[j] - 1 ; n++, fp++) {
if( fp->coded){
/* Filter Left edge always */
- dsp_FilterHoriz(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterHoriz(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index-2,
LineLength, BoundingValuePtr);
/* Filter right hand border only if the block to the right is
not coded */
if ( !fp[1].coded ){
- dsp_FilterHoriz(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterHoriz(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index+6,
LineLength, BoundingValuePtr);
}
/* Bottom done if next row set */
if( !fp[LineFragments].coded ){
- dsp_FilterVert(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterVert(cpi->dsp,cpi->LastFrameRecon+
fp[LineFragments].recon_index,
LineLength, BoundingValuePtr);
}
@@ -334,13 +332,13 @@
/* Last Column */
if(fp->coded){
/* Filter Left edge always */
- dsp_FilterHoriz(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterHoriz(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index - 2 ,
LineLength, BoundingValuePtr);
/* Bottom done if next row set */
if( !fp[LineFragments].coded ){
- dsp_FilterVert(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterVert(cpi->dsp,cpi->LastFrameRecon+
fp[LineFragments].recon_index,
LineLength, BoundingValuePtr);
}
@@ -358,21 +356,21 @@
all fragments are intra */
if( fp->coded){
/* TopRow is always done */
- dsp_FilterVert(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterVert(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index,
LineLength, BoundingValuePtr);
/* Filter right hand border only if the block to the right is
not coded */
if ( !fp[1].coded ){
- dsp_FilterHoriz(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterHoriz(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index + 6,
LineLength, BoundingValuePtr);
}
/* Bottom done if next row set */
if( !fp[LineFragments].coded ){
- dsp_FilterVert(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterVert(cpi->dsp,cpi->LastFrameRecon+
fp[LineFragments].recon_index,
LineLength, BoundingValuePtr);
}
@@ -384,26 +382,26 @@
for ( n = 1 ; n < cpi->frag_h[j] - 1 ; n++, fp++){
if( fp->coded){
/* Filter Left edge always */
- dsp_FilterHoriz(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterHoriz(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index - 2,
LineLength, BoundingValuePtr);
/* TopRow is always done */
- dsp_FilterVert(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterVert(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index,
LineLength, BoundingValuePtr);
/* Filter right hand border only if the block to the right
is not coded */
if ( !fp[1].coded ){
- dsp_FilterHoriz(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterHoriz(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index + 6,
LineLength, BoundingValuePtr);
}
/* Bottom done if next row set */
if( !fp[LineFragments].coded ){
- dsp_FilterVert(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterVert(cpi->dsp,cpi->LastFrameRecon+
fp[LineFragments].recon_index,
LineLength, BoundingValuePtr);
}
@@ -414,18 +412,18 @@
/* Last Column */
if(fp->coded){
/* Filter Left edge always*/
- dsp_FilterHoriz(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterHoriz(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index - 2,
LineLength, BoundingValuePtr);
/* TopRow is always done */
- dsp_FilterVert(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterVert(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index,
LineLength, BoundingValuePtr);
/* Bottom done if next row set */
if( !fp[LineFragments].coded ){
- dsp_FilterVert(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterVert(cpi->dsp,cpi->LastFrameRecon+
fp[LineFragments].recon_index,
LineLength, BoundingValuePtr);
}
@@ -442,14 +440,14 @@
if(fp->coded){
/* TopRow is always done */
- dsp_FilterVert(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterVert(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index,
LineLength, BoundingValuePtr);
/* Filter right hand border only if the block to the right is
not coded */
if ( !fp[1].coded ){
- dsp_FilterHoriz(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterHoriz(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index + 6,
LineLength, BoundingValuePtr);
}
@@ -461,19 +459,19 @@
for ( n = 1 ; n < cpi->frag_h[j] - 1 ; n++, fp++){
if( fp->coded){
/* Filter Left edge always */
- dsp_FilterHoriz(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterHoriz(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index - 2,
LineLength, BoundingValuePtr);
/* TopRow is always done */
- dsp_FilterVert(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterVert(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index,
LineLength, BoundingValuePtr);
/* Filter right hand border only if the block to the right is
not coded */
if ( !fp[1].coded ){
- dsp_FilterHoriz(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterHoriz(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index + 6,
LineLength, BoundingValuePtr);
}
@@ -484,12 +482,12 @@
/* Last Column */
if( fp->coded){
/* Filter Left edge always */
- dsp_FilterHoriz(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterHoriz(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index - 2,
LineLength, BoundingValuePtr);
/* TopRow is always done */
- dsp_FilterVert(pbi->dsp,cpi->LastFrameRecon+
+ dsp_FilterVert(cpi->dsp,cpi->LastFrameRecon+
fp[0].recon_index,
LineLength, BoundingValuePtr);
@@ -499,7 +497,6 @@
}
void ReconRefFrames (CP_INSTANCE *cpi){
- PB_INSTANCE *pbi = &cpi->pb;
ogg_int32_t i;
unsigned char *SwapReconBuffersTemp;
Modified: branches/theora-thusnelda/lib/enc/dct_encode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/dct_encode.c 2007-11-29 08:10:27 UTC (rev 14248)
+++ branches/theora-thusnelda/lib/enc/dct_encode.c 2007-11-29 16:31:03 UTC (rev 14249)
@@ -361,7 +361,7 @@
int qi = cpi->BaseQ; // temporary
int inter = (fp->mode != CODE_INTRA);
int plane = (fp < cpi->frag[1] ? 0 : (fp < cpi->frag[2] ? 1 : 2));
- ogg_int32_t *q = cpi->pb.iquant_tables[inter][plane][qi];
+ ogg_int32_t *q = cpi->iquant_tables[inter][plane][qi];
ogg_int16_t DCTInput[64];
ogg_int16_t DCTOutput[64];
ogg_uint32_t ReconPixelsPerLine = cpi->recon_stride[plane];
@@ -389,7 +389,7 @@
dsp_fdct_short(cpi->dsp, DCTInput, DCTOutput);
/* Quantize that transform data. */
- quantize ( &cpi->pb, q, DCTOutput, fp->dct );
+ quantize (cpi, q, DCTOutput, fp->dct);
if ( (fp->mode == CODE_INTER_NO_MV) &&
( AllZeroDctData(fp->dct) ) ) {
Modified: branches/theora-thusnelda/lib/enc/encode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/encode.c 2007-11-29 08:10:27 UTC (rev 14248)
+++ branches/theora-thusnelda/lib/enc/encode.c 2007-11-29 16:31:03 UTC (rev 14249)
@@ -213,7 +213,7 @@
Token = (ogg_uint32_t)cpi->OptimisedTokenList[i];
for ( j = 0; j < DC_HUFF_CHOICES; j++ ){
EntropyTableBits[cpi->OptimisedTokenListPl[i]][j] +=
- cpi->pb.HuffCodeLengthArray_VP3x[DC_HUFF_OFFSET + j][Token];
+ cpi->HuffCodeLengthArray_VP3x[DC_HUFF_OFFSET + j][Token];
}
}
@@ -257,15 +257,15 @@
HuffIndex = (ogg_uint32_t)DC_HUFF_OFFSET + (ogg_uint32_t)DcHuffChoice[1];
/* Add the bits to the encode holding buffer. */
- oggpackB_write( opb, cpi->pb.HuffCodeArray_VP3x[HuffIndex][Token],
+ oggpackB_write( opb, cpi->HuffCodeArray_VP3x[HuffIndex][Token],
(ogg_uint32_t)cpi->
- pb.HuffCodeLengthArray_VP3x[HuffIndex][Token] );
+ HuffCodeLengthArray_VP3x[HuffIndex][Token] );
/* If the token is followed by an extra bits token then code it */
- if ( cpi->pb.ExtraBitLengths_VP3x[Token] > 0 ) {
+ if ( cpi->ExtraBitLengths_VP3x[Token] > 0 ) {
/* Add the bits to the encode holding buffer. */
oggpackB_write( opb, ExtraBitsToken,
- (ogg_uint32_t)cpi->pb.ExtraBitLengths_VP3x[Token] );
+ (ogg_uint32_t)cpi->ExtraBitLengths_VP3x[Token] );
}
}
@@ -295,7 +295,7 @@
HuffIndex = cpi->OptimisedTokenListHi[i];
for ( j = 0; j < AC_HUFF_CHOICES; j++ ) {
EntropyTableBits[cpi->OptimisedTokenListPl[i]][j] +=
- cpi->pb.HuffCodeLengthArray_VP3x[HuffIndex + j][Token];
+ cpi->HuffCodeLengthArray_VP3x[HuffIndex + j][Token];
}
}
@@ -336,15 +336,15 @@
AcHuffChoice[cpi->OptimisedTokenListPl[i]];
/* Add the bits to the encode holding buffer. */
- oggpackB_write( opb, cpi->pb.HuffCodeArray_VP3x[HuffIndex][Token],
- (ogg_uint32_t)cpi->
- pb.HuffCodeLengthArray_VP3x[HuffIndex][Token] );
+ oggpackB_write( opb, cpi->HuffCodeArray_VP3x[HuffIndex][Token],
+ (ogg_uint32_t)cpi->
+ HuffCodeLengthArray_VP3x[HuffIndex][Token] );
/* If the token is followed by an extra bits token then code it */
- if ( cpi->pb.ExtraBitLengths_VP3x[Token] > 0 ) {
+ if ( cpi->ExtraBitLengths_VP3x[Token] > 0 ) {
/* Add the bits to the encode holding buffer. */
oggpackB_write( opb, ExtraBitsToken,
- (ogg_uint32_t)cpi->pb.ExtraBitLengths_VP3x[Token] );
+ (ogg_uint32_t)cpi->ExtraBitLengths_VP3x[Token] );
}
}
@@ -637,7 +637,7 @@
/* Update record of tokens coded and where we are in this fragment. */
/* Is there an extra bits token */
- OneOrTwo = 1 + ( cpi->pb.ExtraBitLengths_VP3x[Token] > 0 );
+ OneOrTwo = 1 + ( cpi->ExtraBitLengths_VP3x[Token] > 0 );
/* Advance to the next real token. */
fp->tokens_packed += (unsigned char)OneOrTwo;
@@ -776,9 +776,6 @@
/* Zero the mode and MV list indices. */
cpi->ModeListCount = 0;
- /* Zero Decoder EOB run count */
- cpi->pb.EOB_Run = 0;
-
/* Initialise the coded block indices variables. These allow
subsequent linear access to the quad tree ordered list of coded
blocks */
Modified: branches/theora-thusnelda/lib/enc/encoder_huffman.c
===================================================================
--- branches/theora-thusnelda/lib/enc/encoder_huffman.c 2007-11-29 08:10:27 UTC (rev 14248)
+++ branches/theora-thusnelda/lib/enc/encoder_huffman.c 2007-11-29 16:31:03 UTC (rev 14249)
@@ -196,37 +196,37 @@
}
}
-void ClearHuffmanSet( PB_INSTANCE *pbi ){
+void ClearHuffmanSet( CP_INSTANCE *cpi ){
int i;
- ClearHuffmanTrees(pbi->HuffRoot_VP3x);
+ ClearHuffmanTrees(cpi->HuffRoot_VP3x);
for ( i = 0; i < NUM_HUFF_TABLES; i++ )
- if (pbi->HuffCodeArray_VP3x[i])
- _ogg_free (pbi->HuffCodeArray_VP3x[i]);
+ if (cpi->HuffCodeArray_VP3x[i])
+ _ogg_free (cpi->HuffCodeArray_VP3x[i]);
for ( i = 0; i < NUM_HUFF_TABLES; i++ )
- if (pbi->HuffCodeLengthArray_VP3x[i])
- _ogg_free (pbi->HuffCodeLengthArray_VP3x[i]);
+ if (cpi->HuffCodeLengthArray_VP3x[i])
+ _ogg_free (cpi->HuffCodeLengthArray_VP3x[i]);
}
-void InitHuffmanSet( PB_INSTANCE *pbi ){
+void InitHuffmanSet( CP_INSTANCE *cpi ){
int i;
- ClearHuffmanSet(pbi);
+ ClearHuffmanSet(cpi);
- pbi->ExtraBitLengths_VP3x = ExtraBitLengths_VP31;
+ cpi->ExtraBitLengths_VP3x = ExtraBitLengths_VP31;
for ( i = 0; i < NUM_HUFF_TABLES; i++ ){
- pbi->HuffCodeArray_VP3x[i] =
+ cpi->HuffCodeArray_VP3x[i] =
_ogg_calloc(MAX_ENTROPY_TOKENS,
- sizeof(*pbi->HuffCodeArray_VP3x[i]));
- pbi->HuffCodeLengthArray_VP3x[i] =
+ sizeof(*cpi->HuffCodeArray_VP3x[i]));
+ cpi->HuffCodeLengthArray_VP3x[i] =
_ogg_calloc(MAX_ENTROPY_TOKENS,
- sizeof(*pbi->HuffCodeLengthArray_VP3x[i]));
- BuildHuffmanTree( pbi->HuffRoot_VP3x,
- pbi->HuffCodeArray_VP3x[i],
- pbi->HuffCodeLengthArray_VP3x[i],
+ sizeof(*cpi->HuffCodeLengthArray_VP3x[i]));
+ BuildHuffmanTree( cpi->HuffRoot_VP3x,
+ cpi->HuffCodeArray_VP3x[i],
+ cpi->HuffCodeLengthArray_VP3x[i],
i, FrequencyCounts_VP3[i]);
}
}
Modified: branches/theora-thusnelda/lib/enc/encoder_quant.c
===================================================================
--- branches/theora-thusnelda/lib/enc/encoder_quant.c 2007-11-29 08:10:27 UTC (rev 14248)
+++ branches/theora-thusnelda/lib/enc/encoder_quant.c 2007-11-29 16:31:03 UTC (rev 14249)
@@ -34,9 +34,9 @@
#define OC_CLAMPI(_a,_b,_c) (OC_MAXI(_a,OC_MINI(_b,_c)))
-void WriteQTables(PB_INSTANCE *pbi,oggpack_buffer* _opb) {
+void WriteQTables(CP_INSTANCE *cpi,oggpack_buffer* _opb) {
- th_quant_info *_qinfo = &pbi->quant_info;
+ th_quant_info *_qinfo = &cpi->quant_info;
const th_quant_ranges *qranges;
const th_quant_base *base_mats[2*3*64];
@@ -137,10 +137,10 @@
/* a copied/reconciled version of derf's theora-exp code; redundancy
should be eliminated at some point */
-void InitQTables( PB_INSTANCE *pbi ){
+void InitQTables( CP_INSTANCE *cpi ){
int qti; /* coding mode: intra or inter */
int pli; /* Y U V */
- th_quant_info *qinfo = &pbi->quant_info;
+ th_quant_info *qinfo = &cpi->quant_info;
for(qti=0;qti<2;qti++){
for(pli=0;pli<3;pli++){
@@ -169,15 +169,15 @@
/*Scale DC the coefficient from the proper table.*/
q=((ogg_uint32_t)qinfo->dc_scale[qi]*base[0]/100)<<2;
q=OC_CLAMPI(OC_DC_QUANT_MIN[qti],q,OC_QUANT_MAX);
- pbi->quant_tables[qti][pli][qi][0]=(ogg_uint16_t)q;
- pbi->iquant_tables[qti][pli][qi][0]=(ogg_int32_t)(0.5 + (double)SHIFT16/q);
+ cpi->quant_tables[qti][pli][qi][0]=(ogg_uint16_t)q;
+ cpi->iquant_tables[qti][pli][qi][0]=(ogg_int32_t)(0.5 + (double)SHIFT16/q);
/*Now scale AC coefficients from the proper table.*/
for(ci=1;ci<64;ci++){
q=((ogg_uint32_t)qinfo->ac_scale[qi]*base[ci]/100)<<2;
q=OC_CLAMPI(OC_AC_QUANT_MIN[qti],q,OC_QUANT_MAX);
- pbi->quant_tables[qti][pli][qi][zigzag_index[ci]]=(ogg_uint16_t)q;
- pbi->iquant_tables[qti][pli][qi][ci]=(ogg_int32_t)(0.5 + (double)SHIFT16/q);
+ cpi->quant_tables[qti][pli][qi][zigzag_index[ci]]=(ogg_uint16_t)q;
+ cpi->iquant_tables[qti][pli][qi][ci]=(ogg_int32_t)(0.5 + (double)SHIFT16/q);
}
if(++qi>=qi_end)break;
@@ -272,7 +272,7 @@
}
-void quantize( PB_INSTANCE *pbi,
+void quantize( CP_INSTANCE *cpi,
ogg_int32_t *q,
ogg_int16_t *in,
ogg_int16_t *out){
Modified: branches/theora-thusnelda/lib/enc/encoder_toplevel.c
===================================================================
--- branches/theora-thusnelda/lib/enc/encoder_toplevel.c 2007-11-29 08:10:27 UTC (rev 14248)
+++ branches/theora-thusnelda/lib/enc/encoder_toplevel.c 2007-11-29 16:31:03 UTC (rev 14249)
@@ -191,7 +191,6 @@
theora_encode_dispatch_init(cpi);
dsp_static_init (&cpi->dsp);
- memcpy (&cpi->pb.dsp, &cpi->dsp, sizeof(DspFunctions));
c->version_major=TH_VERSION_MAJOR;
c->version_minor=TH_VERSION_MINOR;
@@ -261,11 +260,11 @@
/* We always start at frame 1 */
cpi->CurrentFrame = 1;
- InitHuffmanSet(&cpi->pb);
+ InitHuffmanSet(cpi);
/* This makes sure encoder version specific tables are initialised */
- memcpy(&cpi->pb.quant_info, &TH_VP31_QUANT_INFO, sizeof(th_quant_info));
- InitQTables(&cpi->pb);
+ memcpy(&cpi->quant_info, &TH_VP31_QUANT_INFO, sizeof(th_quant_info));
+ InitQTables(cpi);
/* Indicate that the next frame to be compressed is the first in the
current clip. */
@@ -536,8 +535,8 @@
oggpackB_write(cpi->oggbuffer,0x82,8);
_tp_writebuffer(cpi->oggbuffer,"theora",6);
- WriteQTables(&cpi->pb,cpi->oggbuffer);
- WriteHuffmanTrees(cpi->pb.HuffRoot_VP3x,cpi->oggbuffer);
+ WriteQTables(cpi,cpi->oggbuffer);
+ WriteHuffmanTrees(cpi->HuffRoot_VP3x,cpi->oggbuffer);
#ifndef LIBOGG2
op->packet=oggpackB_get_buffer(cpi->oggbuffer);
@@ -564,7 +563,7 @@
cpi=(CP_INSTANCE *)th->internal_encode;
if(cpi){
- ClearHuffmanSet(&cpi->pb);
+ ClearHuffmanSet(cpi);
ClearFragmentInfo(cpi);
ClearFrameInfo(cpi);
@@ -588,10 +587,7 @@
ogg_int64_t granulepos){
#ifndef THEORA_DISABLE_FLOAT
CP_INSTANCE *cpi=(CP_INSTANCE *)(th->internal_encode);
- PB_INSTANCE *pbi=(PB_INSTANCE *)(th->internal_decode);
- if(cpi)pbi=&cpi->pb;
-
if(granulepos>=0){
ogg_int64_t iframe=granulepos>>cpi->keyframe_granule_shift;
ogg_int64_t pframe=granulepos-(iframe<<cpi->keyframe_granule_shift);
@@ -609,10 +605,7 @@
static ogg_int64_t theora_encode_granule_frame(theora_state *th,
ogg_int64_t granulepos){
CP_INSTANCE *cpi=(CP_INSTANCE *)(th->internal_encode);
- PB_INSTANCE *pbi=(PB_INSTANCE *)(th->internal_decode);
- if(cpi)pbi=&cpi->pb;
-
if(granulepos>=0){
ogg_int64_t iframe=granulepos>>cpi->keyframe_granule_shift;
ogg_int64_t pframe=granulepos-(iframe<<cpi->keyframe_granule_shift);
@@ -627,14 +620,12 @@
static int theora_encode_control(theora_state *th,int req,
void *buf,size_t buf_sz) {
CP_INSTANCE *cpi;
- PB_INSTANCE *pbi;
int value;
if(th == NULL)
return TH_EFAULT;
cpi = th->internal_encode;
- pbi = &cpi->pb;
switch(req) {
case TH_ENCCTL_SET_QUANT_PARAMS:
@@ -644,16 +635,16 @@
return TH_EINVAL;
}
- memcpy(&pbi->quant_info, buf, sizeof(th_quant_info));
- InitQTables(pbi);
+ memcpy(&cpi->quant_info, buf, sizeof(th_quant_info));
+ InitQTables(cpi);
return 0;
case TH_ENCCTL_SET_VP3_COMPATIBLE:
if(cpi->HeadersWritten)
return TH_EINVAL;
- memcpy(&pbi->quant_info, &TH_VP31_QUANT_INFO, sizeof(th_quant_info));
- InitQTables(pbi);
+ memcpy(&cpi->quant_info, &TH_VP31_QUANT_INFO, sizeof(th_quant_info));
+ InitQTables(cpi);
return 0;
case TH_ENCCTL_SET_SPLEVEL:
Modified: branches/theora-thusnelda/lib/enc/frinit.c
===================================================================
--- branches/theora-thusnelda/lib/enc/frinit.c 2007-11-29 08:10:27 UTC (rev 14248)
+++ branches/theora-thusnelda/lib/enc/frinit.c 2007-11-29 16:31:03 UTC (rev 14249)
@@ -38,7 +38,6 @@
}
void ClearFragmentInfo(CP_INSTANCE *cpi){
- PB_INSTANCE *pbi = &cpi->pb;
/* free prior allocs if present */
if(cpi->CodedBlockList) _ogg_free(cpi->CodedBlockList);
@@ -61,7 +60,6 @@
}
static void InitFragmentInfo(CP_INSTANCE * cpi){
- PB_INSTANCE *pbi = &cpi->pb;
/* clear any existing info */
ClearFragmentInfo(cpi);
More information about the commits
mailing list