[xiph-commits] r14142 - branches/theora-thusnelda/lib/enc
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Wed Nov 14 21:41:35 PST 2007
Author: xiphmont
Date: 2007-11-14 21:41:35 -0800 (Wed, 14 Nov 2007)
New Revision: 14142
Modified:
branches/theora-thusnelda/lib/enc/dct_decode.c
branches/theora-thusnelda/lib/enc/dct_encode.c
branches/theora-thusnelda/lib/enc/encoder_toplevel.c
Log:
Remove a curious element of the motion compensation analysis code...
The 'previous frame' of original YUV data wasn't being updated
completely each frame, only the coded blocks. I don't see how that
could be optimal behavior, and it's not even faster than just doing a
buffer flip. Removing.
Modified: branches/theora-thusnelda/lib/enc/dct_decode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/dct_decode.c 2007-11-15 03:51:54 UTC (rev 14141)
+++ branches/theora-thusnelda/lib/enc/dct_decode.c 2007-11-15 05:41:35 UTC (rev 14142)
@@ -452,17 +452,6 @@
}
}
-void ClearDownQFragData(PB_INSTANCE *pbi){
- ogg_int32_t i;
- Q_LIST_ENTRY * QFragPtr;
-
- for ( i = 0; i < pbi->CodedBlockIndex; i++ ) {
- /* Get the linear index for the current fragment. */
- QFragPtr = pbi->QFragData[pbi->CodedBlockList[i]];
- memset(QFragPtr, 0, 64*sizeof(Q_LIST_ENTRY));
- }
-}
-
static void FilterHoriz__c(unsigned char * PixelPtr,
ogg_int32_t LineLength,
ogg_int16_t *BoundingValuePtr){
Modified: branches/theora-thusnelda/lib/enc/dct_encode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/dct_encode.c 2007-11-15 03:51:54 UTC (rev 14141)
+++ branches/theora-thusnelda/lib/enc/dct_encode.c 2007-11-15 05:41:35 UTC (rev 14142)
@@ -285,7 +285,6 @@
static void MotionBlockDifference (CP_INSTANCE * cpi, unsigned char * FiltPtr,
ogg_int16_t *DctInputPtr, ogg_int32_t MvDevisor,
- unsigned char* old_ptr1, unsigned char* new_ptr1,
ogg_uint32_t FragIndex,ogg_uint32_t PixelsPerLine,
ogg_uint32_t ReconPixelsPerLine) {
@@ -359,20 +358,16 @@
if ( AbsRefOffset == 0 ){
dsp_sub8x8(cpi->dsp, FiltPtr, ReconPtr1, DctInputPtr,
PixelsPerLine, ReconPixelsPerLine);
- dsp_copy8x8 (cpi->dsp, new_ptr1, old_ptr1, PixelsPerLine);
} else {
/* Fractional pixel MVs. */
/* Note that we only use two pixel values even for the diagonal */
dsp_sub8x8avg2(cpi->dsp, FiltPtr, ReconPtr1,ReconPtr2,DctInputPtr,
PixelsPerLine, ReconPixelsPerLine);
- dsp_copy8x8 (cpi->dsp, new_ptr1, old_ptr1, PixelsPerLine);
}
}
void TransformQuantizeBlock (CP_INSTANCE *cpi, ogg_int32_t FragIndex,
ogg_uint32_t PixelsPerLine) {
- unsigned char *new_ptr1; /* Pointers into current frame */
- unsigned char *old_ptr1; /* Pointers into old frame */
unsigned char *FiltPtr; /* Pointers to srf filtered pixels */
ogg_int16_t *DctInputPtr; /* Pointer into buffer containing input to DCT */
int LeftEdge; /* Flag if block at left edge of component */
@@ -382,8 +377,6 @@
ogg_int32_t MvDevisor; /* Defines MV resolution (2 = 1/2
pixel for Y or 4 = 1/4 for UV) */
- new_ptr1 = &cpi->yuv1ptr[cpi->pb.pixel_index_table[FragIndex]];
- old_ptr1 = &cpi->yuv0ptr[cpi->pb.pixel_index_table[FragIndex]];
DctInputPtr = cpi->DCTDataBuffer;
/* Set plane specific values */
@@ -436,7 +429,7 @@
if ( ModeUsesMC[cpi->pb.CodingMode] ){
MotionBlockDifference(cpi, FiltPtr, DctInputPtr, MvDevisor,
- old_ptr1, new_ptr1, FragIndex, PixelsPerLine,
+ FragIndex, PixelsPerLine,
ReconPixelsPerLine);
} else if ( (cpi->pb.CodingMode==CODE_INTER_NO_MV ) ||
@@ -451,10 +444,8 @@
dsp_sub8x8(cpi->dsp, FiltPtr, ReconPtr1, DctInputPtr,
PixelsPerLine, ReconPixelsPerLine);
- dsp_copy8x8 (cpi->dsp, new_ptr1, old_ptr1, PixelsPerLine);
} else if ( cpi->pb.CodingMode==CODE_INTRA ) {
dsp_sub8x8_128(cpi->dsp, FiltPtr, DctInputPtr, PixelsPerLine);
- dsp_copy8x8 (cpi->dsp, new_ptr1, old_ptr1, PixelsPerLine);
}
/* Proceed to encode the data into the encode buffer if the encoder
Modified: branches/theora-thusnelda/lib/enc/encoder_toplevel.c
===================================================================
--- branches/theora-thusnelda/lib/enc/encoder_toplevel.c 2007-11-15 03:51:54 UTC (rev 14141)
+++ branches/theora-thusnelda/lib/enc/encoder_toplevel.c 2007-11-15 05:41:35 UTC (rev 14142)
@@ -650,7 +650,7 @@
}
-static void CompressFrame( CP_INSTANCE *cpi) {
+static int CompressFrame( CP_INSTANCE *cpi) {
ogg_int32_t min_blocks_per_frame;
ogg_uint32_t i;
int DropFrame = 0;
@@ -880,6 +880,8 @@
invariant */
UpdateFrame(cpi);
}
+
+ return DropFrame;
}
/********************** The toplevel: encode ***********************/
@@ -1060,6 +1062,7 @@
int theora_encode_YUVin(theora_state *t,
yuv_buffer *yuv){
+ int dropped = 0;
ogg_int32_t i;
unsigned char *LocalDataPtr;
unsigned char *InputDataPtr;
@@ -1124,7 +1127,7 @@
cpi->ThisIsKeyFrame = 0;
} else {
/* Compress the frame. */
- CompressFrame( cpi );
+ dropped = CompressFrame( cpi );
}
}
@@ -1138,6 +1141,17 @@
((cpi->CurrentFrame - cpi->LastKeyFrame)<<cpi->pb.keyframe_granule_shift)+
cpi->LastKeyFrame - 1;
+ if(!dropped){
+ unsigned char *tmp = cpi->yuv0ptr;
+ cpi->yuv0ptr = cpi->yuv1ptr;
+ cpi->yuv1ptr = tmp;
+
+ cpi->ScanConfig.Yuv0ptr = cpi->yuv0ptr;
+ cpi->ScanConfig.Yuv1ptr = cpi->yuv1ptr;
+ cpi->pp.ScanConfig.Yuv0ptr = cpi->yuv0ptr;
+ cpi->pp.ScanConfig.Yuv1ptr = cpi->yuv1ptr;
+ }
+
#ifdef _TH_DEBUG_
dframe++;
#endif
More information about the commits
mailing list