[xiph-commits] r14312 - branches/theora-thusnelda/lib/enc
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Tue Dec 18 01:25:45 PST 2007
Author: xiphmont
Date: 2007-12-18 01:25:43 -0800 (Tue, 18 Dec 2007)
New Revision: 14312
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_toplevel.c
branches/theora-thusnelda/lib/enc/frarray.c
branches/theora-thusnelda/lib/enc/frinit.c
branches/theora-thusnelda/lib/enc/mcomp.c
Log:
Continue memory re-pack; buffer_index this time
Modified: branches/theora-thusnelda/lib/enc/codec_internal.h
===================================================================
--- branches/theora-thusnelda/lib/enc/codec_internal.h 2007-12-18 08:47:59 UTC (rev 14311)
+++ branches/theora-thusnelda/lib/enc/codec_internal.h 2007-12-18 09:25:43 UTC (rev 14312)
@@ -113,7 +113,6 @@
ogg_int16_t pred_dc;
ogg_int16_t dct[64];
unsigned char nonzero;
- ogg_uint32_t buffer_index;
fragment_t *next;
};
@@ -158,8 +157,9 @@
ogg_uint32_t frame_size;
/* SuperBlock, MacroBLock and Fragment Information */
- unsigned char *frag_coded[3];
- coding_mode_t *frag_mode[3];
+ unsigned char *frag_coded;
+ coding_mode_t *frag_mode;
+ ogg_uint32_t *frag_buffer_index;
fragment_t *frag[3];
macroblock_t *macro;
Modified: branches/theora-thusnelda/lib/enc/dct_decode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/dct_decode.c 2007-12-18 08:47:59 UTC (rev 14311)
+++ branches/theora-thusnelda/lib/enc/dct_decode.c 2007-12-18 09:25:43 UTC (rev 14312)
@@ -37,14 +37,15 @@
static void ExpandBlock ( CP_INSTANCE *cpi, int fi){
fragment_t *fp = &cpi->frag[0][fi];
- int mode = cpi->frag_mode[0][fi];
+ int mode = cpi->frag_mode[fi];
int qi = cpi->BaseQ; // temporary
int plane = (fp<cpi->frag[1] ? 0 : (fp<cpi->frag[2] ? 1 : 2));
int inter = (mode != CODE_INTRA);
ogg_int16_t reconstruct[64];
ogg_int16_t *quantizers = cpi->quant_tables[inter][plane][qi];
ogg_int16_t *data = fp->dct;
-
+ int bi = cpi->frag_buffer_index[fi];
+
/* Invert quantisation and DCT to get pixel data. */
switch(fp->nonzero){
case 0:case 1:
@@ -61,7 +62,7 @@
}
/* Convert fragment number to a pixel offset in a reconstruction buffer. */
- dsp_recon8x8 (cpi->dsp, &cpi->recon[fp->buffer_index],
+ dsp_recon8x8 (cpi->dsp, &cpi->recon[bi],
reconstruct, cpi->stride[plane]);
}
@@ -82,16 +83,18 @@
unsigned char *SrcPtr2;
unsigned char *DestPtr1;
unsigned char *DestPtr2;
-
- fragment_t *fp = cpi->frag[plane];
+ ogg_uint32_t *bp = cpi->frag_buffer_index;
+ if(plane) bp += cpi->frag_n[0];
+ if(plane>1) bp += cpi->frag_n[1];
+
/* Setup the source and destination pointers for the top and bottom
borders */
- PixelIndex = fp[0].buffer_index;
+ PixelIndex = bp[0];
SrcPtr1 = &DestReconPtr[ PixelIndex - PlaneBorderWidth ];
DestPtr1 = SrcPtr1 - (PlaneBorderWidth * PlaneStride);
- PixelIndex = fp[PlaneFragments - LineFragments].buffer_index + BlockVStep;
+ PixelIndex = bp[PlaneFragments - LineFragments] + BlockVStep;
SrcPtr2 = &DestReconPtr[ PixelIndex - PlaneBorderWidth];
DestPtr2 = SrcPtr2 + PlaneStride;
@@ -120,16 +123,18 @@
unsigned char *SrcPtr2;
unsigned char *DestPtr1;
unsigned char *DestPtr2;
+ ogg_uint32_t *bp = cpi->frag_buffer_index;
- fragment_t *fp = cpi->frag[plane];
+ if(plane) bp += cpi->frag_n[0];
+ if(plane>1) bp += cpi->frag_n[1];
/* Setup the source data values and destination pointers for the
left and right edge borders */
- PixelIndex = fp[0].buffer_index;
+ PixelIndex = bp[0];
SrcPtr1 = &DestReconPtr[ PixelIndex ];
DestPtr1 = &DestReconPtr[ PixelIndex - PlaneBorderWidth ];
- PixelIndex = fp[LineFragments - 1].buffer_index + (HFRAGPIXELS - 1);
+ PixelIndex = bp[LineFragments - 1] + (HFRAGPIXELS - 1);
SrcPtr2 = &DestReconPtr[ PixelIndex ];
DestPtr2 = &DestReconPtr[ PixelIndex + 1 ];
@@ -162,15 +167,16 @@
static void CopyRecon( CP_INSTANCE *cpi, unsigned char * DestReconPtr,
unsigned char * SrcReconPtr ) {
ogg_uint32_t i,plane;
- fragment_t *fp = cpi->frag[0];
- unsigned char *cp = cpi->frag_coded[0];
+ unsigned char *cp = cpi->frag_coded;
+ ogg_uint32_t *bi = cpi->frag_buffer_index;
+ int j = 0;
/* Copy over only updated blocks.*/
for(plane=0;plane<3;plane++){
int PlaneLineStep = cpi->stride[plane];
- for ( i = 0; i < cpi->frag_n[plane]; i++,fp++ ) {
- if ( cp[i] ) {
- int pi= fp->buffer_index;
+ for ( i = 0; i < cpi->frag_n[plane]; i++, j++ ) {
+ if ( cp[j] ) {
+ int pi= bi[j];
unsigned char *src = &SrcReconPtr[ pi ];
unsigned char *dst = &DestReconPtr[ pi ];
dsp_copy8x8 (cpi->dsp, src, dst, PlaneLineStep);
@@ -232,8 +238,9 @@
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;
unsigned char *cp;
+ ogg_uint32_t *bp;
+ int offset = 0;
if ( FLimit == 0 ) return;
SetupBoundingValueArray_Generic(BoundingValues, FLimit);
@@ -241,8 +248,9 @@
for ( j = 0; j < 3 ; j++){
ogg_int32_t LineFragments = cpi->frag_h[j];
ogg_int32_t LineLength = cpi->stride[j];
- fp = cpi->frag[j];
- cp = cpi->frag_coded[j];
+ cp = cpi->frag_coded+offset;
+ bp = cpi->frag_buffer_index+offset;
+ offset += cpi->frag_n[j];
/**************************************************************
First Row
@@ -250,131 +258,111 @@
/* first column conditions */
/* only do 2 prediction if fragment coded and on non intra or if
all fragments are intra */
- if( cp[0]){
+ if(cp[0]){
/* Filter right hand border only if the block to the right is
not coded */
- if ( !cp[1] ){
- dsp_FilterHoriz(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index+6,
+ if (!cp[1])
+ dsp_FilterHoriz(cpi->dsp,cpi->lastrecon + bp[0] + 6,
LineLength,BoundingValuePtr);
- }
/* Bottom done if next row set */
- if( !cp[LineFragments] ){
- dsp_FilterVert(cpi->dsp,cpi->lastrecon+
- fp[LineFragments].buffer_index,
+ if(!cp[LineFragments])
+ dsp_FilterVert(cpi->dsp,cpi->lastrecon + bp[LineFragments],
LineLength, BoundingValuePtr);
- }
}
- fp++;
+ bp++;
cp++;
/***************************************************************/
/* middle columns */
- for ( n = 1 ; n < cpi->frag_h[j] - 1 ; n++, fp++) {
- if( cp[0]){
+ for ( n = 1 ; n < cpi->frag_h[j] - 1 ; n++, bp++, cp++) {
+ if(cp[0]){
+
/* Filter Left edge always */
- dsp_FilterHoriz(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index-2,
+ dsp_FilterHoriz(cpi->dsp,cpi->lastrecon + bp[0] - 2,
LineLength, BoundingValuePtr);
-
+
/* Filter right hand border only if the block to the right is
not coded */
- if ( !cp[1] ){
- dsp_FilterHoriz(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index+6,
+ if (!cp[1])
+ dsp_FilterHoriz(cpi->dsp,cpi->lastrecon + bp[0] + 6,
LineLength, BoundingValuePtr);
- }
-
+
/* Bottom done if next row set */
- if( !cp[LineFragments] ){
- dsp_FilterVert(cpi->dsp,cpi->lastrecon+
- fp[LineFragments].buffer_index,
+ if(!cp[LineFragments])
+ dsp_FilterVert(cpi->dsp,cpi->lastrecon + bp[LineFragments],
LineLength, BoundingValuePtr);
- }
}
}
-
+
/***************************************************************/
/* Last Column */
if(cp[0]){
/* Filter Left edge always */
- dsp_FilterHoriz(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index - 2 ,
+ dsp_FilterHoriz(cpi->dsp,cpi->lastrecon + bp[0] - 2,
LineLength, BoundingValuePtr);
/* Bottom done if next row set */
- if( !cp[LineFragments] ){
- dsp_FilterVert(cpi->dsp,cpi->lastrecon+
- fp[LineFragments].buffer_index,
+ if(!cp[LineFragments])
+ dsp_FilterVert(cpi->dsp,cpi->lastrecon + bp[LineFragments],
LineLength, BoundingValuePtr);
- }
+
}
- fp++;
+ bp++;
cp++;
/***************************************************************/
/* Middle Rows */
/***************************************************************/
for ( m = 1 ; m < cpi->frag_v[j]-1 ; m++) {
-
+
/*****************************************************************/
/* first column conditions */
/* only do 2 prediction if fragment coded and on non intra or if
all fragments are intra */
- if( cp[0] ){
+ if(cp[0]){
/* TopRow is always done */
- dsp_FilterVert(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index,
+ dsp_FilterVert(cpi->dsp,cpi->lastrecon + bp[0],
LineLength, BoundingValuePtr);
-
+
/* Filter right hand border only if the block to the right is
not coded */
- if ( !cp[1] ){
- dsp_FilterHoriz(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index + 6,
+ if (!cp[1])
+ dsp_FilterHoriz(cpi->dsp,cpi->lastrecon + bp[0] + 6,
LineLength, BoundingValuePtr);
- }
/* Bottom done if next row set */
- if( !cp[LineFragments] ){
- dsp_FilterVert(cpi->dsp,cpi->lastrecon+
- fp[LineFragments].buffer_index,
+ if(!cp[LineFragments])
+ dsp_FilterVert(cpi->dsp,cpi->lastrecon + bp[LineFragments],
LineLength, BoundingValuePtr);
- }
+
}
- fp++;
+ bp++;
cp++;
/*****************************************************************/
/* middle columns */
- for ( n = 1 ; n < cpi->frag_h[j] - 1 ; n++, fp++){
- if( cp[0] ){
+ for ( n = 1 ; n < cpi->frag_h[j] - 1 ; n++, bp++, cp++){
+ if(cp[0]){
/* Filter Left edge always */
- dsp_FilterHoriz(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index - 2,
+ dsp_FilterHoriz(cpi->dsp,cpi->lastrecon + bp[0] - 2,
LineLength, BoundingValuePtr);
-
+
/* TopRow is always done */
- dsp_FilterVert(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index,
+ dsp_FilterVert(cpi->dsp,cpi->lastrecon + bp[0],
LineLength, BoundingValuePtr);
/* Filter right hand border only if the block to the right
is not coded */
- if ( !cp[1] ){
- dsp_FilterHoriz(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index + 6,
+ if (!cp[1])
+ dsp_FilterHoriz(cpi->dsp,cpi->lastrecon + bp[0] + 6,
LineLength, BoundingValuePtr);
- }
/* Bottom done if next row set */
- if( !cp[LineFragments] ){
- dsp_FilterVert(cpi->dsp,cpi->lastrecon+
- fp[LineFragments].buffer_index,
+ if(!cp[LineFragments])
+ dsp_FilterVert(cpi->dsp,cpi->lastrecon + bp[LineFragments],
LineLength, BoundingValuePtr);
- }
}
}
@@ -382,23 +370,19 @@
/* Last Column */
if(cp[0]){
/* Filter Left edge always*/
- dsp_FilterHoriz(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index - 2,
+ dsp_FilterHoriz(cpi->dsp,cpi->lastrecon + bp[0] - 2,
LineLength, BoundingValuePtr);
-
+
/* TopRow is always done */
- dsp_FilterVert(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index,
+ dsp_FilterVert(cpi->dsp,cpi->lastrecon + bp[0],
LineLength, BoundingValuePtr);
/* Bottom done if next row set */
- if( !cp[LineFragments] ){
- dsp_FilterVert(cpi->dsp,cpi->lastrecon+
- fp[LineFragments].buffer_index,
+ if(!cp[LineFragments])
+ dsp_FilterVert(cpi->dsp,cpi->lastrecon + bp[LineFragments],
LineLength, BoundingValuePtr);
- }
}
- fp++;
+ bp++;
cp++;
}
@@ -411,60 +395,51 @@
if(cp[0]){
/* TopRow is always done */
- dsp_FilterVert(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index,
+ dsp_FilterVert(cpi->dsp,cpi->lastrecon + bp[0],
LineLength, BoundingValuePtr);
-
+
/* Filter right hand border only if the block to the right is
not coded */
- if ( !cp[1] ){
- dsp_FilterHoriz(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index + 6,
+ if (!cp[1])
+ dsp_FilterHoriz(cpi->dsp,cpi->lastrecon + bp[0] + 6,
LineLength, BoundingValuePtr);
- }
}
- fp++;
+ bp++;
cp++;
/******************************************************************/
/* middle columns */
- for ( n = 1 ; n < cpi->frag_h[j] - 1 ; n++, fp++){
- if( cp[0] ){
+ for ( n = 1 ; n < cpi->frag_h[j] - 1 ; n++, bp++, cp++){
+ if(cp[0]){
/* Filter Left edge always */
- dsp_FilterHoriz(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index - 2,
+ dsp_FilterHoriz(cpi->dsp,cpi->lastrecon + bp[0] - 2,
LineLength, BoundingValuePtr);
/* TopRow is always done */
- dsp_FilterVert(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index,
+ dsp_FilterVert(cpi->dsp,cpi->lastrecon + bp[0],
LineLength, BoundingValuePtr);
/* Filter right hand border only if the block to the right is
not coded */
- if ( !cp[1] ){
- dsp_FilterHoriz(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index + 6,
+ if (!cp[1])
+ dsp_FilterHoriz(cpi->dsp,cpi->lastrecon + bp[0] + 6,
LineLength, BoundingValuePtr);
- }
}
}
/******************************************************************/
/* Last Column */
- if( cp[0] ){
+ if(cp[0]){
/* Filter Left edge always */
- dsp_FilterHoriz(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index - 2,
+ dsp_FilterHoriz(cpi->dsp,cpi->lastrecon + bp[0] - 2,
LineLength, BoundingValuePtr);
-
+
/* TopRow is always done */
- dsp_FilterVert(cpi->dsp,cpi->lastrecon+
- fp[0].buffer_index,
+ dsp_FilterVert(cpi->dsp,cpi->lastrecon + bp[0],
LineLength, BoundingValuePtr);
}
- fp++;
+ bp++;
cp++;
}
}
Modified: branches/theora-thusnelda/lib/enc/dct_encode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/dct_encode.c 2007-12-18 08:47:59 UTC (rev 14311)
+++ branches/theora-thusnelda/lib/enc/dct_encode.c 2007-12-18 09:25:43 UTC (rev 14312)
@@ -416,12 +416,12 @@
static void BlockUpdateDifference (CP_INSTANCE * cpi,
unsigned char *FiltPtr,
ogg_int16_t *DctInputPtr,
- unsigned char *thisrecon,
ogg_int32_t MvDevisor,
- fragment_t *fp,
+ int fi,
ogg_uint32_t PixelsPerLine,
int mode) {
+ fragment_t *fp = &cpi->frag[0][fi];
ogg_int32_t MvShift;
ogg_int32_t MvModMask;
ogg_int32_t AbsRefOffset;
@@ -433,6 +433,8 @@
unsigned char *ReconPtr1; /* DCT reconstructed image pointers */
unsigned char *ReconPtr2; /* Pointer used in half pixel MC */
mv_t mv;
+ int bi = cpi->frag_buffer_index[fi];
+ unsigned char *thisrecon = &cpi->recon[bi];
if ( ModeUsesMC[mode] ){
switch(MvDevisor) {
@@ -476,9 +478,9 @@
}
if ( mode==CODE_GOLDEN_MV ) {
- ReconPtr1 = &cpi->golden[fp->buffer_index];
+ ReconPtr1 = &cpi->golden[bi];
} else {
- ReconPtr1 = &cpi->lastrecon[fp->buffer_index];
+ ReconPtr1 = &cpi->lastrecon[bi];
}
ReconPtr1 += MVOffset;
@@ -501,9 +503,9 @@
if ( ( mode==CODE_INTER_NO_MV ) ||
( mode==CODE_USING_GOLDEN ) ) {
if ( mode==CODE_INTER_NO_MV ) {
- ReconPtr1 = &cpi->lastrecon[fp->buffer_index];
+ ReconPtr1 = &cpi->lastrecon[bi];
} else {
- ReconPtr1 = &cpi->golden[fp->buffer_index];
+ ReconPtr1 = &cpi->golden[bi];
}
dsp_sub8x8(cpi->dsp, FiltPtr, ReconPtr1, DctInputPtr,PixelsPerLine);
@@ -519,10 +521,10 @@
int fi){
fragment_t *fp = &cpi->frag[0][fi];
- coding_mode_t mode = cpi->frag_mode[0][fi];
- unsigned char *cp = &cpi->frag_coded[0][fi];
+ coding_mode_t mode = cpi->frag_mode[fi];
+ unsigned char *cp = &cpi->frag_coded[fi];
- unsigned char *FiltPtr = &cpi->frame[fp->buffer_index];
+ unsigned char *FiltPtr = &cpi->frame[cpi->frag_buffer_index[fi]];
int qi = cpi->BaseQ; // temporary
int inter = (mode != CODE_INTRA);
int plane = (fp < cpi->frag[1] ? 0 : (fp < cpi->frag[2] ? 1 : 2));
@@ -531,7 +533,6 @@
ogg_int16_t DCTOutput[64];
ogg_int32_t MvDivisor; /* Defines MV resolution (2 = 1/2
pixel for Y or 4 = 1/4 for UV) */
- unsigned char *ReconPtr1 = &cpi->recon[fp->buffer_index];
/* Set plane specific values */
if (plane == 0){
@@ -543,8 +544,8 @@
/* produces the appropriate motion compensation block, applies it to
the reconstruction buffer, and proces a difference block for
forward DCT */
- BlockUpdateDifference(cpi, FiltPtr, DCTInput, ReconPtr1,
- MvDivisor, fp, cpi->stride[plane], mode);
+ BlockUpdateDifference(cpi, FiltPtr, DCTInput,
+ MvDivisor, fi, cpi->stride[plane], mode);
/* Proceed to encode the data into the encode buffer if the encoder
is enabled. */
Modified: branches/theora-thusnelda/lib/enc/encode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/encode.c 2007-12-18 08:47:59 UTC (rev 14311)
+++ branches/theora-thusnelda/lib/enc/encode.c 2007-12-18 09:25:43 UTC (rev 14312)
@@ -42,8 +42,8 @@
int WhichFrame;
int WhichCase;
- coding_mode_t *mp = cpi->frag_mode[0];
- unsigned char *cp = cpi->frag_coded[0];
+ coding_mode_t *mp = cpi->frag_mode;
+ unsigned char *cp = cpi->frag_coded;
int fi = 0;
/* for y,u,v */
@@ -144,8 +144,8 @@
ogg_uint32_t SBs = cpi->super_n[plane];
ogg_uint32_t SB, MB, B;
- coding_mode_t *mp = cpi->frag_mode[0];
- unsigned char *cp = cpi->frag_coded[0];
+ coding_mode_t *mp = cpi->frag_mode;
+ unsigned char *cp = cpi->frag_coded;
/* actually transform and quantize the image now that we've decided
on the modes Parse in quad-tree ordering */
@@ -309,8 +309,8 @@
const ogg_int32_t *ModeBits;
const unsigned char *ModeScheme;
- unsigned char *cp = cpi->frag_coded[0];
- coding_mode_t *mp = cpi->frag_mode[0];
+ unsigned char *cp = cpi->frag_coded;
+ coding_mode_t *mp = cpi->frag_mode;
int SB,MB,B;
oggpack_buffer *opb=cpi->oggbuffer;
@@ -409,8 +409,8 @@
const ogg_uint32_t * MvBitsPtr;
ogg_uint32_t SB, MB, B;
- coding_mode_t *mp = cpi->frag_mode[0];
- unsigned char *cp = cpi->frag_coded[0];
+ coding_mode_t *mp = cpi->frag_mode;
+ unsigned char *cp = cpi->frag_coded;
oggpack_buffer *opb=cpi->oggbuffer;
@@ -498,8 +498,8 @@
int i;
for(i=0;i<cpi->frag_total;i++){
- cpi->frag_mode[0][i] = CODE_INTRA;
- cpi->frag_coded[0][i] = 1;
+ cpi->frag_mode[i] = CODE_INTRA;
+ cpi->frag_coded[i] = 1;
}
return 0;
}
@@ -516,7 +516,7 @@
int mode){
fragment_t *fp = &cpi->frag[0][fi];
fp->mv = *mv;
- cpi->frag_mode[0][fi] = mode;
+ cpi->frag_mode[fi] = mode;
}
static void SetMBMotionVectorsAndMode(CP_INSTANCE *cpi,
@@ -564,7 +564,7 @@
unsigned char QIndex = cpi->BaseQ; // temporary
- unsigned char *cp = cpi->frag_coded[0];
+ unsigned char *cp = cpi->frag_coded;
/* initialize error scores */
*InterError = 0;
Modified: branches/theora-thusnelda/lib/enc/encoder_toplevel.c
===================================================================
--- branches/theora-thusnelda/lib/enc/encoder_toplevel.c 2007-12-18 08:47:59 UTC (rev 14311)
+++ branches/theora-thusnelda/lib/enc/encoder_toplevel.c 2007-12-18 09:25:43 UTC (rev 14312)
@@ -27,12 +27,11 @@
#include "codec_internal.h"
static void SetupKeyFrame(CP_INSTANCE *cpi) {
- int i,j;
+ int j;
/* code all blocks */
- for(i=0;i<3;i++)
- for(j=0;j<cpi->frag_n[i];j++)
- cpi->frag_coded[i][j]=1;
+ for(j=0;j<cpi->frag_total;j++)
+ cpi->frag_coded[j]=1;
/* Set up for a KEY FRAME */
cpi->FrameType = KEY_FRAME;
@@ -81,8 +80,8 @@
/* Clear down the macro block level mode and MV arrays. */
for ( i = 0; i < cpi->frag_total; i++, fp++, fi++ ) {
- cpi->frag_mode[0][fi] = CODE_INTER_NO_MV; /* Default coding mode */
- cpi->frag_coded[0][fi] = 1; /* TEMPORARY */
+ cpi->frag_mode[fi] = CODE_INTER_NO_MV; /* Default coding mode */
+ cpi->frag_coded[fi] = 1; /* TEMPORARY */
fp->mv.x=0;
fp->mv.y=0;
}
Modified: branches/theora-thusnelda/lib/enc/frarray.c
===================================================================
--- branches/theora-thusnelda/lib/enc/frarray.c 2007-12-18 08:47:59 UTC (rev 14311)
+++ branches/theora-thusnelda/lib/enc/frarray.c 2007-12-18 09:25:43 UTC (rev 14312)
@@ -115,7 +115,7 @@
int partial=0;
int fully = 1;
int invalid_fi = cpi->frag_total;
- unsigned char *cp = cpi->frag_coded[0];
+ unsigned char *cp = cpi->frag_coded;
/* code the partially coded SB flags */
for( SB = 0; SB < cpi->super_total; SB++ ) {
Modified: branches/theora-thusnelda/lib/enc/frinit.c
===================================================================
--- branches/theora-thusnelda/lib/enc/frinit.c 2007-12-18 08:47:59 UTC (rev 14311)
+++ branches/theora-thusnelda/lib/enc/frinit.c 2007-12-18 09:25:43 UTC (rev 14312)
@@ -48,16 +48,15 @@
cpi->frag[1] = 0;
cpi->frag[2] = 0;
- if(cpi->frag_coded[0]) _ogg_free(cpi->frag_coded[0]);
- cpi->frag_coded[0] = 0;
- cpi->frag_coded[1] = 0;
- cpi->frag_coded[2] = 0;
+ if(cpi->frag_coded) _ogg_free(cpi->frag_coded);
+ cpi->frag_coded = 0;
- if(cpi->frag_mode[0]) _ogg_free(cpi->frag_mode[0]);
- cpi->frag_mode[0] = 0;
- cpi->frag_mode[1] = 0;
- cpi->frag_mode[2] = 0;
+ if(cpi->frag_mode) _ogg_free(cpi->frag_mode);
+ cpi->frag_mode = 0;
+ if(cpi->frag_buffer_index) _ogg_free(cpi->frag_buffer_index);
+ cpi->frag_buffer_index = 0;
+
if(cpi->macro) _ogg_free(cpi->macro);
cpi->macro = 0;
@@ -136,14 +135,10 @@
cpi->frag[2] = cpi->frag[1] + cpi->frag_n[1];
/* +1; the last entry is the 'invalid' frag, which is always set to not coded as it doesn't really exist */
- cpi->frag_coded[0] = calloc(cpi->frag_total+1, sizeof(**cpi->frag_coded));
- cpi->frag_coded[1] = cpi->frag_coded[0] + cpi->frag_n[0];
- cpi->frag_coded[2] = cpi->frag_coded[1] + cpi->frag_n[1];
+ cpi->frag_coded = calloc(cpi->frag_total+1, sizeof(*cpi->frag_coded));
+ cpi->frag_mode = calloc(cpi->frag_total+1, sizeof(*cpi->frag_mode));
+ cpi->frag_buffer_index = calloc(cpi->frag_total+1, sizeof(*cpi->frag_buffer_index));
- cpi->frag_mode[0] = calloc(cpi->frag_total+1, sizeof(**cpi->frag_mode));
- cpi->frag_mode[1] = cpi->frag_mode[0] + cpi->frag_n[0];
- cpi->frag_mode[2] = cpi->frag_mode[1] + cpi->frag_n[1];
-
/* +1; the last entry is the 'invalid' mb, which contains only 'invalid' frags */
cpi->macro = calloc(cpi->macro_total+1, sizeof(*cpi->macro));
@@ -257,13 +252,13 @@
/* Re-initialise the pixel index table. */
{
ogg_uint32_t plane,row,col;
- fragment_t *fp = cpi->frag[0];
+ ogg_uint32_t *bp = cpi->frag_buffer_index;
for(plane=0;plane<3;plane++){
ogg_uint32_t offset = cpi->offset[plane];
for(row=0;row<cpi->frag_v[plane];row++){
- for(col=0;col<cpi->frag_h[plane];col++,fp++){
- fp->buffer_index = offset+col*8;
+ for(col=0;col<cpi->frag_h[plane];col++,bp++){
+ *bp = offset+col*8;
}
offset += cpi->stride[plane]*8;
}
Modified: branches/theora-thusnelda/lib/enc/mcomp.c
===================================================================
--- branches/theora-thusnelda/lib/enc/mcomp.c 2007-12-18 08:47:59 UTC (rev 14311)
+++ branches/theora-thusnelda/lib/enc/mcomp.c 2007-12-18 09:25:43 UTC (rev 14312)
@@ -147,19 +147,19 @@
ogg_uint32_t IntraError = 0;
dsp_save_fpu (cpi->dsp);
- unsigned char *cp = cpi->frag_coded[0];
- fragment_t *fp = cpi->frag[0];
+ unsigned char *cp = cpi->frag_coded;
+ ogg_uint32_t *bp = cpi->frag_buffer_index;
/* Add together the intra errors for those blocks in the macro block
that are coded (Y only) */
if ( cp[mp->y[0]] )
- IntraError += dsp_intra8x8_err (cpi->dsp, &cpi->frame[fp[mp->y[0]].buffer_index],cpi->stride[0]);
+ IntraError += dsp_intra8x8_err (cpi->dsp, &cpi->frame[bp[mp->y[0]]],cpi->stride[0]);
if ( cp[mp->y[1]] )
- IntraError += dsp_intra8x8_err (cpi->dsp, &cpi->frame[fp[mp->y[1]].buffer_index],cpi->stride[0]);
+ IntraError += dsp_intra8x8_err (cpi->dsp, &cpi->frame[bp[mp->y[1]]],cpi->stride[0]);
if ( cp[mp->y[2]] )
- IntraError += dsp_intra8x8_err (cpi->dsp, &cpi->frame[fp[mp->y[2]].buffer_index],cpi->stride[0]);
+ IntraError += dsp_intra8x8_err (cpi->dsp, &cpi->frame[bp[mp->y[2]]],cpi->stride[0]);
if ( cp[mp->y[3]] )
- IntraError += dsp_intra8x8_err (cpi->dsp, &cpi->frame[fp[mp->y[3]].buffer_index],cpi->stride[0]);
+ IntraError += dsp_intra8x8_err (cpi->dsp, &cpi->frame[bp[mp->y[3]]],cpi->stride[0]);
dsp_restore_fpu (cpi->dsp);
return IntraError;
@@ -179,8 +179,8 @@
unsigned char * SrcPtr1;
unsigned char * RefPtr1;
- unsigned char *cp = cpi->frag_coded[0];
- fragment_t *fp = cpi->frag[0];
+ unsigned char *cp = cpi->frag_coded;
+ ogg_uint32_t *bp = cpi->frag_buffer_index;
dsp_save_fpu (cpi->dsp);
@@ -201,27 +201,27 @@
/* Add together the errors for those blocks in the macro block that
are coded (Y only) */
if ( cp[mp->y[0]] ) {
- SrcPtr1 = &SrcPtr[fp[mp->y[0]].buffer_index];
- RefPtr1 = &RefPtr[fp[mp->y[0]].buffer_index + RefPixelOffset];
+ SrcPtr1 = &SrcPtr[bp[mp->y[0]]];
+ RefPtr1 = &RefPtr[bp[mp->y[0]] + RefPixelOffset];
InterError += GetInterErr(cpi, SrcPtr1, RefPtr1, &RefPtr1[RefPtr2Offset] );
}
if ( cp[mp->y[1]] ) {
- SrcPtr1 = &SrcPtr[fp[mp->y[1]].buffer_index];
- RefPtr1 = &RefPtr[fp[mp->y[1]].buffer_index + RefPixelOffset];
+ SrcPtr1 = &SrcPtr[bp[mp->y[1]]];
+ RefPtr1 = &RefPtr[bp[mp->y[1]] + RefPixelOffset];
InterError += GetInterErr(cpi, SrcPtr1, RefPtr1, &RefPtr1[RefPtr2Offset] );
}
if ( cp[mp->y[2]] ) {
- SrcPtr1 = &SrcPtr[fp[mp->y[2]].buffer_index];
- RefPtr1 = &RefPtr[fp[mp->y[2]].buffer_index + RefPixelOffset];
+ SrcPtr1 = &SrcPtr[bp[mp->y[2]]];
+ RefPtr1 = &RefPtr[bp[mp->y[2]] + RefPixelOffset];
InterError += GetInterErr(cpi, SrcPtr1, RefPtr1, &RefPtr1[RefPtr2Offset] );
}
if ( cp[mp->y[3]] ) {
- SrcPtr1 = &SrcPtr[fp[mp->y[3]].buffer_index];
- RefPtr1 = &RefPtr[fp[mp->y[3]].buffer_index + RefPixelOffset];
+ SrcPtr1 = &SrcPtr[bp[mp->y[3]]];
+ RefPtr1 = &RefPtr[bp[mp->y[3]] + RefPixelOffset];
InterError += GetInterErr(cpi, SrcPtr1, RefPtr1, &RefPtr1[RefPtr2Offset] );
}
@@ -256,8 +256,8 @@
unsigned char BestHalfOffset;
unsigned char * RefDataPtr1;
unsigned char * RefDataPtr2;
- unsigned char *cp = cpi->frag_coded[0];
- fragment_t *fp = cpi->frag[0];
+ unsigned char *cp = cpi->frag_coded;
+ ogg_uint32_t *bp = cpi->frag_buffer_index;
dsp_save_fpu (cpi->dsp);
@@ -269,26 +269,26 @@
disp[3] = cp[mp->y[3]];
if(disp[0]){
- SrcPtr[0] = &cpi->frame[fp[mp->y[0]].buffer_index];
- RefPtr[0] = &RefFramePtr[fp[mp->y[0]].buffer_index];
+ SrcPtr[0] = &cpi->frame[bp[mp->y[0]]];
+ RefPtr[0] = &RefFramePtr[bp[mp->y[0]]];
Error += dsp_sad8x8 (cpi->dsp, SrcPtr[0], RefPtr[0],
cpi->stride[0]);
}
if(disp[1]){
- SrcPtr[1] = &cpi->frame[fp[mp->y[1]].buffer_index];
- RefPtr[1] = &RefFramePtr[fp[mp->y[1]].buffer_index];
+ SrcPtr[1] = &cpi->frame[bp[mp->y[1]]];
+ RefPtr[1] = &RefFramePtr[bp[mp->y[1]]];
Error += dsp_sad8x8 (cpi->dsp, SrcPtr[1], RefPtr[1],
cpi->stride[0]);
}
if(disp[2]){
- SrcPtr[2] = &cpi->frame[fp[mp->y[2]].buffer_index];
- RefPtr[2] = &RefFramePtr[fp[mp->y[2]].buffer_index];
+ SrcPtr[2] = &cpi->frame[bp[mp->y[2]]];
+ RefPtr[2] = &RefFramePtr[bp[mp->y[2]]];
Error += dsp_sad8x8 (cpi->dsp, SrcPtr[2], RefPtr[2],
cpi->stride[0]);
}
if(disp[3]){
- SrcPtr[3] = &cpi->frame[fp[mp->y[3]].buffer_index];
- RefPtr[3] = &RefFramePtr[fp[mp->y[3]].buffer_index];
+ SrcPtr[3] = &cpi->frame[bp[mp->y[3]]];
+ RefPtr[3] = &RefFramePtr[bp[mp->y[3]]];
Error += dsp_sad8x8 (cpi->dsp, SrcPtr[3], RefPtr[3],
cpi->stride[0]);
}
@@ -434,8 +434,8 @@
unsigned char * RefDataPtr1;
unsigned char * RefDataPtr2;
int off;
- unsigned char *cp = cpi->frag_coded[0];
- fragment_t *fp = cpi->frag[0];
+ unsigned char *cp = cpi->frag_coded;
+ ogg_uint32_t *bp = cpi->frag_buffer_index;
dsp_save_fpu (cpi->dsp);
@@ -447,20 +447,20 @@
disp[3] = cp[mp->y[3]];
if(disp[0]){
- SrcPtr[0] = &cpi->frame[fp[mp->y[0]].buffer_index];
- RefPtr[0] = &RefFramePtr[fp[mp->y[0]].buffer_index];
+ SrcPtr[0] = &cpi->frame[bp[mp->y[0]]];
+ RefPtr[0] = &RefFramePtr[bp[mp->y[0]]];
}
if(disp[1]){
- SrcPtr[1] = &cpi->frame[fp[mp->y[1]].buffer_index];
- RefPtr[1] = &RefFramePtr[fp[mp->y[1]].buffer_index];
+ SrcPtr[1] = &cpi->frame[bp[mp->y[1]]];
+ RefPtr[1] = &RefFramePtr[bp[mp->y[1]]];
}
if(disp[2]){
- SrcPtr[2] = &cpi->frame[fp[mp->y[2]].buffer_index];
- RefPtr[2] = &RefFramePtr[fp[mp->y[2]].buffer_index];
+ SrcPtr[2] = &cpi->frame[bp[mp->y[2]]];
+ RefPtr[2] = &RefFramePtr[bp[mp->y[2]]];
}
if(disp[3]){
- SrcPtr[3] = &cpi->frame[fp[mp->y[3]].buffer_index];
- RefPtr[3] = &RefFramePtr[fp[mp->y[3]].buffer_index];
+ SrcPtr[3] = &cpi->frame[bp[mp->y[3]]];
+ RefPtr[3] = &RefFramePtr[bp[mp->y[3]]];
}
off = - ((MAX_MV_EXTENT/2) * cpi->stride[0]) - (MAX_MV_EXTENT/2);
@@ -585,11 +585,11 @@
ogg_int32_t BestHalfPixelError;
unsigned char BestHalfOffset;
unsigned char * RefDataPtr2;
- fragment_t *fp = &cpi->frag[0][fi];
+ int bi = cpi->frag_buffer_index[fi];
/* Set up the source pointer for the block. */
- SrcPtr = &cpi->frame[fp->buffer_index];
- RefPtr = &RefFramePtr[fp->buffer_index];
+ SrcPtr = &cpi->frame[bi];
+ RefPtr = &RefFramePtr[bi];
RefPtr = RefPtr - ((MAX_MV_EXTENT/2) * cpi->stride[0]) - (MAX_MV_EXTENT/2);
/* Search each pixel alligned site */
@@ -657,7 +657,7 @@
macroblock_t *mp,
mv_t *MV ) {
ogg_uint32_t InterMVError;
- unsigned char *cp = cpi->frag_coded[0];
+ unsigned char *cp = cpi->frag_coded;
dsp_save_fpu (cpi->dsp);
More information about the commits
mailing list