[xiph-cvs] cvs commit: theora/lib dct_decode.c dct_encode.c encode.c encoder_internal.h frinit.c mcomp.c misc_common.c pb.c pp.c quant.c scan.c toplevel.c
Monty
xiphmont at xiph.org
Mon Sep 23 01:31:03 PDT 2002
xiphmont 02/09/23 04:31:03
Modified: lib dct_decode.c dct_encode.c encode.c
encoder_internal.h frinit.c mcomp.c misc_common.c
pb.c pp.c quant.c scan.c toplevel.c
Log:
Some API cleanup; eliminate a few of the more egrregious examples of
duplicated fields.
Revision Changes Path
1.3 +23 -23 theora/lib/dct_decode.c
Index: dct_decode.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/dct_decode.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- dct_decode.c 20 Sep 2002 22:01:43 -0000 1.2
+++ dct_decode.c 23 Sep 2002 08:31:02 -0000 1.3
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: dct_decode.c,v 1.2 2002/09/20 22:01:43 xiphmont Exp $
+ last mod: $Id: dct_decode.c,v 1.3 2002/09/23 08:31:02 xiphmont Exp $
********************************************************************/
@@ -97,10 +97,10 @@
/* Select the appropriate inverse Q matrix and line stride */
if ( FragmentNumber<(ogg_int32_t)pbi->YPlaneFragments ){
- ReconPixelsPerLine = pbi->Configuration.YStride;
+ ReconPixelsPerLine = pbi->YStride;
pbi->dequant_coeffs = pbi->dequant_Y_coeffs;
}else{
- ReconPixelsPerLine = pbi->Configuration.UVStride;
+ ReconPixelsPerLine = pbi->UVStride;
pbi->dequant_coeffs = pbi->dequant_UV_coeffs;
}
@@ -155,7 +155,7 @@
/* Select the appropriate inverse Q matrix and line stride */
if ( FragmentNumber<(ogg_int32_t)pbi->YPlaneFragments ) {
- ReconPixelsPerLine = pbi->Configuration.YStride;
+ ReconPixelsPerLine = pbi->YStride;
MvShift = 1;
MvModMask = 0x00000001;
@@ -165,7 +165,7 @@
else
pbi->dequant_coeffs = pbi->dequant_Inter_coeffs;
}else{
- ReconPixelsPerLine = pbi->Configuration.UVStride;
+ ReconPixelsPerLine = pbi->UVStride;
MvShift = 2;
MvModMask = 0x00000003;
@@ -296,17 +296,17 @@
/* Work out various plane specific values */
if ( PlaneFragOffset == 0 ) {
/* Y Plane */
- BlockVStep = (pbi->Configuration.YStride *
- (pbi->Configuration.VFragPixels - 1));
- PlaneStride = pbi->Configuration.YStride;
+ BlockVStep = (pbi->YStride *
+ (VFRAGPIXELS - 1));
+ PlaneStride = pbi->YStride;
PlaneBorderWidth = UMV_BORDER;
PlaneFragments = pbi->YPlaneFragments;
LineFragments = pbi->HFragments;
}else{
/* U or V plane. */
- BlockVStep = (pbi->Configuration.UVStride *
- (pbi->Configuration.VFragPixels - 1));
- PlaneStride = pbi->Configuration.UVStride;
+ BlockVStep = (pbi->UVStride *
+ (VFRAGPIXELS - 1));
+ PlaneStride = pbi->UVStride;
PlaneBorderWidth = UMV_BORDER / 2;
PlaneFragments = pbi->UVPlaneFragments;
LineFragments = pbi->HFragments / 2;
@@ -353,16 +353,16 @@
/* Work out various plane specific values */
if ( PlaneFragOffset == 0 ) {
/* Y Plane */
- PlaneStride = pbi->Configuration.YStride;
+ PlaneStride = pbi->YStride;
PlaneBorderWidth = UMV_BORDER;
LineFragments = pbi->HFragments;
- PlaneHeight = pbi->Configuration.VideoFrameHeight;
+ PlaneHeight = pbi->info.height;
}else{
/* U or V plane. */
- PlaneStride = pbi->Configuration.UVStride;
+ PlaneStride = pbi->UVStride;
PlaneBorderWidth = UMV_BORDER / 2;
LineFragments = pbi->HFragments / 2;
- PlaneHeight = pbi->Configuration.VideoFrameHeight / 2;
+ PlaneHeight = pbi->info.height / 2;
}
/* Setup the source data values and destination pointers for the
@@ -373,7 +373,7 @@
PixelIndex = pbi->recon_pixel_index_table[PlaneFragOffset +
LineFragments - 1] +
- (pbi->Configuration.HFragPixels - 1);
+ (HFRAGPIXELS - 1);
SrcPtr2 = &DestReconPtr[ PixelIndex ];
DestPtr2 = &DestReconPtr[ PixelIndex + 1 ];
@@ -420,7 +420,7 @@
/* Copy over only updated blocks.*/
/* First Y plane */
- PlaneLineStep = pbi->Configuration.YStride;
+ PlaneLineStep = pbi->YStride;
for ( i = 0; i < pbi->YPlaneFragments; i++ ) {
if ( pbi->display_fragments[i] ) {
PixelIndex = pbi->recon_pixel_index_table[i];
@@ -432,7 +432,7 @@
}
/* Then U and V */
- PlaneLineStep = pbi->Configuration.UVStride;
+ PlaneLineStep = pbi->UVStride;
for ( i = pbi->YPlaneFragments; i < pbi->UnitFragments; i++ ) {
if ( pbi->display_fragments[i] ) {
PixelIndex = pbi->recon_pixel_index_table[i];
@@ -461,7 +461,7 @@
/* Copy over only updated blocks. */
/* First Y plane */
- PlaneLineStep = pbi->Configuration.YStride;
+ PlaneLineStep = pbi->YStride;
for ( i = 0; i < pbi->YPlaneFragments; i++ ) {
if ( !pbi->display_fragments[i] ) {
PixelIndex = pbi->recon_pixel_index_table[i];
@@ -473,7 +473,7 @@
}
/* Then U and V */
- PlaneLineStep = pbi->Configuration.UVStride;
+ PlaneLineStep = pbi->UVStride;
for ( i = pbi->YPlaneFragments; i < pbi->UnitFragments; i++ ) {
if ( !pbi->display_fragments[i] ) {
PixelIndex = pbi->recon_pixel_index_table[i];
@@ -734,7 +734,7 @@
ToFragment = pbi->YPlaneFragments;
FragsAcross = pbi->HFragments;
FragsDown = pbi->VFragments;
- LineLength = pbi->Configuration.YStride;
+ LineLength = pbi->YStride;
LineFragments = pbi->HFragments;
break;
case 1: /* u */
@@ -742,7 +742,7 @@
ToFragment = pbi->YPlaneFragments + pbi->UVPlaneFragments ;
FragsAcross = pbi->HFragments >> 1;
FragsDown = pbi->VFragments >> 1;
- LineLength = pbi->Configuration.UVStride;
+ LineLength = pbi->UVStride;
LineFragments = pbi->HFragments / 2;
break;
case 2: /* v */
@@ -750,7 +750,7 @@
ToFragment = pbi->YPlaneFragments + (2 * pbi->UVPlaneFragments) ;
FragsAcross = pbi->HFragments >> 1;
FragsDown = pbi->VFragments >> 1;
- LineLength = pbi->Configuration.UVStride;
+ LineLength = pbi->UVStride;
LineFragments = pbi->HFragments / 2;
break;
}
<p><p>1.5 +3 -3 theora/lib/dct_encode.c
Index: dct_encode.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/dct_encode.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- dct_encode.c 20 Sep 2002 22:01:43 -0000 1.4
+++ dct_encode.c 23 Sep 2002 08:31:02 -0000 1.5
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: dct_encode.c,v 1.4 2002/09/20 22:01:43 xiphmont Exp $
+ last mod: $Id: dct_encode.c,v 1.5 2002/09/23 08:31:02 xiphmont Exp $
********************************************************************/
@@ -479,10 +479,10 @@
/* Set plane specific values */
if (FragIndex < (ogg_int32_t)cpi->pb.YPlaneFragments){
- ReconPixelsPerLine = cpi->pb.Configuration.YStride;
+ ReconPixelsPerLine = cpi->pb.YStride;
MvDevisor = 2; /* 1/2 pixel accuracy in Y */
}else{
- ReconPixelsPerLine = cpi->pb.Configuration.UVStride;
+ ReconPixelsPerLine = cpi->pb.UVStride;
MvDevisor = 4; /* UV planes at 1/2 resolution of Y */
}
<p><p>1.7 +8 -8 theora/lib/encode.c
Index: encode.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/encode.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- encode.c 23 Sep 2002 02:01:28 -0000 1.6
+++ encode.c 23 Sep 2002 08:31:02 -0000 1.7
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: encode.c,v 1.6 2002/09/23 02:01:28 xiphmont Exp $
+ last mod: $Id: encode.c,v 1.7 2002/09/23 08:31:02 xiphmont Exp $
********************************************************************/
@@ -527,11 +527,11 @@
/* Is the block a Y block or a UV block. */
if ( BlockIndex < (ogg_int32_t)cpi->pb.YPlaneFragments ) {
- SrcStride = cpi->pb.Configuration.VideoFrameWidth;
- RecStride = cpi->pb.Configuration.YStride;
+ SrcStride = cpi->pb.info.width;
+ RecStride = cpi->pb.YStride;
}else{
- SrcStride = cpi->pb.Configuration.VideoFrameWidth >> 1;
- RecStride = cpi->pb.Configuration.UVStride;
+ SrcStride = cpi->pb.info.width >> 1;
+ RecStride = cpi->pb.UVStride;
}
@@ -740,15 +740,15 @@
/* Encode and tokenise the Y, U and V components */
coded_pixels = QuadCodeComponent(cpi, 0, cpi->pb.YSBRows, cpi->pb.YSBCols,
- cpi->pb.Configuration.VideoFrameWidth );
+ cpi->pb.info.width );
coded_pixels += QuadCodeComponent(cpi, cpi->pb.YSuperBlocks,
cpi->pb.UVSBRows,
cpi->pb.UVSBCols,
- cpi->pb.Configuration.VideoFrameWidth>>1 );
+ cpi->pb.info.width>>1 );
coded_pixels += QuadCodeComponent(cpi,
cpi->pb.YSuperBlocks+cpi->pb.UVSuperBlocks,
cpi->pb.UVSBRows, cpi->pb.UVSBCols,
- cpi->pb.Configuration.VideoFrameWidth>>1 );
+ cpi->pb.info.width>>1 );
/* for y,u,v */
for ( j = 0; j < 3 ; j++) {
<p><p>1.7 +11 -29 theora/lib/encoder_internal.h
Index: encoder_internal.h
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/encoder_internal.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- encoder_internal.h 23 Sep 2002 02:01:28 -0000 1.6
+++ encoder_internal.h 23 Sep 2002 08:31:02 -0000 1.7
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: encoder_internal.h,v 1.6 2002/09/23 02:01:28 xiphmont Exp $
+ last mod: $Id: encoder_internal.h,v 1.7 2002/09/23 08:31:02 xiphmont Exp $
********************************************************************/
@@ -24,6 +24,8 @@
/* Baseline dct height and width. */
#define BLOCK_HEIGHT_WIDTH 8
+#define HFRAGPIXELS 8
+#define VFRAGPIXELS 8
/* Baseline dct block size */
#define BLOCK_SIZE (BLOCK_HEIGHT_WIDTH * BLOCK_HEIGHT_WIDTH)
@@ -58,25 +60,10 @@
#define MAX_MV_EXTENT 31 /* Max search distance in half pixel increments */
-typedef struct CONFIG_TYPE{
- /* The size of the surface we want to draw to */
- ogg_uint32_t VideoFrameWidth;
- ogg_uint32_t VideoFrameHeight;
-
- ogg_uint32_t YStride;
- ogg_uint32_t UVStride;
-
- /* The number of horizontal and vertical blocks encoded */
- ogg_uint32_t HFragPixels;
- ogg_uint32_t VFragPixels;
-} CONFIG_TYPE;
-
typedef struct CONFIG_TYPE2{
- ogg_uint32_t TargetBandwidth;
double OutputFrameRate;
- ogg_uint32_t OutputFrameRateN;
- ogg_uint32_t OutputFrameRateD;
-
+ ogg_uint32_t TargetBandwidth;
+
ogg_uint32_t FirstFrameQ;
ogg_uint32_t BaseQ;
ogg_uint32_t MaxQ; /* Absolute Max Q allowed. */
@@ -99,8 +86,6 @@
each block */
ogg_uint32_t VideoFrameHeight;
ogg_uint32_t VideoFrameWidth;
- unsigned char HFragPixels;
- unsigned char VFragPixels;
} SCAN_CONFIG_DATA;
@@ -255,6 +240,10 @@
typedef struct PB_INSTANCE {
oggpack_buffer opb;
+ theora_info info;
+ /* how far do we shift the granulepos to seperate out P frame counts? */
+ int keyframe_granule_shift;
+
/***********************************************************************/
/* Decoder and Frame Type Information */
@@ -280,10 +269,11 @@
/**********************************************************************/
/* Frame Size & Index Information */
- CONFIG_TYPE Configuration; /* frame configuration */
ogg_uint32_t YPlaneSize;
ogg_uint32_t UVPlaneSize;
+ ogg_uint32_t YStride;
+ ogg_uint32_t UVStride;
ogg_uint32_t VFragments;
ogg_uint32_t HFragments;
ogg_uint32_t UnitFragments;
@@ -458,11 +448,6 @@
unsigned char *DataOutputInPtr;
- /* fields to store some extra header information useful to the
- application, but not really the codec */
-
- int quality;
- int target_bitrate;
} PB_INSTANCE;
@@ -657,9 +642,6 @@
int packetflag;
int doneflag;
- /* how far do we shift the granulepos to seperate out P frame counts? */
- int keyframe_granule_shift;
-
} CP_INSTANCE;
/*#define clamp255(x) (((ogg_int32_t)(x)&~0xff)?((ogg_int32_t)(x))>>31:(x))*/
<p><p>1.4 +33 -36 theora/lib/frinit.c
Index: frinit.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/frinit.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- frinit.c 23 Sep 2002 02:01:28 -0000 1.3
+++ frinit.c 23 Sep 2002 08:31:02 -0000 1.4
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: frinit.c,v 1.3 2002/09/23 02:01:28 xiphmont Exp $
+ last mod: $Id: frinit.c,v 1.4 2002/09/23 08:31:02 xiphmont Exp $
********************************************************************/
@@ -74,21 +74,21 @@
PixelIndexTablePtr = pbi->pixel_index_table;
for ( i = 0; i < pbi->YPlaneFragments; i++ ) {
PixelIndexTablePtr[ i ] =
- ((i / pbi->HFragments) * pbi->Configuration.VFragPixels *
- pbi->Configuration.VideoFrameWidth);
+ ((i / pbi->HFragments) * VFRAGPIXELS *
+ pbi->info.width);
PixelIndexTablePtr[ i ] +=
- ((i % pbi->HFragments) * pbi->Configuration.HFragPixels);
+ ((i % pbi->HFragments) * HFRAGPIXELS);
}
PixelIndexTablePtr = &pbi->pixel_index_table[pbi->YPlaneFragments];
for ( i = 0; i < ((pbi->HFragments >> 1) * pbi->VFragments); i++ ) {
PixelIndexTablePtr[ i ] =
((i / (pbi->HFragments / 2) ) *
- (pbi->Configuration.VFragPixels *
- (pbi->Configuration.VideoFrameWidth / 2)) );
+ (VFRAGPIXELS *
+ (pbi->info.width / 2)) );
PixelIndexTablePtr[ i ] +=
((i % (pbi->HFragments / 2) ) *
- pbi->Configuration.HFragPixels) + pbi->YPlaneSize;
+ HFRAGPIXELS) + pbi->YPlaneSize;
}
/************************************************************************/
@@ -96,10 +96,10 @@
PixelIndexTablePtr = pbi->recon_pixel_index_table;
for ( i = 0; i < pbi->YPlaneFragments; i++ ){
PixelIndexTablePtr[ i ] =
- ((i / pbi->HFragments) * pbi->Configuration.VFragPixels *
- pbi->Configuration.YStride);
+ ((i / pbi->HFragments) * VFRAGPIXELS *
+ pbi->YStride);
PixelIndexTablePtr[ i ] +=
- ((i % pbi->HFragments) * pbi->Configuration.HFragPixels) +
+ ((i % pbi->HFragments) * HFRAGPIXELS) +
pbi->ReconYDataOffset;
}
@@ -108,10 +108,10 @@
for ( i = 0; i < pbi->UVPlaneFragments; i++ ) {
PixelIndexTablePtr[ i ] =
((i / (pbi->HFragments / 2) ) *
- (pbi->Configuration.VFragPixels * (pbi->Configuration.UVStride)) );
+ (VFRAGPIXELS * (pbi->UVStride)) );
PixelIndexTablePtr[ i ] +=
((i % (pbi->HFragments / 2) ) *
- pbi->Configuration.HFragPixels) + pbi->ReconUDataOffset;
+ HFRAGPIXELS) + pbi->ReconUDataOffset;
}
/* V blocks */
@@ -122,9 +122,9 @@
for ( i = 0; i < pbi->UVPlaneFragments; i++ ) {
PixelIndexTablePtr[ i ] =
((i / (pbi->HFragments / 2) ) *
- (pbi->Configuration.VFragPixels * (pbi->Configuration.UVStride)) );
+ (VFRAGPIXELS * (pbi->UVStride)) );
PixelIndexTablePtr[ i ] +=
- ((i % (pbi->HFragments / 2) ) * pbi->Configuration.HFragPixels) +
+ ((i % (pbi->HFragments / 2) ) * HFRAGPIXELS) +
pbi->ReconVDataOffset;
}
}
@@ -333,22 +333,19 @@
/* Set the frame size etc. */
- pbi->YPlaneSize = pbi->Configuration.VideoFrameWidth *
- pbi->Configuration.VideoFrameHeight;
+ pbi->YPlaneSize = pbi->info.width *
+ pbi->info.height;
pbi->UVPlaneSize = pbi->YPlaneSize / 4;
- pbi->HFragments = pbi->Configuration.VideoFrameWidth /
- pbi->Configuration.HFragPixels;
- pbi->VFragments = pbi->Configuration.VideoFrameHeight /
- pbi->Configuration.VFragPixels;
+ pbi->HFragments = pbi->info.width / HFRAGPIXELS;
+ pbi->VFragments = pbi->info.height / VFRAGPIXELS;
pbi->UnitFragments = ((pbi->VFragments * pbi->HFragments)*3)/2;
pbi->YPlaneFragments = pbi->HFragments * pbi->VFragments;
pbi->UVPlaneFragments = pbi->YPlaneFragments / 4;
- pbi->Configuration.YStride =
- (pbi->Configuration.VideoFrameWidth + STRIDE_EXTRA);
- pbi->Configuration.UVStride = pbi->Configuration.YStride / 2;
- pbi->ReconYPlaneSize = pbi->Configuration.YStride *
- (pbi->Configuration.VideoFrameHeight + STRIDE_EXTRA);
+ pbi->YStride = (pbi->info.width + STRIDE_EXTRA);
+ pbi->UVStride = pbi->YStride / 2;
+ pbi->ReconYPlaneSize = pbi->YStride *
+ (pbi->info.height + STRIDE_EXTRA);
pbi->ReconUVPlaneSize = pbi->ReconYPlaneSize / 4;
FrameSize = pbi->ReconYPlaneSize + 2 * pbi->ReconUVPlaneSize;
@@ -356,21 +353,21 @@
pbi->UDataOffset = pbi->YPlaneSize;
pbi->VDataOffset = pbi->YPlaneSize + pbi->UVPlaneSize;
pbi->ReconYDataOffset =
- (pbi->Configuration.YStride * UMV_BORDER) + UMV_BORDER;
+ (pbi->YStride * UMV_BORDER) + UMV_BORDER;
pbi->ReconUDataOffset = pbi->ReconYPlaneSize +
- (pbi->Configuration.UVStride * (UMV_BORDER/2)) + (UMV_BORDER/2);
+ (pbi->UVStride * (UMV_BORDER/2)) + (UMV_BORDER/2);
pbi->ReconVDataOffset = pbi->ReconYPlaneSize + pbi->ReconUVPlaneSize +
- (pbi->Configuration.UVStride * (UMV_BORDER/2)) + (UMV_BORDER/2);
+ (pbi->UVStride * (UMV_BORDER/2)) + (UMV_BORDER/2);
/* Image dimensions in Super-Blocks */
- pbi->YSBRows = (pbi->Configuration.VideoFrameHeight/32) +
- ( pbi->Configuration.VideoFrameHeight%32 ? 1 : 0 );
- pbi->YSBCols = (pbi->Configuration.VideoFrameWidth/32) +
- ( pbi->Configuration.VideoFrameWidth%32 ? 1 : 0 );
- pbi->UVSBRows = ((pbi->Configuration.VideoFrameHeight/2)/32) +
- ( (pbi->Configuration.VideoFrameHeight/2)%32 ? 1 : 0 );
- pbi->UVSBCols = ((pbi->Configuration.VideoFrameWidth/2)/32) +
- ( (pbi->Configuration.VideoFrameWidth/2)%32 ? 1 : 0 );
+ pbi->YSBRows = (pbi->info.height/32) +
+ ( pbi->info.height%32 ? 1 : 0 );
+ pbi->YSBCols = (pbi->info.width/32) +
+ ( pbi->info.width%32 ? 1 : 0 );
+ pbi->UVSBRows = ((pbi->info.height/2)/32) +
+ ( (pbi->info.height/2)%32 ? 1 : 0 );
+ pbi->UVSBCols = ((pbi->info.width/2)/32) +
+ ( (pbi->info.width/2)%32 ? 1 : 0 );
/* Super-Blocks per component */
pbi->YSuperBlocks = pbi->YSBRows * pbi->YSBCols;
<p><p>1.5 +9 -9 theora/lib/mcomp.c
Index: mcomp.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/mcomp.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- mcomp.c 20 Sep 2002 22:01:43 -0000 1.4
+++ mcomp.c 23 Sep 2002 08:31:02 -0000 1.5
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: mcomp.c,v 1.4 2002/09/20 22:01:43 xiphmont Exp $
+ last mod: $Id: mcomp.c,v 1.5 2002/09/23 08:31:02 xiphmont Exp $
********************************************************************/
@@ -24,7 +24,7 @@
int i;
int SearchSite=0;
int Len;
- int LineStepY = (ogg_int32_t)cpi->pb.Configuration.YStride;
+ int LineStepY = (ogg_int32_t)cpi->pb.YStride;
Len=((MAX_MV_EXTENT/2)+1)/2;
@@ -388,7 +388,7 @@
ogg_int32_t LastXMV,
ogg_int32_t LastYMV,
ogg_uint32_t PixelsPerLine ) {
- ogg_uint32_t RefPixelsPerLine = cpi->pb.Configuration.YStride;
+ ogg_uint32_t RefPixelsPerLine = cpi->pb.YStride;
ogg_uint32_t LocalFragIndex = FragIndex;
ogg_int32_t PixelIndex;
ogg_int32_t RefPixelIndex;
@@ -485,7 +485,7 @@
unsigned char *CandidateBlockPtr=NULL;
unsigned char *BestBlockPtr=NULL;
- ogg_uint32_t RefRow2Offset = cpi->pb.Configuration.YStride * 8;
+ ogg_uint32_t RefRow2Offset = cpi->pb.YStride * 8;
int MBlockDispFrags[4];
@@ -673,7 +673,7 @@
unsigned char *CandidateBlockPtr=NULL;
unsigned char *BestBlockPtr=NULL;
- ogg_uint32_t RefRow2Offset = cpi->pb.Configuration.YStride * 8;
+ ogg_uint32_t RefRow2Offset = cpi->pb.YStride * 8;
int MBlockDispFrags[4];
@@ -704,7 +704,7 @@
RefPtr = &RefFramePtr[cpi->pb.recon_pixel_index_table[FragIndex]];
RefPtr = RefPtr - ((MAX_MV_EXTENT/2) * cpi->
- pb.Configuration.YStride) - (MAX_MV_EXTENT/2);
+ pb.YStride) - (MAX_MV_EXTENT/2);
/* Search each pixel alligned site */
for ( i = 0; i < (ogg_int32_t)MAX_MV_EXTENT; i ++ ) {
@@ -746,7 +746,7 @@
}
/* Move on to the next row. */
- RefPtr += cpi->pb.Configuration.YStride;
+ RefPtr += cpi->pb.YStride;
}
@@ -841,7 +841,7 @@
RefPtr = &RefFramePtr[cpi->pb.recon_pixel_index_table[FragIndex]];
RefPtr = RefPtr - ((MAX_MV_EXTENT/2) *
- cpi->pb.Configuration.YStride) - (MAX_MV_EXTENT/2);
+ cpi->pb.YStride) - (MAX_MV_EXTENT/2);
/* Search each pixel alligned site */
for ( i = 0; i < (ogg_int32_t)MAX_MV_EXTENT; i ++ ) {
@@ -866,7 +866,7 @@
}
/* Move on to the next row. */
- RefPtr += cpi->pb.Configuration.YStride;
+ RefPtr += cpi->pb.YStride;
}
/* Factor vectors to 1/2 pixel resoultion. */
<p><p>1.7 +7 -7 theora/lib/misc_common.c
Index: misc_common.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/misc_common.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- misc_common.c 23 Sep 2002 02:01:28 -0000 1.6
+++ misc_common.c 23 Sep 2002 08:31:02 -0000 1.7
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: misc_common.c,v 1.6 2002/09/23 02:01:28 xiphmont Exp $
+ last mod: $Id: misc_common.c,v 1.7 2002/09/23 08:31:02 xiphmont Exp $
********************************************************************/
@@ -295,7 +295,7 @@
ogg_uint32_t PixelIndex;
/* Copy back for Y plane. */
- PlaneLineStep = cpi->pb.Configuration.VideoFrameWidth;
+ PlaneLineStep = cpi->pb.info.width;
for ( i = 0; i < cpi->pb.YPlaneFragments; i++ ) {
/* We are only interested in updated fragments. */
if ( cpi->extra_fragments[i] ) {
@@ -304,8 +304,8 @@
SrcPtr = &cpi->yuv1ptr[PixelIndex];
DestPtr = &cpi->ConvDestBuffer[PixelIndex];
- for ( j = 0; j < cpi->pb.Configuration.VFragPixels; j++ ) {
- memcpy( DestPtr, SrcPtr, cpi->pb.Configuration.HFragPixels );
+ for ( j = 0; j < VFRAGPIXELS; j++ ) {
+ memcpy( DestPtr, SrcPtr, HFRAGPIXELS);
SrcPtr += PlaneLineStep;
DestPtr += PlaneLineStep;
@@ -314,7 +314,7 @@
}
/* Now the U and V planes */
- PlaneLineStep = cpi->pb.Configuration.VideoFrameWidth / 2;
+ PlaneLineStep = cpi->pb.info.width / 2;
for ( i = cpi->pb.YPlaneFragments;
i < (cpi->pb.YPlaneFragments + (2 * cpi->pb.UVPlaneFragments)) ;
i++ ) {
@@ -326,8 +326,8 @@
SrcPtr = &cpi->yuv1ptr[PixelIndex];
DestPtr = &cpi->ConvDestBuffer[PixelIndex];
- for ( j = 0; j < cpi->pb.Configuration.VFragPixels; j++ ) {
- memcpy( DestPtr, SrcPtr, cpi->pb.Configuration.HFragPixels );
+ for ( j = 0; j < VFRAGPIXELS; j++ ) {
+ memcpy( DestPtr, SrcPtr, HFRAGPIXELS);
SrcPtr += PlaneLineStep;
DestPtr += PlaneLineStep;
}
<p><p>1.3 +1 -8 theora/lib/pb.c
Index: pb.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/pb.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pb.c 23 Sep 2002 02:01:28 -0000 1.2
+++ pb.c 23 Sep 2002 08:31:02 -0000 1.3
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: pb.c,v 1.2 2002/09/23 02:01:28 xiphmont Exp $
+ last mod: $Id: pb.c,v 1.3 2002/09/23 08:31:02 xiphmont Exp $
********************************************************************/
@@ -89,15 +89,8 @@
}
void InitPBInstance(PB_INSTANCE *pbi){
- CONFIG_TYPE ConfigurationInit = {
- 0,0,0,0,
- 8,8,
- };
-
/* initialize whole structure to 0 */
memset(pbi, 0, sizeof(*pbi));
-
- memcpy(&pbi->Configuration,&ConfigurationInit, sizeof(pbi->Configuration));
InitTmpBuffers(pbi);
<p><p>1.6 +5 -5 theora/lib/pp.c
Index: pp.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/pp.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- pp.c 23 Sep 2002 02:01:28 -0000 1.5
+++ pp.c 23 Sep 2002 08:31:02 -0000 1.6
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: pp.c,v 1.5 2002/09/23 02:01:28 xiphmont Exp $
+ last mod: $Id: pp.c,v 1.6 2002/09/23 08:31:02 xiphmont Exp $
********************************************************************/
@@ -452,7 +452,7 @@
SrcPtr = Src + pbi->ReconYDataOffset;
DestPtr = Dst + pbi->ReconYDataOffset;
- LineLength = pbi->Configuration.YStride;
+ LineLength = pbi->YStride;
Block = 0;
@@ -823,7 +823,7 @@
switch( Channel ){
case 0:
/* Get the parameters */
- PlaneLineStep = pbi->Configuration.YStride;
+ PlaneLineStep = pbi->YStride;
FragsAcross = pbi->HFragments;
FragsDown = pbi->VFragments;
StartFrag = 0;
@@ -834,7 +834,7 @@
case 1:
/* Get the parameters */
- PlaneLineStep = pbi->Configuration.UVStride;
+ PlaneLineStep = pbi->UVStride;
FragsAcross = pbi->HFragments / 2;
FragsDown = pbi->VFragments / 2;
StartFrag = pbi->YPlaneFragments;
@@ -846,7 +846,7 @@
default:
/* Get the parameters */
- PlaneLineStep = pbi->Configuration.UVStride;
+ PlaneLineStep = pbi->UVStride;
FragsAcross = pbi->HFragments / 2;
FragsDown = pbi->VFragments / 2;
StartFrag = pbi->YPlaneFragments + pbi->UVPlaneFragments;
<p><p>1.3 +2 -2 theora/lib/quant.c
Index: quant.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/quant.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- quant.c 20 Sep 2002 22:01:43 -0000 1.2
+++ quant.c 23 Sep 2002 08:31:02 -0000 1.3
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: quant.c,v 1.2 2002/09/20 22:01:43 xiphmont Exp $
+ last mod: $Id: quant.c,v 1.3 2002/09/23 08:31:02 xiphmont Exp $
********************************************************************/
@@ -316,7 +316,7 @@
memset( quantized_list, 0, 64 * sizeof(Q_LIST_ENTRY) );
/* Note that we add half divisor to effect rounding on positive number */
- for( i = 0; i < pbi->Configuration.VFragPixels; i++) {
+ for( i = 0; i < VFRAGPIXELS; i++) {
/* Column 0 */
if ( DCT_blockPtr[0] >= FquantZBinSizePtr[0] ) {
temp = FquantCoeffsPtr[0] * ( DCT_blockPtr[0] + FquantRoundPtr[0] ) ;
<p><p>1.4 +82 -84 theora/lib/scan.c
Index: scan.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/scan.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- scan.c 20 Sep 2002 22:01:43 -0000 1.3
+++ scan.c 23 Sep 2002 08:31:02 -0000 1.4
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: scan.c,v 1.3 2002/09/20 22:01:43 xiphmont Exp $
+ last mod: $Id: scan.c,v 1.4 2002/09/23 08:31:02 xiphmont Exp $
********************************************************************/
@@ -181,9 +181,9 @@
for ( i = 0; i < (ppi->ScanYPlaneFragments); i++ ) {
PixelIndexTablePtr[ i ] =
((i / ppi->ScanHFragments) *
- ppi->VFragPixels * ppi->ScanConfig.VideoFrameWidth);
+ VFRAGPIXELS * ppi->ScanConfig.VideoFrameWidth);
PixelIndexTablePtr[ i ] +=
- ((i % ppi->ScanHFragments) * ppi->HFragPixels);
+ ((i % ppi->ScanHFragments) * HFRAGPIXELS);
}
PixelIndexTablePtr = &ppi->ScanPixelIndexTable[ppi->ScanYPlaneFragments];
@@ -191,10 +191,10 @@
for ( i = 0; i < (ppi->ScanUVPlaneFragments * 2); i++ ){
PixelIndexTablePtr[ i ] =
((i / (ppi->ScanHFragments >> 1) ) *
- (ppi->VFragPixels * (ppi->ScanConfig.VideoFrameWidth >> 1)) );
+ (VFRAGPIXELS * (ppi->ScanConfig.VideoFrameWidth >> 1)) );
PixelIndexTablePtr[ i ] +=
((i % (ppi->ScanHFragments >> 1) ) *
- ppi->HFragPixels) + ppi->YFramePixels;
+ HFRAGPIXELS) + ppi->YFramePixels;
}
}
@@ -270,8 +270,6 @@
ppi->ScanConfig.disp_fragments = ScanConfigPtr->disp_fragments;
ppi->ScanConfig.RegionIndex = ScanConfigPtr->RegionIndex;
- ppi->ScanConfig.HFragPixels = ScanConfigPtr->HFragPixels;
- ppi->ScanConfig.VFragPixels = ScanConfigPtr->VFragPixels;
ppi->ScanConfig.VideoFrameWidth = ScanConfigPtr->VideoFrameWidth;
ppi->ScanConfig.VideoFrameHeight = ScanConfigPtr->VideoFrameHeight;
@@ -287,11 +285,11 @@
/* Work out various fragment related values. */
ppi->ScanYPlaneFragments = ppi->YFramePixels /
- (ppi->HFragPixels * ppi->VFragPixels);
+ (HFRAGPIXELS * VFRAGPIXELS);
ppi->ScanUVPlaneFragments = ppi->UVFramePixels /
- (ppi->HFragPixels * ppi->VFragPixels);;
- ppi->ScanHFragments = ppi->ScanConfig.VideoFrameWidth / ppi->HFragPixels;
- ppi->ScanVFragments = ppi->ScanConfig.VideoFrameHeight / ppi->VFragPixels;
+ (HFRAGPIXELS * VFRAGPIXELS);;
+ ppi->ScanHFragments = ppi->ScanConfig.VideoFrameWidth / HFRAGPIXELS;
+ ppi->ScanVFragments = ppi->ScanConfig.VideoFrameHeight / VFRAGPIXELS;
ppi->ScanFrameFragments = ppi->ScanYPlaneFragments +
(2 * ppi->ScanUVPlaneFragments);
@@ -464,7 +462,7 @@
int InterestingBlocksInRow = 0;
/* For each row of pixels in the row of blocks */
- for ( j = 0; j < ppi->VFragPixels; j++ ){
+ for ( j = 0; j < VFRAGPIXELS; j++ ){
/* Set local block map pointer. */
LocalDispFragPtr = DispFragPtr;
@@ -554,8 +552,8 @@
LocalDispFragPtr++;
/* Step data pointers on ready for next block */
- LocalYuvPtr1 += ppi->HFragPixels;
- LocalYuvPtr2 += ppi->HFragPixels;
+ LocalYuvPtr1 += HFRAGPIXELS;
+ LocalYuvPtr2 += HFRAGPIXELS;
}
return InterestingBlocksInRow;
@@ -752,7 +750,7 @@
/* Cannot use kernel if at edge or if PAK disabled */
if ( (!ppi->PAKEnabled) || EdgeRow ){
- for ( i = 0; i < ppi->PlaneWidth; i += ppi->HFragPixels ){
+ for ( i = 0; i < ppi->PlaneWidth; i += HFRAGPIXELS ){
/* Reset count of pixels changed for the current fragment. */
FragChangedPixels = 0;
@@ -762,7 +760,7 @@
/* Clear down entries in changed locals array */
memset(ChLocalsPtr,0,8);
- for ( j = 0; j < ppi->HFragPixels; j++ ){
+ for ( j = 0; j < HFRAGPIXELS; j++ ){
/* Take a local copy of the measured difference. */
Diff = (int)YuvPtr1[j] - (int)YuvPtr2[j];
@@ -789,11 +787,11 @@
*RowDiffsPtr += FragChangedPixels;
*FDiffPixels += (unsigned char)FragChangedPixels;
- YuvPtr1 += ppi->HFragPixels;
- YuvPtr2 += ppi->HFragPixels;
- bits_map_ptr += ppi->HFragPixels;
- ChLocalsPtr += ppi->HFragPixels;
- YUVDiffsPtr += ppi->HFragPixels;
+ YuvPtr1 += HFRAGPIXELS;
+ YuvPtr2 += HFRAGPIXELS;
+ bits_map_ptr += HFRAGPIXELS;
+ ChLocalsPtr += HFRAGPIXELS;
+ YUVDiffsPtr += HFRAGPIXELS;
SgcPtr ++;
FDiffPixels ++;
@@ -820,7 +818,7 @@
/* Clear down entries in changed locals array */
memset(ChLocalsPtr,0,8);
- for ( j = 0; j < ppi->HFragPixels; j++ ){
+ for ( j = 0; j < HFRAGPIXELS; j++ ){
/* Take a local copy of the measured difference. */
Diff = (int)YuvPtr1[j] - (int)YuvPtr2[j];
@@ -851,11 +849,11 @@
*RowDiffsPtr += FragChangedPixels;
*FDiffPixels += (unsigned char)FragChangedPixels;
- YuvPtr1 += ppi->HFragPixels;
- YuvPtr2 += ppi->HFragPixels;
- bits_map_ptr += ppi->HFragPixels;
- ChLocalsPtr += ppi->HFragPixels;
- YUVDiffsPtr += ppi->HFragPixels;
+ YuvPtr1 += HFRAGPIXELS;
+ YuvPtr2 += HFRAGPIXELS;
+ bits_map_ptr += HFRAGPIXELS;
+ ChLocalsPtr += HFRAGPIXELS;
+ YUVDiffsPtr += HFRAGPIXELS;
SgcPtr ++;
FDiffPixels ++;
@@ -870,8 +868,8 @@
/*************************************************************/
/* Fragment in between!! */
- for ( i = ppi->HFragPixels ; i < ppi->PlaneWidth-ppi->HFragPixels;
- i += ppi->HFragPixels ){
+ for ( i = HFRAGPIXELS ; i < ppi->PlaneWidth-HFRAGPIXELS;
+ i += HFRAGPIXELS ){
/* Reset count of pixels changed for the current fragment. */
FragChangedPixels = 0;
@@ -879,7 +877,7 @@
if (*DispFragPtr == CANDIDATE_BLOCK){
/* Clear down entries in changed locals array */
memset(ChLocalsPtr,0,8);
- for ( j = 0; j < ppi->HFragPixels; j++ ){
+ for ( j = 0; j < HFRAGPIXELS; j++ ){
/* Take a local copy of the measured difference. */
Diff = (int)YuvPtr1[j] - (int)YuvPtr2[j];
@@ -911,11 +909,11 @@
*RowDiffsPtr += FragChangedPixels;
*FDiffPixels += (unsigned char)FragChangedPixels;
- YuvPtr1 += ppi->HFragPixels;
- YuvPtr2 += ppi->HFragPixels;
- bits_map_ptr += ppi->HFragPixels;
- ChLocalsPtr += ppi->HFragPixels;
- YUVDiffsPtr += ppi->HFragPixels;
+ YuvPtr1 += HFRAGPIXELS;
+ YuvPtr2 += HFRAGPIXELS;
+ bits_map_ptr += HFRAGPIXELS;
+ ChLocalsPtr += HFRAGPIXELS;
+ YUVDiffsPtr += HFRAGPIXELS;
SgcPtr ++;
FDiffPixels ++;
@@ -939,7 +937,7 @@
/* Clear down entries in changed locals array */
memset(ChLocalsPtr,0,8);
- for ( j = 0; j < ppi->HFragPixels; j++ ){
+ for ( j = 0; j < HFRAGPIXELS; j++ ){
/* Take a local copy of the measured difference. */
Diff = (int)YuvPtr1[j] - (int)YuvPtr2[j];
@@ -1037,11 +1035,11 @@
if ( RowType == NOT_EDGE_ROW ){
/* Scan through the row of pixels and calculate changed locals. */
- for ( i = 0; i < ppi->PlaneWidth; i += ppi->HFragPixels ){
+ for ( i = 0; i < ppi->PlaneWidth; i += HFRAGPIXELS ){
/* Skip a group of 8 pixels if the assosciated fragment has no
pixels of interest. */
if ( *DispFragPtr == CANDIDATE_BLOCK ){
- for ( j = 0; j < ppi->HFragPixels; j++ ){
+ for ( j = 0; j < HFRAGPIXELS; j++ ){
changed_locals = 0;
/* If the pixel itself has changed */
@@ -1076,10 +1074,10 @@
memset(ChLocalsPtr,0,8);
/* Step pointers */
- ChLocalsPtr += ppi->HFragPixels;
- PixelsChangedPtr0 += ppi->HFragPixels;
- PixelsChangedPtr1 += ppi->HFragPixels;
- PixelsChangedPtr2 += ppi->HFragPixels;
+ ChLocalsPtr += HFRAGPIXELS;
+ PixelsChangedPtr0 += HFRAGPIXELS;
+ PixelsChangedPtr1 += HFRAGPIXELS;
+ PixelsChangedPtr2 += HFRAGPIXELS;
}
/* Move on to next fragment. */
@@ -1088,11 +1086,11 @@
}
}else{
/* Scan through the row of pixels and calculate changed locals. */
- for ( i = 0; i < ppi->PlaneWidth; i += ppi->HFragPixels ){
+ for ( i = 0; i < ppi->PlaneWidth; i += HFRAGPIXELS ){
/* Skip a group of 8 pixels if the assosciated fragment has no
pixels of interest */
if ( *DispFragPtr == CANDIDATE_BLOCK ){
- for ( j = 0; j < ppi->HFragPixels; j++ ){
+ for ( j = 0; j < HFRAGPIXELS; j++ ){
changed_locals = 0;
/* If the pixel itself has changed */
@@ -1138,10 +1136,10 @@
memset(ChLocalsPtr,0,8);
/* Step pointers */
- ChLocalsPtr += ppi->HFragPixels;
- PixelsChangedPtr0 += ppi->HFragPixels;
- PixelsChangedPtr1 += ppi->HFragPixels;
- PixelsChangedPtr2 += ppi->HFragPixels;
+ ChLocalsPtr += HFRAGPIXELS;
+ PixelsChangedPtr0 += HFRAGPIXELS;
+ PixelsChangedPtr1 += HFRAGPIXELS;
+ PixelsChangedPtr2 += HFRAGPIXELS;
}
/* Move on to next fragment. */
@@ -1165,7 +1163,7 @@
ogg_int32_t AbsDiff;
/* For each pixel in the row */
- for ( i = 0; i < ppi->PlaneWidth; i += ppi->HFragPixels ){
+ for ( i = 0; i < ppi->PlaneWidth; i += HFRAGPIXELS ){
/* Skip a group of 8 pixels if the assosciated fragment has no
pixels of interest. */
if ( *DispFragPtr == CANDIDATE_BLOCK ){
@@ -1173,7 +1171,7 @@
FragScore = 0;
/* Pixels grouped along the row into fragments */
- for ( j = 0; j < ppi->HFragPixels; j++ ){
+ for ( j = 0; j < HFRAGPIXELS; j++ ){
if ( PixelMapPtr[j] ){
AbsDiff = (ogg_int32_t)( abs(YUVDiffsPtr[j]) );
changed_locals = ChLocalsPtr[j];
@@ -1223,10 +1221,10 @@
/* Increment the various pointers */
FragScorePtr++;
DispFragPtr++;
- PixelNoiseScorePtr += ppi->HFragPixels;
- PixelMapPtr += ppi->HFragPixels;
- ChLocalsPtr += ppi->HFragPixels;
- YUVDiffsPtr += ppi->HFragPixels;
+ PixelNoiseScorePtr += HFRAGPIXELS;
+ PixelMapPtr += HFRAGPIXELS;
+ ChLocalsPtr += HFRAGPIXELS;
+ YUVDiffsPtr += HFRAGPIXELS;
}
}
@@ -1270,14 +1268,14 @@
if ( RowType == NOT_EDGE_ROW ){
/* Loop for all pixels in the row. */
- for ( i = 0; i < ppi->PlaneWidth; i += ppi->HFragPixels ){
+ for ( i = 0; i < ppi->PlaneWidth; i += HFRAGPIXELS ){
/* Does the fragment contain anything interesting to work with. */
if ( *DispFragPtr == CANDIDATE_BLOCK ){
/* Reset the cumulative fragment score. */
FragScore = 0;
/* Pixels grouped along the row into fragments */
- for ( j = 0; j < ppi->HFragPixels; j++ ){
+ for ( j = 0; j < HFRAGPIXELS; j++ ){
/* How many changed locals has the current pixel got. */
changed_locals = ChangedLocalsPtr[j];
@@ -1347,29 +1345,29 @@
}else{
/* Nothing to do for this fragment group */
/* Advance pointers into changed locals buffer */
- CHLocalsPtr0 += ppi->HFragPixels;
- CHLocalsPtr1 += ppi->HFragPixels;
- CHLocalsPtr2 += ppi->HFragPixels;
+ CHLocalsPtr0 += HFRAGPIXELS;
+ CHLocalsPtr1 += HFRAGPIXELS;
+ CHLocalsPtr2 += HFRAGPIXELS;
}
/* Increment the various pointers */
FragScorePtr++;
DispFragPtr++;
- PixelNoiseScorePtr += ppi->HFragPixels;
- ChangedLocalsPtr += ppi->HFragPixels;
- YUVDiffsPtr += ppi->HFragPixels;
+ PixelNoiseScorePtr += HFRAGPIXELS;
+ ChangedLocalsPtr += HFRAGPIXELS;
+ YUVDiffsPtr += HFRAGPIXELS;
}
}else{
/* This is either the top or bottom row of pixels in a plane. */
/* Loop for all pixels in the row. */
- for ( i = 0; i < ppi->PlaneWidth; i += ppi->HFragPixels ){
+ for ( i = 0; i < ppi->PlaneWidth; i += HFRAGPIXELS ){
/* Does the fragment contain anything interesting to work with. */
if ( *DispFragPtr == CANDIDATE_BLOCK ){
/* Reset the cumulative fragment score. */
FragScore = 0;
/* Pixels grouped along the row into fragments */
- for ( j = 0; j < ppi->HFragPixels; j++ ){
+ for ( j = 0; j < HFRAGPIXELS; j++ ){
/* How many changed locals has the current pixel got. */
changed_locals = ChangedLocalsPtr[j];
@@ -1458,17 +1456,17 @@
}else{
/* Nothing to do for this fragment group */
/* Advance pointers into changed locals buffer */
- CHLocalsPtr0 += ppi->HFragPixels;
- CHLocalsPtr1 += ppi->HFragPixels;
- CHLocalsPtr2 += ppi->HFragPixels;
+ CHLocalsPtr0 += HFRAGPIXELS;
+ CHLocalsPtr1 += HFRAGPIXELS;
+ CHLocalsPtr2 += HFRAGPIXELS;
}
/* Increment the various pointers */
FragScorePtr++;
DispFragPtr++;
- PixelNoiseScorePtr += ppi->HFragPixels;
- ChangedLocalsPtr += ppi->HFragPixels;
- YUVDiffsPtr += ppi->HFragPixels;
+ PixelNoiseScorePtr += HFRAGPIXELS;
+ ChangedLocalsPtr += HFRAGPIXELS;
+ YUVDiffsPtr += HFRAGPIXELS;
}
}
}
@@ -1699,14 +1697,14 @@
changed locals. */
/* Loop for all pixels in the row. */
- for ( i = 0; i < ppi->PlaneWidth; i += ppi->HFragPixels ){
+ for ( i = 0; i < ppi->PlaneWidth; i += HFRAGPIXELS ){
/* Does the fragment contain anything interesting to work with. */
if ( *DispFragPtr == CANDIDATE_BLOCK ){
/* Reset the cumulative fragment score. */
FragScore = 0;
/* Pixels grouped along the row into fragments */
- for ( j = 0; j < ppi->HFragPixels; j++ ){
+ for ( j = 0; j < HFRAGPIXELS; j++ ){
/* How many changed locals has the current pixel got. */
changed_locals = ChangedLocalsPtr[j];
@@ -1743,9 +1741,9 @@
/* Increment the various pointers */
FragScorePtr++;
DispFragPtr++;
- PixelNoiseScorePtr += ppi->HFragPixels;
- ChangedLocalsPtr += ppi->HFragPixels;
- YUVDiffsPtr += ppi->HFragPixels;
+ PixelNoiseScorePtr += HFRAGPIXELS;
+ ChangedLocalsPtr += HFRAGPIXELS;
+ YUVDiffsPtr += HFRAGPIXELS;
}
}
@@ -1772,7 +1770,7 @@
DestPtr = &ppi->ScanConfig.SrfWorkSpcPtr[PixelIndex];
/* For each row of the block */
- for ( j = 0; j < ppi->ScanConfig.VFragPixels; j++ ){
+ for ( j = 0; j < VFRAGPIXELS; j++ ){
/* Copy the data unaltered from source to destination */
memcpy(DestPtr,SourcePtr,8);
@@ -1783,7 +1781,7 @@
}
/* Increment pixel index for next block. */
- PixelIndex += ppi->ScanConfig.HFragPixels;
+ PixelIndex += HFRAGPIXELS;
}
}
@@ -2038,8 +2036,8 @@
}
/* Set up plane dimension variables */
- ppi->PlaneHFragments = PWidth / ppi->HFragPixels;
- ppi->PlaneVFragments = PHeight / ppi->VFragPixels;
+ ppi->PlaneHFragments = PWidth / HFRAGPIXELS;
+ ppi->PlaneVFragments = PHeight / VFRAGPIXELS;
ppi->PlaneWidth = PWidth;
ppi->PlaneHeight = PHeight;
ppi->PlaneStride = PStride;
@@ -2062,7 +2060,7 @@
RowDiffsPtr1 = ppi->RowChangedPixels;
RowDiffsPtr2 = ppi->RowChangedPixels;
- BlockRowPixels = ppi->PlaneWidth * ppi->VFragPixels;
+ BlockRowPixels = ppi->PlaneWidth * VFRAGPIXELS;
for ( i = 0; i < (ppi->PlaneVFragments + 4); i++ ){
RowNumber1 = (i - 1);
@@ -2151,13 +2149,13 @@
);
}
- for ( j = 0; j < ppi->VFragPixels; j++ ){
+ for ( j = 0; j < VFRAGPIXELS; j++ ){
/* Last two iterations do not apply */
if ( i < ppi->PlaneVFragments ){
/* Is the current fragment at an edge. */
EdgeRow = ( ( (i == 0) && (j == 0) ) ||
( (i == (ppi->PlaneVFragments - 1)) &&
- (j == (ppi->VFragPixels - 1)) ) );
+ (j == (VFRAGPIXELS - 1)) ) );
/* Clear the arrays that will be used for the changed pixels maps */
memset( PixelsChangedPtr0, 0, ppi->PlaneWidth );
@@ -2206,7 +2204,7 @@
else
RowChangedLocalsScan( ppi, PixelsChangedPtr1, ChLocalsPtr1,
DispFragPtr1,
- ((j==(ppi->VFragPixels-1)) ?
+ ((j==(VFRAGPIXELS-1)) ?
LAST_ROW : NOT_EDGE_ROW) );
NoiseScoreRow( ppi, PixelsChangedPtr1, ChLocalsPtr1, YUVDiffsPtr1,
@@ -2238,7 +2236,7 @@
PrimaryEdgeScoreRow( ppi, ChLocalsPtr2, YUVDiffsPtr2,
PixelScoresPtr2, FragScoresPtr2,
DispFragPtr2,
- ((j==(ppi->VFragPixels-1)) ?
+ ((j==(VFRAGPIXELS-1)) ?
LAST_ROW : NOT_EDGE_ROW) );
}
<p><p>1.7 +62 -60 theora/lib/toplevel.c
Index: toplevel.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/toplevel.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- toplevel.c 23 Sep 2002 02:01:28 -0000 1.6
+++ toplevel.c 23 Sep 2002 08:31:02 -0000 1.7
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: toplevel.c,v 1.6 2002/09/23 02:01:28 xiphmont Exp $
+ last mod: $Id: toplevel.c,v 1.7 2002/09/23 08:31:02 xiphmont Exp $
********************************************************************/
@@ -713,7 +713,7 @@
/* 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,
- cpi->pb.Configuration.VideoFrameWidth,
+ cpi->pb.info.width,
&InterError, &IntraError );
/* decide whether we really should have made this frame a key frame */
@@ -790,10 +790,6 @@
InitTmpBuffers(&cpi->pb);
InitPPInstance(&cpi->pp);
- /* some extras useful to the API */
- cpi->pb.target_bitrate=c->target_bitrate;
- cpi->pb.quality=c->quality;
-
/* Initialise Configuration structure to legal values */
if(c->quality>63)c->quality=63;
if(c->quality<0)c->quality=32;
@@ -826,6 +822,15 @@
if(!cpi->AutoKeyFrameEnabled)
c->keyframe_frequency_force = c->keyframe_frequency;
+ /* Set the frame rate variables. */
+ if ( c->fps_numerator < 1 )
+ c->fps_numerator = 1;
+ if ( c->fps_denominator < 1 )
+ c->fps_denominator = 1;
+
+ /* copy in config */
+ memcpy(&cpi->pb.info,c,sizeof(*c));
+
cpi->ForceKeyFrameEvery = c->keyframe_frequency_force;
cpi->KeyFrameFrequency = c->keyframe_frequency;
cpi->DropFramesAllowed = c->droppedframes_p;
@@ -842,18 +847,6 @@
/* Set up an encode buffer */
oggpackB_writeinit(&cpi->oggbuffer);
- cpi->pb.Configuration.HFragPixels = 8;
- cpi->pb.Configuration.VFragPixels = 8;
-
- /* Set the video frame size. */
- cpi->pb.YPlaneSize = 0xFFF;
- cpi->pb.Configuration.VideoFrameHeight = 0xFFF;
- cpi->pb.Configuration.VideoFrameHeight = c->height;
- cpi->pb.Configuration.VideoFrameWidth = c->width;
-
- /* Note the height and width in the pre-processor control structure. */
- cpi->ScanConfig.VideoFrameHeight = cpi->pb.Configuration.VideoFrameHeight;
- cpi->ScanConfig.VideoFrameWidth = cpi->pb.Configuration.VideoFrameWidth;
/* Set data rate related variables. */
cpi->Configuration.TargetBandwidth = (c->target_bitrate) / 8;
@@ -861,28 +854,23 @@
/* Set key frame data rate target */
cpi->KeyFrameDataTarget = (c->keyframe_data_target_bitrate) / 8;
- /* Set the frame rate variables. */
- cpi->Configuration.OutputFrameRateN = c->fps_numerator;
- cpi->Configuration.OutputFrameRateD = c->fps_denominator;
- if ( cpi->Configuration.OutputFrameRateN < 1 )
- cpi->Configuration.OutputFrameRateN = 1;
- if ( cpi->Configuration.OutputFrameRateD < 1 )
- cpi->Configuration.OutputFrameRateD = 1;
-
cpi->Configuration.OutputFrameRate =
- (double)( cpi->Configuration.OutputFrameRateN /
- cpi->Configuration.OutputFrameRateD );
+ (double)( c->fps_numerator /
+ c->fps_denominator );
cpi->frame_target_rate = cpi->Configuration.TargetBandwidth /
cpi->Configuration.OutputFrameRate;
/* Set key frame data rate target; this is nominal keyframe size */
cpi->KeyFrameDataTarget = (c->keyframe_data_target_bitrate *
- cpi->Configuration.OutputFrameRateN /
- cpi->Configuration.OutputFrameRateD ) / 8;
+ c->fps_numerator /
+ c->fps_denominator ) / 8;
+
+ /* Note the height and width in the pre-processor control structure. */
+ cpi->ScanConfig.VideoFrameHeight = cpi->pb.info.height;
+ cpi->ScanConfig.VideoFrameWidth = cpi->pb.info.width;
- /* Initialise image format details */
InitFrameDetails(&cpi->pb);
EInitFragmentInfo(cpi);
EInitFrameInfo(cpi);
@@ -893,10 +881,6 @@
cpi->ScanConfig.SrfWorkSpcPtr = cpi->ConvDestBuffer;
cpi->ScanConfig.disp_fragments = cpi->pb.display_fragments;
cpi->ScanConfig.RegionIndex = cpi->pb.pixel_index_table;
- cpi->ScanConfig.HFragPixels =
- (unsigned char)cpi->pb.Configuration.HFragPixels;
- cpi->ScanConfig.VFragPixels =
- (unsigned char)cpi->pb.Configuration.VFragPixels;
/* Initialise the pre-processor module. */
ScanYUVInit(&cpi->pp, &(cpi->ScanConfig));
@@ -910,7 +894,7 @@
long maxPframes=(int)cpi->ForceKeyFrameEvery >
(int)cpi->MinimumDistanceToKeyFrame ?
cpi->ForceKeyFrameEvery : cpi->MinimumDistanceToKeyFrame ;
- cpi->keyframe_granule_shift=_ilog(maxPframes-1);
+ cpi->pb.keyframe_granule_shift=_ilog(maxPframes-1);
}
/* Initialise Motion compensation */
@@ -956,8 +940,8 @@
if(cpi->doneflag)return OC_EINVAL;
/* If frame size has changed, abort out for now */
- if (yuv->y_height != (int)cpi->pb.Configuration.VideoFrameHeight ||
- yuv->y_width != (int)cpi->pb.Configuration.VideoFrameWidth )
+ if (yuv->y_height != (int)cpi->pb.info.height ||
+ yuv->y_width != (int)cpi->pb.info.width )
return(-1);
@@ -1027,7 +1011,7 @@
op->packetno=cpi->CurrentFrame;
op->granulepos=
- ((cpi->CurrentFrame-cpi->LastKeyFrame+1)<<cpi->keyframe_granule_shift)+
+ ((cpi->CurrentFrame-cpi->LastKeyFrame+1)<<cpi->pb.keyframe_granule_shift)+
cpi->LastKeyFrame-1;
cpi->packetflag=0;
@@ -1052,15 +1036,17 @@
oggpackB_write(&cpi->oggbuffer,VERSION_MINOR,8);
oggpackB_write(&cpi->oggbuffer,VERSION_SUB,8);
- oggpackB_write(&cpi->oggbuffer,cpi->ScanConfig.VideoFrameWidth,16);
- oggpackB_write(&cpi->oggbuffer,cpi->ScanConfig.VideoFrameHeight,16);
- oggpackB_write(&cpi->oggbuffer,cpi->Configuration.OutputFrameRateN,32);
- oggpackB_write(&cpi->oggbuffer,cpi->Configuration.OutputFrameRateD,32);
+ oggpackB_write(&cpi->oggbuffer,cpi->pb.info.width>>4,16);
+ oggpackB_write(&cpi->oggbuffer,cpi->pb.info.height>>4,16);
+ oggpackB_write(&cpi->oggbuffer,cpi->pb.info.fps_numerator,32);
+ oggpackB_write(&cpi->oggbuffer,cpi->pb.info.fps_denominator,32);
+ oggpackB_write(&cpi->oggbuffer,cpi->pb.info.aspect_numerator,24);
+ oggpackB_write(&cpi->oggbuffer,cpi->pb.info.aspect_denominator,24);
- oggpackB_write(&cpi->oggbuffer,cpi->keyframe_granule_shift,5);
+ oggpackB_write(&cpi->oggbuffer,cpi->pb.keyframe_granule_shift,5);
- oggpackB_write(&cpi->oggbuffer,cpi->pb.target_bitrate,24);
- oggpackB_write(&cpi->oggbuffer,cpi->pb.quality,6);
+ oggpackB_write(&cpi->oggbuffer,cpi->pb.info.target_bitrate,24);
+ oggpackB_write(&cpi->oggbuffer,cpi->pb.info.quality,6);
op->packet=oggpackB_get_buffer(&cpi->oggbuffer);
op->bytes=oggpackB_bytes(&cpi->oggbuffer);
@@ -1122,10 +1108,12 @@
if(c->version_minor>VERSION_MINOR)return(OC_VERSION);
}
- c->width=oggpackB_read(&opb,16);
- c->height=oggpackB_read(&opb,16);
+ c->width=oggpackB_read(&opb,16)<<4;
+ c->height=oggpackB_read(&opb,16)<<4;
c->fps_numerator=oggpackB_read(&opb,32);
c->fps_denominator=oggpackB_read(&opb,32);
+ c->aspect_numerator=oggpackB_read(&opb,24);
+ c->aspect_denominator=oggpackB_read(&opb,24);
c->keyframe_frequency_force=1<<oggpackB_read(&opb,5);
@@ -1143,17 +1131,15 @@
th->internal=pbi=_ogg_calloc(1,sizeof(*pbi));
InitPBInstance(pbi);
- pbi->Configuration.VideoFrameWidth = c->width;
- pbi->Configuration.VideoFrameHeight = c->height;
+ memcpy(&pbi->info,c,sizeof(*c));
InitFrameDetails(pbi);
+ pbi->keyframe_granule_shift=_ilog(c->keyframe_frequency_force-1);
+
pbi->LastFrameQualityValue = 0;
pbi->DecoderErrorCode = 0;
- pbi->Configuration.HFragPixels = 8;
- pbi->Configuration.VFragPixels = 8;
-
/* Clear down the YUVtoRGB conversion skipped list. */
memset(pbi->skipped_display_fragments, 0, pbi->UnitFragments );
@@ -1206,13 +1192,13 @@
int theora_decode_YUVout(theora_state *th,yuv_buffer *yuv){
PB_INSTANCE *pbi=(PB_INSTANCE *)(th->internal);
- yuv->y_width = pbi->Configuration.VideoFrameWidth;
- yuv->y_height = pbi->Configuration.VideoFrameHeight;
- yuv->y_stride = pbi->Configuration.YStride;
-
- yuv->uv_width = pbi->Configuration.VideoFrameWidth / 2;
- yuv->uv_height = pbi->Configuration.VideoFrameHeight / 2;
- yuv->uv_stride = pbi->Configuration.UVStride;
+ yuv->y_width = pbi->info.width;
+ yuv->y_height = pbi->info.height;
+ yuv->y_stride = pbi->YStride;
+
+ yuv->uv_width = pbi->info.width / 2;
+ yuv->uv_height = pbi->info.height / 2;
+ yuv->uv_stride = pbi->UVStride;
if(pbi->PostProcessingLevel){
yuv->y = &pbi->PostProcessBuffer[pbi->ReconYDataOffset];
@@ -1227,3 +1213,19 @@
return 0;
}
+/* returns, in seconds, absolute time of current packet in given
+ logical stream */
+double theora_packet_time(theora_state *th,ogg_packet *op){
+ PB_INSTANCE *pbi=(PB_INSTANCE *)(th->internal);
+
+ if(op->granulepos>=0){
+ ogg_int64_t iframe=op->granulepos>>pbi->keyframe_granule_shift;
+ ogg_int64_t pframe=op->granulepos-(iframe<<pbi->keyframe_granule_shift);
+
+ return (iframe+pframe)*
+ ((double)pbi->info.fps_denominator/pbi->info.fps_numerator);
+
+ }
+
+ return(-1);
+}
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list