[xiph-cvs] cvs commit: theora/lib block_inline.h blockmap.c dct.c dct_decode.c dct_encode.c decode.c encode.c encoder_internal.h frarray.c frinit.c huffman.c idct.c mcomp.c misc_common.c pp.c quant.c quant_lookup.h reconstruct.c scan.c toplevel.c
Monty
xiphmont at xiph.org
Fri Sep 20 15:01:44 PDT 2002
xiphmont 02/09/20 18:01:44
Modified: lib block_inline.h blockmap.c dct.c dct_decode.c
dct_encode.c decode.c encode.c encoder_internal.h
frarray.c frinit.c huffman.c idct.c mcomp.c
misc_common.c pp.c quant.c quant_lookup.h
reconstruct.c scan.c toplevel.c
Log:
Prototype updates and corrections. Dead code elimination.
Revision Changes Path
1.2 +1 -44 theora/lib/block_inline.h
Index: block_inline.h
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/block_inline.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- block_inline.h 20 Sep 2002 09:30:31 -0000 1.1
+++ block_inline.h 20 Sep 2002 22:01:43 -0000 1.2
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: block_inline.h,v 1.1 2002/09/20 09:30:31 xiphmont Exp $
+ last mod: $Id: block_inline.h,v 1.2 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -23,53 +23,10 @@
{ 3, 2, 0, 1 }
};
-static ogg_int32_t BlockOrderMap2[4][4] =
-{ { 0, 1, 2, 3 },
- { 0, 1, 2, 3 },
- { 0, 1, 2, 3 },
- { 0, 1, 2, 3 }
-};
-
-/* The following hard wired tables and masks are used to decode block
- pattern tokens */
-static unsigned char BlockPatternMask[4] = {
- 0x08, 0x04, 0x02, 0x01 };
-
-static unsigned char BlockDecode1[2][8] = {
- { 0x01, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 },
- { 0x07, 0x0B, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00 } };
-
-static unsigned char BlockDecode2[2][16] = {
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00,
- 0x0A, 0x03, 0x0E, 0x07, 0x0D, 0x05, 0x0C, 0x02 },
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
- 0x05, 0x03, 0x02, 0x0C, 0x04, 0x0A, 0x08, 0x0D } };
-
-static unsigned char BlockDecode3[2][32] = {
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x09,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
-
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x09, 0x06, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, } };
-
-static ogg_uint32_t BPPredictor[15] = {
- 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1 };
-
-
static ogg_int32_t QuadMapToIndex1( ogg_int32_t (*BlockMap)[4][4],
ogg_uint32_t SB, ogg_uint32_t MB,
ogg_uint32_t B ){
return BlockMap[SB][MBOrderMap[MB]][BlockOrderMap1[MB][B]];
-}
-
-static ogg_int32_t QuadMapToIndex2( ogg_int32_t (*BlockMap)[4][4],
- ogg_uint32_t SB, ogg_uint32_t MB,
- ogg_uint32_t B ){
- return BlockMap[SB][MBOrderMap[MB]][BlockOrderMap2[MB][B]];
}
static ogg_int32_t QuadMapToMBTopLeft( ogg_int32_t (*BlockMap)[4][4],
<p><p>1.2 +6 -4 theora/lib/blockmap.c
Index: blockmap.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/blockmap.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- blockmap.c 20 Sep 2002 09:30:32 -0000 1.1
+++ blockmap.c 20 Sep 2002 22:01:43 -0000 1.2
@@ -11,15 +11,17 @@
********************************************************************
function:
- last mod: $Id: blockmap.c,v 1.1 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: blockmap.c,v 1.2 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
#include <ogg/ogg.h>
+#include "encoder_internal.h"
-void CreateMapping ( ogg_int32_t (*BlockMap)[4][4], ogg_uint32_t FirstSB,
- ogg_uint32_t FirstFrag, ogg_uint32_t HFrags,
- ogg_uint32_t VFrags ){
+static void CreateMapping ( ogg_int32_t (*BlockMap)[4][4],
+ ogg_uint32_t FirstSB,
+ ogg_uint32_t FirstFrag, ogg_uint32_t HFrags,
+ ogg_uint32_t VFrags ){
ogg_uint32_t i, j;
ogg_uint32_t xpos;
ogg_uint32_t ypos;
<p><p>1.2 +1 -8 theora/lib/dct.c
Index: dct.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/dct.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dct.c 20 Sep 2002 09:30:32 -0000 1.1
+++ dct.c 20 Sep 2002 22:01:43 -0000 1.2
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: dct.c,v 1.1 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: dct.c,v 1.2 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -25,13 +25,6 @@
static ogg_int32_t xC5S3 = 36410;
static ogg_int32_t xC6S2 = 25080;
static ogg_int32_t xC7S1 = 12785;
-
-static ogg_int32_t xSUM17=77062;
-static ogg_int32_t xDIF17=51492;
-static ogg_int32_t xSUM35=90901;
-static ogg_int32_t xDIF35=18081;
-static ogg_int32_t xSUM26=85637;
-static ogg_int32_t xDIF26=35467;
#define SIGNBITDUPPED(X) ((signed )(((X) & 0x80000000)) >> 31)
#define DOROUND(X) ( (SIGNBITDUPPED(X) & (0xffff)) + (X) )
<p><p>1.2 +47 -48 theora/lib/dct_decode.c
Index: dct_decode.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/dct_decode.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dct_decode.c 20 Sep 2002 09:30:32 -0000 1.1
+++ dct_decode.c 20 Sep 2002 22:01:43 -0000 1.2
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: dct_decode.c,v 1.1 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: dct_decode.c,v 1.2 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -50,7 +50,7 @@
static int ModeUsesMC[MAX_MODES] = { 0, 0, 1, 1, 1, 0, 1, 1 };
-ogg_int32_t *SetupBoundingValueArray_Generic(PB_INSTANCE *pbi,
+static ogg_int32_t *SetupBoundingValueArray_Generic(PB_INSTANCE *pbi,
ogg_int32_t FLimit){
ogg_int32_t * BoundingValuePtr;
ogg_int32_t i;
@@ -91,7 +91,7 @@
}
}
-void ExpandKFBlock ( PB_INSTANCE *pbi, ogg_int32_t FragmentNumber ){
+static void ExpandKFBlock ( PB_INSTANCE *pbi, ogg_int32_t FragmentNumber ){
ogg_uint32_t ReconPixelsPerLine;
ogg_int32_t ReconPixelIndex;
@@ -128,7 +128,7 @@
}
-void ExpandBlock ( PB_INSTANCE *pbi, ogg_int32_t FragmentNumber ){
+static void ExpandBlock ( PB_INSTANCE *pbi, ogg_int32_t FragmentNumber ){
unsigned char *LastFrameRecPtr; /* Pointer into previous frame
reconstruction. */
unsigned char *LastFrameRecPtr2; /* Pointer into previous frame
@@ -276,8 +276,9 @@
}
}
-void UpdateUMV_HBorders( PB_INSTANCE *pbi, unsigned char * DestReconPtr,
- ogg_uint32_t PlaneFragOffset ) {
+static void UpdateUMV_HBorders( PB_INSTANCE *pbi,
+ unsigned char * DestReconPtr,
+ ogg_uint32_t PlaneFragOffset ) {
ogg_uint32_t i;
ogg_uint32_t PixelIndex;
@@ -333,8 +334,9 @@
}
}
-void UpdateUMV_VBorders( PB_INSTANCE *pbi, unsigned char * DestReconPtr,
- ogg_uint32_t PlaneFragOffset ){
+static void UpdateUMV_VBorders( PB_INSTANCE *pbi,
+ unsigned char * DestReconPtr,
+ ogg_uint32_t PlaneFragOffset ){
ogg_uint32_t i;
ogg_uint32_t PixelIndex;
@@ -387,7 +389,8 @@
}
}
-void UpdateUMVBorder( PB_INSTANCE *pbi, unsigned char * DestReconPtr ) {
+void UpdateUMVBorder( PB_INSTANCE *pbi,
+ unsigned char * DestReconPtr ) {
ogg_uint32_t PlaneFragOffset;
/* Y plane */
@@ -405,7 +408,7 @@
UpdateUMV_HBorders( pbi, DestReconPtr, PlaneFragOffset );
}
-void CopyRecon( PB_INSTANCE *pbi, unsigned char * DestReconPtr,
+static void CopyRecon( PB_INSTANCE *pbi, unsigned char * DestReconPtr,
unsigned char * SrcReconPtr ) {
ogg_uint32_t i;
ogg_uint32_t PlaneLineStep; /* Pixels per line */
@@ -446,7 +449,7 @@
}
-void CopyNotRecon( PB_INSTANCE *pbi, unsigned char * DestReconPtr,
+static void CopyNotRecon( PB_INSTANCE *pbi, unsigned char * DestReconPtr,
unsigned char * SrcReconPtr ) {
ogg_uint32_t i;
ogg_uint32_t PlaneLineStep; /* Pixels per line */
@@ -487,7 +490,7 @@
}
-void ExpandToken( PB_INSTANCE *pbi, Q_LIST_ENTRY * ExpandedBlock,
+void ExpandToken( Q_LIST_ENTRY * ExpandedBlock,
unsigned char * CoeffIndex, ogg_uint32_t Token,
ogg_int32_t ExtraBits ){
/* Is the token is a combination run and value token. */
@@ -645,9 +648,9 @@
}
}
-void FilterHoriz(PB_INSTANCE *pbi, unsigned char * PixelPtr,
- ogg_int32_t LineLength,
- ogg_int32_t *BoundingValuePtr){
+static void FilterHoriz(unsigned char * PixelPtr,
+ ogg_int32_t LineLength,
+ ogg_int32_t *BoundingValuePtr){
ogg_int32_t j;
ogg_int32_t FiltVal;
@@ -666,9 +669,9 @@
}
}
-void FilterVert(PB_INSTANCE *pbi, unsigned char * PixelPtr,
- ogg_int32_t LineLength,
- ogg_int32_t *BoundingValuePtr){
+static void FilterVert(unsigned char * PixelPtr,
+ ogg_int32_t LineLength,
+ ogg_int32_t *BoundingValuePtr){
ogg_int32_t j;
ogg_int32_t FiltVal;
@@ -696,15 +699,12 @@
void LoopFilter(PB_INSTANCE *pbi){
ogg_int32_t i;
- unsigned long uvHFragments = pbi->HFragments >> 1;
ogg_int32_t * BoundingValuePtr;
int FragsAcross=pbi->HFragments;
int FromFragment,ToFragment;
int FragsDown = pbi->VFragments;
ogg_int32_t LineFragments;
ogg_int32_t LineLength;
- unsigned char BlockHeight = (unsigned char)pbi->Configuration.VFragPixels;
- unsigned char BlockWidth = (unsigned char)pbi->Configuration.HFragPixels;
ogg_int32_t FLimit;
int QIndex;
int j,m,n;
@@ -767,14 +767,14 @@
/* Filter right hand border only if the block to the right is
not coded */
if ( !pbi->display_fragments[ i + 1 ] ){
- FilterHoriz(pbi, pbi->LastFrameRecon+
+ FilterHoriz(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i]+6,
LineLength, BoundingValuePtr);
}
/* Bottom done if next row set */
if( !pbi->display_fragments[ i + LineFragments] ){
- FilterVert(pbi, pbi->LastFrameRecon+
+ FilterVert(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i+LineFragments],
LineLength, BoundingValuePtr);
}
@@ -786,21 +786,21 @@
for ( n = 1 ; n < FragsAcross - 1 ; n++, i++) {
if( pbi->display_fragments[i]){
/* Filter Left edge always */
- FilterHoriz(pbi, pbi->LastFrameRecon+
+ FilterHoriz(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i]-2,
LineLength, BoundingValuePtr);
/* Filter right hand border only if the block to the right is
not coded */
if ( !pbi->display_fragments[ i + 1 ] ){
- FilterHoriz(pbi, pbi->LastFrameRecon+
+ FilterHoriz(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i]+6,
LineLength, BoundingValuePtr);
}
/* Bottom done if next row set */
if( !pbi->display_fragments[ i + LineFragments] ){
- FilterVert(pbi, pbi->LastFrameRecon+
+ FilterVert(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i + LineFragments],
LineLength, BoundingValuePtr);
}
@@ -812,13 +812,13 @@
/* Last Column */
if( pbi->display_fragments[i]){
/* Filter Left edge always */
- FilterHoriz(pbi, pbi->LastFrameRecon+
+ FilterHoriz(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i] - 2 ,
LineLength, BoundingValuePtr);
/* Bottom done if next row set */
if( !pbi->display_fragments[ i + LineFragments] ){
- FilterVert(pbi, pbi->LastFrameRecon+
+ FilterVert(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i + LineFragments],
LineLength, BoundingValuePtr);
}
@@ -836,21 +836,21 @@
all fragments are intra */
if( pbi->display_fragments[i]){
/* TopRow is always done */
- FilterVert(pbi, pbi->LastFrameRecon+
+ FilterVert(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i],
LineLength, BoundingValuePtr);
/* Filter right hand border only if the block to the right is
not coded */
if ( !pbi->display_fragments[ i + 1 ] ){
- FilterHoriz(pbi, pbi->LastFrameRecon+
+ FilterHoriz(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i] + 6,
LineLength, BoundingValuePtr);
}
/* Bottom done if next row set */
if( !pbi->display_fragments[ i + LineFragments] ){
- FilterVert(pbi, pbi->LastFrameRecon+
+ FilterVert(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i + LineFragments],
LineLength, BoundingValuePtr);
}
@@ -862,26 +862,26 @@
for ( n = 1 ; n < FragsAcross - 1 ; n++, i++){
if( pbi->display_fragments[i]){
/* Filter Left edge always */
- FilterHoriz(pbi, pbi->LastFrameRecon+
+ FilterHoriz(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i] - 2,
LineLength, BoundingValuePtr);
/* TopRow is always done */
- FilterVert(pbi, pbi->LastFrameRecon+
+ FilterVert(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i],
LineLength, BoundingValuePtr);
/* Filter right hand border only if the block to the right
is not coded */
if ( !pbi->display_fragments[ i + 1 ] ){
- FilterHoriz(pbi, pbi->LastFrameRecon+
+ FilterHoriz(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i] + 6,
LineLength, BoundingValuePtr);
}
/* Bottom done if next row set */
if( !pbi->display_fragments[ i + LineFragments] ){
- FilterVert(pbi, pbi->LastFrameRecon+
+ FilterVert(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i + LineFragments],
LineLength, BoundingValuePtr);
}
@@ -892,18 +892,18 @@
/* Last Column */
if( pbi->display_fragments[i]){
/* Filter Left edge always*/
- FilterHoriz(pbi, pbi->LastFrameRecon+
+ FilterHoriz(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i] - 2,
LineLength, BoundingValuePtr);
/* TopRow is always done */
- FilterVert(pbi, pbi->LastFrameRecon+
+ FilterVert(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i],
LineLength, BoundingValuePtr);
/* Bottom done if next row set */
if( !pbi->display_fragments[ i + LineFragments] ){
- FilterVert(pbi, pbi->LastFrameRecon+
+ FilterVert(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i + LineFragments],
LineLength, BoundingValuePtr);
}
@@ -921,14 +921,14 @@
if( pbi->display_fragments[i]){
/* TopRow is always done */
- FilterVert(pbi, pbi->LastFrameRecon+
+ FilterVert(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i],
LineLength, BoundingValuePtr);
/* Filter right hand border only if the block to the right is
not coded */
if ( !pbi->display_fragments[ i + 1 ] ){
- FilterHoriz(pbi, pbi->LastFrameRecon+
+ FilterHoriz(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i] + 6,
LineLength, BoundingValuePtr);
}
@@ -940,19 +940,19 @@
for ( n = 1 ; n < FragsAcross - 1 ; n++, i++){
if( pbi->display_fragments[i]){
/* Filter Left edge always */
- FilterHoriz(pbi, pbi->LastFrameRecon+
+ FilterHoriz(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i] - 2,
LineLength, BoundingValuePtr);
/* TopRow is always done */
- FilterVert(pbi, pbi->LastFrameRecon+
+ FilterVert(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i],
LineLength, BoundingValuePtr);
/* Filter right hand border only if the block to the right is
not coded */
if ( !pbi->display_fragments[ i + 1 ] ){
- FilterHoriz(pbi, pbi->LastFrameRecon+
+ FilterHoriz(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i] + 6,
LineLength, BoundingValuePtr);
}
@@ -963,12 +963,12 @@
/* Last Column */
if( pbi->display_fragments[i]){
/* Filter Left edge always */
- FilterHoriz(pbi, pbi->LastFrameRecon+
+ FilterHoriz(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i] - 2,
LineLength, BoundingValuePtr);
/* TopRow is always done */
- FilterVert(pbi, pbi->LastFrameRecon+
+ FilterVert(pbi->LastFrameRecon+
pbi->recon_pixel_index_table[i],
LineLength, BoundingValuePtr);
@@ -982,8 +982,6 @@
ogg_int32_t FragIndex;
unsigned char *SwapReconBuffersTemp;
- unsigned long uvHFragments = pbi->HFragments >> 1;
-
short pc[16][6]={
{0,0,0,0,0,0},
{0,0,0,1,0,0},
@@ -1073,7 +1071,8 @@
/* only do 2 prediction if fragment coded and on non intra or
if all fragments are intra */
if( pbi->display_fragments[i] || (GetFrameType(pbi) == BASE_FRAME) ){
- /* Type of Fragment */ WhichFrame = Mode2Frame[pbi->FragCodingMethod[i]];
+ /* Type of Fragment */
+ WhichFrame = Mode2Frame[pbi->FragCodingMethod[i]];
/* Check Borderline Cases */
WhichCase = (n==0) + ((m==0) << 1) + ((n+1 == FragsAcross) << 2);
<p><p>1.4 +24 -33 theora/lib/dct_encode.c
Index: dct_encode.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/dct_encode.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- dct_encode.c 20 Sep 2002 09:30:32 -0000 1.3
+++ dct_encode.c 20 Sep 2002 22:01:43 -0000 1.4
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: dct_encode.c,v 1.3 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: dct_encode.c,v 1.4 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -19,10 +19,10 @@
static int ModeUsesMC[MAX_MODES] = { 0, 0, 1, 1, 1, 0, 1, 1 };
-void Sub8 (unsigned char *FiltPtr, unsigned char *ReconPtr,
- ogg_int16_t *DctInputPtr, unsigned char *old_ptr1,
- unsigned char *new_ptr1, ogg_uint32_t PixelsPerLine,
- ogg_uint32_t ReconPixelsPerLine ) {
+static void Sub8 (unsigned char *FiltPtr, unsigned char *ReconPtr,
+ ogg_int16_t *DctInputPtr, unsigned char *old_ptr1,
+ unsigned char *new_ptr1, ogg_uint32_t PixelsPerLine,
+ ogg_uint32_t ReconPixelsPerLine ) {
int i;
/* For each block row */
@@ -49,9 +49,9 @@
}
}
-void Sub8_128 (unsigned char *FiltPtr, ogg_int16_t *DctInputPtr,
- unsigned char *old_ptr1, unsigned char *new_ptr1,
- ogg_uint32_t PixelsPerLine ) {
+static void Sub8_128 (unsigned char *FiltPtr, ogg_int16_t *DctInputPtr,
+ unsigned char *old_ptr1, unsigned char *new_ptr1,
+ ogg_uint32_t PixelsPerLine ) {
int i;
/* For each block row */
for ( i=0; i<BLOCK_HEIGHT_WIDTH; i++ ){
@@ -80,10 +80,11 @@
}
}
-void Sub8Av2 (unsigned char *FiltPtr, unsigned char *ReconPtr1,
- unsigned char *ReconPtr2, ogg_int16_t *DctInputPtr,
- unsigned char *old_ptr1, unsigned char *new_ptr1,
- ogg_uint32_t PixelsPerLine, ogg_uint32_t ReconPixelsPerLine ) {
+static void Sub8Av2 (unsigned char *FiltPtr, unsigned char *ReconPtr1,
+ unsigned char *ReconPtr2, ogg_int16_t *DctInputPtr,
+ unsigned char *old_ptr1, unsigned char *new_ptr1,
+ ogg_uint32_t PixelsPerLine,
+ ogg_uint32_t ReconPixelsPerLine ) {
int i;
/* For each block row */
@@ -119,8 +120,8 @@
}
}
-unsigned char TokenizeDctValue (ogg_int16_t DataValue,
- ogg_uint32_t * TokenListPtr ){
+static unsigned char TokenizeDctValue (ogg_int16_t DataValue,
+ ogg_uint32_t * TokenListPtr ){
unsigned char tokens_added = 0;
ogg_uint32_t AbsDataVal = abs( (ogg_int32_t)DataValue );
@@ -209,9 +210,9 @@
return tokens_added;
}
-unsigned char TokenizeDctRunValue (unsigned char RunLength,
- ogg_int16_t DataValue,
- ogg_uint32_t * TokenListPtr ){
+static unsigned char TokenizeDctRunValue (unsigned char RunLength,
+ ogg_int16_t DataValue,
+ ogg_uint32_t * TokenListPtr ){
unsigned char tokens_added = 0;
ogg_uint32_t AbsDataVal = abs( (ogg_int32_t)DataValue );
@@ -273,8 +274,8 @@
return tokens_added;
}
-unsigned char TokenizeDctBlock (ogg_int16_t * RawData,
- ogg_uint32_t * TokenListPtr ) {
+static unsigned char TokenizeDctBlock (ogg_int16_t * RawData,
+ ogg_uint32_t * TokenListPtr ) {
ogg_uint32_t i;
unsigned char run_count;
unsigned char token_count = 0; /* Number of tokens crated. */
@@ -341,11 +342,9 @@
return token_count;
}
-ogg_uint32_t DPCMTokenizeBlock (CP_INSTANCE *cpi, ogg_int32_t FragIndex,
- ogg_uint32_t PixelsPerLine ) {
+ogg_uint32_t DPCMTokenizeBlock (CP_INSTANCE *cpi,
+ ogg_int32_t FragIndex){
ogg_uint32_t token_count;
- Q_LIST_ENTRY TempLastDC = 0;
-
if ( GetFrameType(&cpi->pb) == BASE_FRAME ){
/* Key frame so code block in INTRA mode. */
@@ -366,7 +365,7 @@
return BLOCK_SIZE;
}
-int AllZeroDctData( Q_LIST_ENTRY * QuantList ){
+static int AllZeroDctData( Q_LIST_ENTRY * QuantList ){
ogg_uint32_t i;
for ( i = 0; i < 64; i ++ )
@@ -376,7 +375,7 @@
return 1;
}
-void MotionBlockDifference (CP_INSTANCE * cpi, unsigned char * FiltPtr,
+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,
@@ -384,7 +383,6 @@
ogg_int32_t MvShift;
ogg_int32_t MvModMask;
- ogg_uint32_t ReconPixelIndex = cpi->pb.recon_pixel_index_table[FragIndex];
ogg_int32_t AbsRefOffset;
ogg_int32_t AbsXOffset;
ogg_int32_t AbsYOffset;
@@ -471,13 +469,6 @@
int LeftEdge; /* Flag if block at left edge of component */
ogg_uint32_t ReconPixelsPerLine; /* Line length for recon buffers. */
- Q_LIST_ENTRY TempLastDC = 0;
- double GF_Error = 0.0;
- double InterNMV_Error = 0.0;
- double IntraScore = 0.0;
- double BestInterError = 0.0; /* Measure of the best error score
- available by application of a
- limited motion vector. */
unsigned char *ReconPtr1; /* DCT reconstructed image pointers */
ogg_int32_t MvDevisor; /* Defines MV resolution (2 = 1/2
pixel for Y or 4 = 1/4 for UV) */
<p><p>1.2 +14 -21 theora/lib/decode.c
Index: decode.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/decode.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- decode.c 20 Sep 2002 09:30:32 -0000 1.1
+++ decode.c 20 Sep 2002 22:01:43 -0000 1.2
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: decode.c,v 1.1 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: decode.c,v 1.2 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -22,26 +22,7 @@
return pbi->FrameType;
}
-int PbBuildBitmapHeader( PB_INSTANCE *pbi,
- ogg_uint32_t ImageWidth,
- ogg_uint32_t ImageHeight ){
- if(!InitFrameDetails(pbi))return 0;
- return 1;
-}
-
-int LoadFrame(PB_INSTANCE *pbi){
-
- /* Load the frame header (including the frame size). */
- if ( LoadFrameHeader(pbi) ){
- /* Read in the updated block map */
- QuadDecodeDisplayFragments( pbi );
- return 1;
- }
-
- return 0;
-}
-
-int LoadFrameHeader(PB_INSTANCE *pbi){
+static int LoadFrameHeader(PB_INSTANCE *pbi){
unsigned char VersionByte0; /* Must be 0 for VP30b and later */
unsigned char DctQMask;
unsigned char SpareBits; /* Spare cfg bits */
@@ -97,5 +78,17 @@
pbi->FrameType = FrType;
break;
}
+}
+
+int LoadFrame(PB_INSTANCE *pbi){
+
+ /* Load the frame header (including the frame size). */
+ if ( LoadFrameHeader(pbi) ){
+ /* Read in the updated block map */
+ QuadDecodeDisplayFragments( pbi );
+ return 1;
+ }
+
+ return 0;
}
<p><p>1.5 +21 -63 theora/lib/encode.c
Index: encode.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/encode.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- encode.c 20 Sep 2002 09:30:32 -0000 1.4
+++ encode.c 20 Sep 2002 22:01:43 -0000 1.5
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: encode.c,v 1.4 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: encode.c,v 1.5 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -26,12 +26,10 @@
#define PL 1
#define HIGHBITDUPPED(X) (((ogg_int16_t) X) >> 15)
-ogg_uint32_t QuadCodeComponent ( CP_INSTANCE *cpi,
+static ogg_uint32_t QuadCodeComponent ( CP_INSTANCE *cpi,
ogg_uint32_t FirstSB,
ogg_uint32_t SBRows,
ogg_uint32_t SBCols,
- ogg_uint32_t HExtra,
- ogg_uint32_t VExtra,
ogg_uint32_t PixelsPerLine ){
ogg_int32_t FragIndex; /* Fragment number */
@@ -103,7 +101,7 @@
return coded_pixels;
}
-void EncodeDcTokenList (CP_INSTANCE *cpi) {
+static void EncodeDcTokenList (CP_INSTANCE *cpi) {
ogg_int32_t i,j;
ogg_uint32_t Token;
ogg_uint32_t ExtraBitsToken;
@@ -186,7 +184,7 @@
cpi->OptimisedTokenCount = 0;
}
-void EncodeAcTokenList (CP_INSTANCE *cpi) {
+static void EncodeAcTokenList (CP_INSTANCE *cpi) {
ogg_int32_t i,j;
ogg_uint32_t Token;
ogg_uint32_t ExtraBitsToken;
@@ -266,7 +264,7 @@
cpi->OptimisedTokenCount = 0;
}
-void PackModes (CP_INSTANCE *cpi) {
+static void PackModes (CP_INSTANCE *cpi) {
ogg_uint32_t i,j;
unsigned char ModeIndex;
@@ -353,13 +351,11 @@
}
}
-void PackMotionVectors (CP_INSTANCE *cpi) {
+static void PackMotionVectors (CP_INSTANCE *cpi) {
ogg_int32_t i;
ogg_uint32_t MethodBits[2] = {0,0};
ogg_uint32_t * MvBitsPtr;
ogg_uint32_t * MvPatternPtr;
- ogg_int32_t LastXMVComponent = 0;
- ogg_int32_t LastYMVComponent = 0;
oggpack_buffer *opb=&cpi->oggbuffer;
@@ -392,7 +388,7 @@
}
}
-void PackEOBRun( CP_INSTANCE *cpi) {
+static void PackEOBRun( CP_INSTANCE *cpi) {
if(cpi->RunLength == 0)
return;
@@ -455,7 +451,7 @@
cpi->RunLength = 0;
}
-void PackToken ( CP_INSTANCE *cpi, ogg_int32_t FragmentNumber,
+static void PackToken ( CP_INSTANCE *cpi, ogg_int32_t FragmentNumber,
ogg_uint32_t HuffIndex ) {
ogg_uint32_t Token =
cpi->pb.TokenList[FragmentNumber][cpi->FragTokens[FragmentNumber]];
@@ -470,8 +466,9 @@
if ( Token == DCT_EOB_TOKEN )
cpi->pb.FragCoeffs[FragmentNumber] = BLOCK_SIZE;
else
- ExpandToken( &cpi->pb, cpi->pb.QFragData[FragmentNumber],
- &cpi->pb.FragCoeffs[FragmentNumber], Token, ExtraBitsToken );
+ ExpandToken( cpi->pb.QFragData[FragmentNumber],
+ &cpi->pb.FragCoeffs[FragmentNumber],
+ Token, ExtraBitsToken );
/* Update record of tokens coded and where we are in this fragment. */
/* Is there an extra bits token */
@@ -516,7 +513,7 @@
}
}
-ogg_uint32_t GetBlockReconErrorSlow( CP_INSTANCE *cpi,
+static ogg_uint32_t GetBlockReconErrorSlow( CP_INSTANCE *cpi,
ogg_int32_t BlockIndex ) {
ogg_uint32_t i;
ogg_uint32_t ErrorVal = 0;
@@ -555,10 +552,9 @@
return ErrorVal;
}
-void PackCodedVideo (CP_INSTANCE *cpi) {
+static void PackCodedVideo (CP_INSTANCE *cpi) {
ogg_int32_t i;
ogg_int32_t EncodedCoeffs = 1;
- ogg_int32_t TotalTokens = cpi->TotTokenCount;
ogg_int32_t FragIndex;
ogg_uint32_t HuffIndex; /* Index to group of tables used to code a token */
@@ -655,7 +651,7 @@
}
-ogg_uint32_t QuadCodeDisplayFragments (CP_INSTANCE *cpi) {
+static ogg_uint32_t QuadCodeDisplayFragments (CP_INSTANCE *cpi) {
ogg_int32_t i,j;
ogg_uint32_t coded_pixels=0;
int QIndex;
@@ -706,7 +702,6 @@
/* last used inter predictor (Raster Order) */
ogg_int16_t Last[3]; /* last value used for given frame */
- ogg_int16_t TempInter = 0;
int FragsAcross=cpi->pb.HFragments;
int FragsDown = cpi->pb.VFragments;
@@ -745,20 +740,14 @@
/* Encode and tokenise the Y, U and V components */
coded_pixels = QuadCodeComponent(cpi, 0, cpi->pb.YSBRows, cpi->pb.YSBCols,
- cpi->pb.HFragments%4,
- cpi->pb.VFragments%4,
cpi->pb.Configuration.VideoFrameWidth );
coded_pixels += QuadCodeComponent(cpi, cpi->pb.YSuperBlocks,
cpi->pb.UVSBRows,
cpi->pb.UVSBCols,
- (cpi->pb.HFragments/2)%4,
- (cpi->pb.VFragments/2)%4,
cpi->pb.Configuration.VideoFrameWidth>>1 );
coded_pixels += QuadCodeComponent(cpi,
cpi->pb.YSuperBlocks+cpi->pb.UVSuperBlocks,
cpi->pb.UVSBRows, cpi->pb.UVSBCols,
- (cpi->pb.HFragments/2)%4,
- (cpi->pb.VFragments/2)%4,
cpi->pb.Configuration.VideoFrameWidth>>1 );
/* for y,u,v */
@@ -976,8 +965,7 @@
for ( i = 0; i < cpi->pb.CodedBlockIndex; i++ ) {
/* Get the linear index for the current coded fragment. */
FragIndex = cpi->pb.CodedBlockList[i];
- coded_pixels += DPCMTokenizeBlock ( cpi, FragIndex,
- cpi->pb.Configuration.VideoFrameWidth);
+ coded_pixels += DPCMTokenizeBlock ( cpi, FragIndex);
}
@@ -1025,38 +1013,9 @@
}
-ogg_int32_t CalculateMotionErrorforFragments(CP_INSTANCE *cpi,
- ogg_int32_t CountUsingMV,
- ogg_int32_t *FragsUsing,
- MOTION_VECTOR MVect,
- ogg_int32_t PixelsPerLine){
- int i;
- ogg_int32_t NewError = 0;
-
- /* for now 4 motion vector is to hard to recalculate so return huge
- error!! */
- if( cpi->pb.FragCodingMethod[0] == CODE_INTER_FOURMV)
- return HUGE_ERROR;
-
- for(i = 0 ; i < CountUsingMV ; i++) {
- ogg_int32_t FragIndex = FragsUsing[i];
- ogg_int32_t ThisError = GetMBInterError( cpi,
- cpi->ConvDestBuffer,
- cpi->pb.LastFrameRecon,
- FragIndex, MVect.x,
- MVect.y, PixelsPerLine );
-
- NewError += ThisError;
-
- }
-
- return NewError;
-
-}
-
-ogg_uint32_t PickIntra( CP_INSTANCE *cpi, ogg_uint32_t SBRows,
- ogg_uint32_t SBCols, ogg_uint32_t HExtra,
- ogg_uint32_t VExtra, ogg_uint32_t PixelsPerLine){
+ogg_uint32_t PickIntra( CP_INSTANCE *cpi,
+ ogg_uint32_t SBRows,
+ ogg_uint32_t SBCols){
ogg_int32_t FragIndex; /* Fragment number */
ogg_uint32_t MB, B; /* Macro-Block, Block indices */
@@ -1108,14 +1067,14 @@
return 0;
}
-void AddMotionVector(CP_INSTANCE *cpi,
+static void AddMotionVector(CP_INSTANCE *cpi,
MOTION_VECTOR *ThisMotionVector) {
cpi->MVList[cpi->MvListCount].x = ThisMotionVector->x;
cpi->MVList[cpi->MvListCount].y = ThisMotionVector->y;
cpi->MvListCount++;
}
-void SetFragMotionVectorAndMode(CP_INSTANCE *cpi,
+static void SetFragMotionVectorAndMode(CP_INSTANCE *cpi,
ogg_int32_t FragIndex,
MOTION_VECTOR *ThisMotionVector){
/* Note the coding mode and vector for each block */
@@ -1124,7 +1083,7 @@
cpi->pb.FragCodingMethod[FragIndex] = cpi->MBCodingMode;
}
-void SetMBMotionVectorsAndMode(CP_INSTANCE *cpi,
+static void SetMBMotionVectorsAndMode(CP_INSTANCE *cpi,
ogg_int32_t YFragIndex,
ogg_int32_t UFragIndex,
ogg_int32_t VFragIndex,
@@ -1141,7 +1100,6 @@
ogg_uint32_t PickModes(CP_INSTANCE *cpi,
ogg_uint32_t SBRows, ogg_uint32_t SBCols,
- ogg_uint32_t HExtra, ogg_uint32_t VExtra,
ogg_uint32_t PixelsPerLine,
ogg_uint32_t *InterError, ogg_uint32_t *IntraError) {
ogg_int32_t YFragIndex;
<p><p>1.5 +128 -1 theora/lib/encoder_internal.h
Index: encoder_internal.h
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/encoder_internal.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- encoder_internal.h 20 Sep 2002 09:30:32 -0000 1.4
+++ encoder_internal.h 20 Sep 2002 22:01:43 -0000 1.5
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: encoder_internal.h,v 1.4 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: encoder_internal.h,v 1.5 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -685,8 +685,135 @@
/*#define clamp255(x) (((ogg_int32_t)(x)&~0xff)?((ogg_int32_t)(x))>>31:(x))*/
#define clamp255(val) ( val<0 ? 0: ( val>255 ? 255:val ) )
+extern void ConfigurePP( PP_INSTANCE *ppi, int Level ) ;
+extern ogg_uint32_t YUVAnalyseFrame( PP_INSTANCE *ppi,
+ ogg_uint32_t * KFIndicator );
+
extern void ClearPPInstance(PP_INSTANCE *ppi);
extern void InitPPInstance(PP_INSTANCE *ppi);
extern int GetFrameType(PB_INSTANCE *pbi);
+
+
+extern void IDctSlow( Q_LIST_ENTRY * InputData,
+ ogg_int16_t *QuantMatrix,
+ ogg_int16_t * OutputData ) ;
+
+extern void IDct10( Q_LIST_ENTRY * InputData,
+ ogg_int16_t *QuantMatrix,
+ ogg_int16_t * OutputData );
+
+extern void IDct1( Q_LIST_ENTRY * InputData,
+ ogg_int16_t *QuantMatrix,
+ ogg_int16_t * OutputData );
+
+extern void ReconIntra( PB_INSTANCE *pbi, unsigned char * ReconPtr,
+ ogg_uint16_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 SetupLoopFilter(PB_INSTANCE *pbi);
+extern void CopyBlock(unsigned char *src,
+ unsigned char *dest,
+ unsigned int srcstride);
+extern void LoopFilter(PB_INSTANCE *pbi);
+extern void ReconRefFrames (PB_INSTANCE *pbi);
+extern void ExpandToken( Q_LIST_ENTRY * ExpandedBlock,
+ unsigned char * CoeffIndex, ogg_uint32_t Token,
+ ogg_int32_t ExtraBits );
+extern void ClearDownQFragData(PB_INSTANCE *pbi);
+extern void select_Y_quantiser ( PB_INSTANCE *pbi );
+extern void select_Inter_quantiser ( PB_INSTANCE *pbi );
+extern void select_UV_quantiser ( PB_INSTANCE *pbi );
+extern void select_InterUV_quantiser ( PB_INSTANCE *pbi );
+extern void quantize( PB_INSTANCE *pbi,
+ ogg_int16_t * DCT_block,
+ Q_LIST_ENTRY * quantized_list);
+extern void UpdateQ( PB_INSTANCE *pbi, ogg_uint32_t NewQ );
+extern void UpdateQC( CP_INSTANCE *cpi, ogg_uint32_t NewQ );
+extern void fdct_short ( ogg_int16_t * InputData, ogg_int16_t * OutputData );
+extern ogg_uint32_t DPCMTokenizeBlock (CP_INSTANCE *cpi,
+ ogg_int32_t FragIndex);
+extern void TransformQuantizeBlock (CP_INSTANCE *cpi, ogg_int32_t FragIndex,
+ ogg_uint32_t PixelsPerLine ) ;
+extern void ClearFragmentInfo(PB_INSTANCE * pbi);
+extern void InitFragmentInfo(PB_INSTANCE * pbi);
+extern void ClearFrameInfo(PB_INSTANCE * pbi);
+extern void InitFrameInfo(PB_INSTANCE * pbi, unsigned int FrameSize);
+extern void InitializeFragCoordinates(PB_INSTANCE *pbi);
+extern void InitFrameDetails(PB_INSTANCE *pbi);
+extern void InitQTables( PB_INSTANCE *pbi );
+extern void InitHuffmanSet( PB_INSTANCE *pbi );
+extern void ClearHuffmanSet( PB_INSTANCE *pbi );
+extern void QuadDecodeDisplayFragments ( PB_INSTANCE *pbi );
+extern void PackAndWriteDFArray( CP_INSTANCE *cpi );
+extern void UpdateFragQIndex(PB_INSTANCE *pbi);
+extern void PostProcess(PB_INSTANCE *pbi);
+extern void InitMotionCompensation ( CP_INSTANCE *cpi );
+extern ogg_uint32_t GetMBIntraError (CP_INSTANCE *cpi, ogg_uint32_t FragIndex,
+ ogg_uint32_t PixelsPerLine ) ;
+extern ogg_uint32_t GetMBInterError (CP_INSTANCE *cpi,
+ unsigned char * SrcPtr,
+ unsigned char * RefPtr,
+ ogg_uint32_t FragIndex,
+ ogg_int32_t LastXMV,
+ ogg_int32_t LastYMV,
+ ogg_uint32_t PixelsPerLine ) ;
+extern void WriteFrameHeader( CP_INSTANCE *cpi) ;
+extern ogg_uint32_t GetMBMVInterError (CP_INSTANCE *cpi,
+ unsigned char * RefFramePtr,
+ ogg_uint32_t FragIndex,
+ ogg_uint32_t PixelsPerLine,
+ ogg_int32_t *MVPixelOffset,
+ MOTION_VECTOR *MV );
+extern ogg_uint32_t GetMBMVExhaustiveSearch (CP_INSTANCE *cpi,
+ unsigned char * RefFramePtr,
+ ogg_uint32_t FragIndex,
+ ogg_uint32_t PixelsPerLine,
+ MOTION_VECTOR *MV );
+extern ogg_uint32_t GetFOURMVExhaustiveSearch (CP_INSTANCE *cpi,
+ unsigned char * RefFramePtr,
+ ogg_uint32_t FragIndex,
+ ogg_uint32_t PixelsPerLine,
+ MOTION_VECTOR *MV ) ;
+extern ogg_uint32_t EncodeData(CP_INSTANCE *cpi);
+extern ogg_uint32_t PickIntra( CP_INSTANCE *cpi,
+ ogg_uint32_t SBRows,
+ ogg_uint32_t SBCols);
+extern ogg_uint32_t PickModes(CP_INSTANCE *cpi,
+ ogg_uint32_t SBRows,
+ ogg_uint32_t SBCols,
+ ogg_uint32_t PixelsPerLine,
+ ogg_uint32_t *InterError,
+ ogg_uint32_t *IntraError) ;
+
+extern CODING_MODE FrArrayUnpackMode(PB_INSTANCE *pbi);
+extern void CreateBlockMapping ( ogg_int32_t (*BlockMap)[4][4],
+ ogg_uint32_t YSuperBlocks,
+ ogg_uint32_t UVSuperBlocks,
+ ogg_uint32_t HFrags, ogg_uint32_t VFrags );
+extern void UpRegulateDataStream (CP_INSTANCE *cpi, ogg_uint32_t RegulationQ,
+ ogg_int32_t RecoveryBlocks ) ;
+extern void RegulateQ( CP_INSTANCE *cpi, ogg_int32_t UpdateScore );
+extern void ConfigureQuality( CP_INSTANCE *cpi, ogg_uint32_t QualityValue ) ;
+extern void CopyBackExtraFrags(CP_INSTANCE *cpi);
+extern void UpdateUMVBorder( PB_INSTANCE *pbi,
+ unsigned char * DestReconPtr );
+extern void PInitFrameInfo(PP_INSTANCE * ppi);
+extern int GetFrameType(PB_INSTANCE *pbi);
+extern void SetFrameType( PB_INSTANCE *pbi,unsigned char FrType );
+extern int LoadFrame(PB_INSTANCE *pbi);
+extern double GetEstimatedBpb( CP_INSTANCE *cpi, ogg_uint32_t TargetQ );
+extern void ClearTmpBuffers(PB_INSTANCE * pbi);
+extern void InitTmpBuffers(PB_INSTANCE * pbi);
+extern void ScanYUVInit( PP_INSTANCE * ppi,
+ SCAN_CONFIG_DATA * ScanConfigPtr);
<p><p>1.4 +156 -332 theora/lib/frarray.c
Index: frarray.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/frarray.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- frarray.c 20 Sep 2002 09:30:32 -0000 1.3
+++ frarray.c 20 Sep 2002 22:01:43 -0000 1.4
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: frarray.c,v 1.3 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: frarray.c,v 1.4 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -19,7 +19,7 @@
#include "encoder_internal.h"
#include "block_inline.h"
-ogg_uint32_t FrArrayCodeSBRun( CP_INSTANCE *cpi, ogg_uint32_t value ){
+static ogg_uint32_t FrArrayCodeSBRun( CP_INSTANCE *cpi, ogg_uint32_t value ){
ogg_uint32_t CodedVal = 0;
ogg_uint32_t CodedBits = 0;
@@ -62,7 +62,8 @@
return CodedBits;
}
-ogg_uint32_t FrArrayCodeBlockRun( CP_INSTANCE *cpi, ogg_uint32_t value ) {
+static ogg_uint32_t FrArrayCodeBlockRun( CP_INSTANCE *cpi,
+ ogg_uint32_t value ) {
ogg_uint32_t CodedVal = 0;
ogg_uint32_t CodedBits = 0;
@@ -110,7 +111,6 @@
ogg_uint32_t run_count;
ogg_uint32_t SB, MB, B; /* Block, MB and SB loop variables */
- ogg_uint32_t LastSbMbIndex = 0;
ogg_uint32_t BListIndex = 0;
ogg_uint32_t LastSbBIndex = 0;
ogg_int32_t DfBlockIndex; /* Block index in display_fragments */
@@ -228,7 +228,155 @@
pbi->bits_so_far = 0;
}
-void GetNextBInit(PB_INSTANCE *pbi){
+static int FrArrayDeCodeBlockRun( PB_INSTANCE *pbi, ogg_uint32_t bit_value,
+ ogg_int32_t * run_value ){
+ int ret_val = 0;
+
+ /* Add in the new bit value. */
+ pbi->bits_so_far++;
+ pbi->bit_pattern = (pbi->bit_pattern << 1) + (bit_value & 1);
+
+ /* Coding scheme:
+ Codeword RunLength
+ 0x 1-2
+ 10x 3-4
+ 110x 5-6
+ 1110xx 7-10
+ 11110xx 11-14
+ 11111xxxx 15-30
+ */
+
+ switch ( pbi->bits_so_far ){
+ case 2:
+ /* If bit 1 is clear */
+ if ( !(pbi->bit_pattern & 0x0002) ){
+ ret_val = 1;
+ *run_value = (pbi->bit_pattern & 0x0001) + 1;
+ }
+ break;
+
+ case 3:
+ /* If bit 1 is clear */
+ if ( !(pbi->bit_pattern & 0x0002) ){
+ ret_val = 1;
+ *run_value = (pbi->bit_pattern & 0x0001) + 3;
+ }
+ break;
+
+ case 4:
+ /* If bit 1 is clear */
+ if ( !(pbi->bit_pattern & 0x0002) ){
+ ret_val = 1;
+ *run_value = (pbi->bit_pattern & 0x0001) + 5;
+ }
+ break;
+
+ case 6:
+ /* If bit 2 is clear */
+ if ( !(pbi->bit_pattern & 0x0004) ){
+ ret_val = 1;
+ *run_value = (pbi->bit_pattern & 0x0003) + 7;
+ }
+ break;
+
+ case 7:
+ /* If bit 2 is clear */
+ if ( !(pbi->bit_pattern & 0x0004) ){
+ ret_val = 1;
+ *run_value = (pbi->bit_pattern & 0x0003) + 11;
+ }
+ break;
+
+ case 9:
+ ret_val = 1;
+ *run_value = (pbi->bit_pattern & 0x000F) + 15;
+ break;
+ }
+
+ return ret_val;
+}
+
+static int FrArrayDeCodeSBRun (PB_INSTANCE *pbi, ogg_uint32_t bit_value,
+ ogg_int32_t * run_value ){
+ int ret_val = 0;
+
+ /* Add in the new bit value. */
+ pbi->bits_so_far++;
+ pbi->bit_pattern = (pbi->bit_pattern << 1) + (bit_value & 1);
+
+ /* Coding scheme:
+ Codeword RunLength
+ 0 1
+ 10x 2-3
+ 110x 4-5
+ 1110xx 6-9
+ 11110xxx 10-17
+ 111110xxxx 18-33
+ 111111xxxxxxxxxxxx 34-4129
+ */
+
+ switch ( pbi->bits_so_far ){
+ case 1:
+ if ( pbi->bit_pattern == 0 ){
+ ret_val = 1;
+ *run_value = 1;
+ }
+ break;
+
+ case 3:
+ /* Bit 1 clear */
+ if ( !(pbi->bit_pattern & 0x0002) ){
+ ret_val = 1;
+ *run_value = (pbi->bit_pattern & 0x0001) + 2;
+ }
+ break;
+
+ case 4:
+ /* Bit 1 clear */
+ if ( !(pbi->bit_pattern & 0x0002) ){
+ ret_val = 1;
+ *run_value = (pbi->bit_pattern & 0x0001) + 4;
+ }
+ break;
+
+ case 6:
+ /* Bit 2 clear */
+ if ( !(pbi->bit_pattern & 0x0004) ){
+ ret_val = 1;
+ *run_value = (pbi->bit_pattern & 0x0003) + 6;
+ }
+ break;
+
+ case 8:
+ /* Bit 3 clear */
+ if ( !(pbi->bit_pattern & 0x0008) ){
+ ret_val = 1;
+ *run_value = (pbi->bit_pattern & 0x0007) + 10;
+ }
+ break;
+
+ case 10:
+ /* Bit 4 clear */
+ if ( !(pbi->bit_pattern & 0x0010) ){
+ ret_val = 1;
+ *run_value = (pbi->bit_pattern & 0x000F) + 18;
+ }
+ break;
+
+ case 18:
+ ret_val = 1;
+ *run_value = (pbi->bit_pattern & 0x0FFF) + 34;
+ break;
+
+ default:
+ ret_val = 0;
+ break;
+ }
+
+ return ret_val;
+}
+
+static void GetNextBInit(PB_INSTANCE *pbi){
pbi->NextBit = oggpackB_read(&pbi->opb,1);
/* Read run length */
@@ -237,7 +385,7 @@
&pbi->BitsLeft ) == 0 );
}
-unsigned char GetNextBBit (PB_INSTANCE *pbi){
+static unsigned char GetNextBBit (PB_INSTANCE *pbi){
if ( !pbi->BitsLeft ){
/* Toggle the value. */
pbi->NextBit = ( pbi->NextBit == 1 ) ? 0 : 1;
@@ -255,7 +403,7 @@
return pbi->NextBit;
}
-void GetNextSbInit(PB_INSTANCE *pbi){
+static void GetNextSbInit(PB_INSTANCE *pbi){
pbi->NextBit = oggpackB_read(&pbi->opb,1);
/* Read run length */
@@ -264,7 +412,7 @@
&pbi->BitsLeft ) == 0 );
}
-unsigned char GetNextSbBit (PB_INSTANCE *pbi){
+static unsigned char GetNextSbBit (PB_INSTANCE *pbi){
if ( !pbi->BitsLeft ){
/* Toggle the value. */
pbi->NextBit = ( pbi->NextBit == 1 ) ? 0 : 1;
@@ -282,69 +430,6 @@
return pbi->NextBit;
}
-void GetNextMbInit(PB_INSTANCE *pbi){
- pbi->NextBit = oggpackB_read(&pbi->opb,1);
- pbi->BitsLeft = 0;
-
- /* Read run length */
- FrArrayDeCodeInit(pbi);
- while ( FrArrayDeCodeMBRun( pbi,oggpackB_read(&pbi->opb,1),
- &pbi->BitsLeft ) == 0 );
-}
-
-unsigned char GetNextMbBit (PB_INSTANCE *pbi){
- if ( !pbi->BitsLeft ){
- /* Toggle the value. */
- pbi->NextBit = ( pbi->NextBit == 1 ) ? 0 : 1;
-
- /* Read next run */
- FrArrayDeCodeInit(pbi);
- while ( FrArrayDeCodeMBRun( pbi, oggpackB_read(&pbi->opb,1),
- &pbi->BitsLeft ) == 0 );
- }
-
- /* Decrement bits left in run counter */
- pbi->BitsLeft--;
-
- /* Return next bit value */
- return pbi->NextBit;
-}
-
-void ReadBlockPatternInit (PB_INSTANCE *pbi){
- pbi->BlockPatternPredictor = 0;
-}
-
-unsigned char ReadNextBlockPattern (PB_INSTANCE *pbi){
- unsigned char BlockPattern = 0;
- unsigned char Bitpattern = 0;
- ogg_uint32_t BitCount = 3;
-
- /* Read three bits and test to see if we have a valid token. */
- Bitpattern = oggpackB_read(&pbi->opb, 3);
-
- /* Test pattern to see if is a valid token. */
- BlockPattern = BlockDecode1[pbi->BlockPatternPredictor][Bitpattern];
-
- /* if pattern was not a valid token */
- if ( !BlockPattern ){
- BitCount++;
- Bitpattern = (Bitpattern << 1) + oggpackB_read(&pbi->opb,1);
-
- /* Test pattern to see if is a valid token. */
- BlockPattern = BlockDecode2[pbi->BlockPatternPredictor][Bitpattern];
-
- if ( !BlockPattern ){
- BitCount++;
- Bitpattern = (Bitpattern << 1) + oggpackB_read(&pbi->opb,1);
- BlockPattern = BlockDecode3[pbi->BlockPatternPredictor][Bitpattern];
- }
- }
-
- /* Update the entropy predictor for next time. */
- pbi->BlockPatternPredictor = BPPredictor[BlockPattern];
- return BlockPattern;
-
-}
void QuadDecodeDisplayFragments ( PB_INSTANCE *pbi ){
ogg_uint32_t SB, MB, B;
int DataToDecode;
@@ -442,267 +527,6 @@
}
}
}
-}
-
-int FrArrayDeCodeMBRun( PB_INSTANCE *pbi, ogg_uint32_t bit_value,
- ogg_int32_t * run_value ){
- int ret_val = 0;
-
- /* Add in the new bit value. */
- pbi->bits_so_far++;
- pbi->bit_pattern = (pbi->bit_pattern << 1) + (bit_value & 1);
-
- /* Coding scheme:
- Codeword RunLength
- 0 1
- 10 2
- 110x 3-4
- 1110xx 5-8
- 11110xxx 9-16
- 111110xxxx 17-32
- 1111110xxxxx 33-64
- 11111110xxxxxx 65-128
- 111111110xxxxxxx 129-256
- 111111111 256 repeats
- */
- switch ( pbi->bits_so_far ){
- case 1:
- if ( pbi->bit_pattern == 0 ){
- ret_val = 1;
- *run_value += 1;
- }
- break;
-
- case 2:
- /* Bit 1 clear */
- if ( pbi->bit_pattern == 2 ){
- ret_val = 1;
- *run_value += 2;
- }
- break;
-
- case 4:
- /* Bit 1 clear */
- if ( !(pbi->bit_pattern & 0x0002) ){
- ret_val = 1;
- *run_value += (pbi->bit_pattern & 0x0001) + 3;
- }
- break;
-
- case 6:
- /* Bit 2 clear */
- if ( !(pbi->bit_pattern & 0x0004) ){
- ret_val = 1;
- *run_value += (pbi->bit_pattern & 0x0003) + 5;
- }
- break;
-
- case 8:
- /* Bit 3 clear */
- if ( !(pbi->bit_pattern & 0x0008) ){
- ret_val = 1;
- *run_value += (pbi->bit_pattern & 0x0007) + 9;
- }
- break;
-
- /* This token is a special case repeat token and does not
- terminate the run */
- case 9:
- if ( pbi->bit_pattern == 0x01FF ){
- ret_val = 0;
- *run_value += 256;
-
- /* Reset the bit counter and pattern. */
- FrArrayDeCodeInit(pbi);
- }
- break;
-
- case 10:
- /* Bit 4 clear*/
- if ( !(pbi->bit_pattern & 0x0010) ) {
- ret_val = 1;
- *run_value += (pbi->bit_pattern & 0x000F) + 17;
- }
- break;
-
- case 12:
- /* Bit 5 clear */
- if ( !(pbi->bit_pattern & 0x0020) ){
- ret_val = 1;
- *run_value += (pbi->bit_pattern & 0x001F) + 33;
- }
- break;
-
- case 14:
- /* Bit 6 clear */
- if ( !(pbi->bit_pattern & 0x0040) ) {
- ret_val = 1;
- *run_value += (pbi->bit_pattern & 0x003F) + 65;
- }
- break;
-
- case 16:
- /* Bit 7 clear */
- if ( !(pbi->bit_pattern & 0x0080) ) {
- ret_val = 1;
- *run_value += (pbi->bit_pattern & 0x007F) + 129;
- }
- break;
-
- default:
- ret_val = 0;
- break;
- }
-
- return ret_val;
-}
-
-int FrArrayDeCodeSBRun (PB_INSTANCE *pbi, ogg_uint32_t bit_value,
- ogg_int32_t * run_value ){
- int ret_val = 0;
-
- /* Add in the new bit value. */
- pbi->bits_so_far++;
- pbi->bit_pattern = (pbi->bit_pattern << 1) + (bit_value & 1);
-
- /* Coding scheme:
- Codeword RunLength
- 0 1
- 10x 2-3
- 110x 4-5
- 1110xx 6-9
- 11110xxx 10-17
- 111110xxxx 18-33
- 111111xxxxxxxxxxxx 34-4129
- */
-
- switch ( pbi->bits_so_far ){
- case 1:
- if ( pbi->bit_pattern == 0 ){
- ret_val = 1;
- *run_value = 1;
- }
- break;
-
- case 3:
- /* Bit 1 clear */
- if ( !(pbi->bit_pattern & 0x0002) ){
- ret_val = 1;
- *run_value = (pbi->bit_pattern & 0x0001) + 2;
- }
- break;
-
- case 4:
- /* Bit 1 clear */
- if ( !(pbi->bit_pattern & 0x0002) ){
- ret_val = 1;
- *run_value = (pbi->bit_pattern & 0x0001) + 4;
- }
- break;
-
- case 6:
- /* Bit 2 clear */
- if ( !(pbi->bit_pattern & 0x0004) ){
- ret_val = 1;
- *run_value = (pbi->bit_pattern & 0x0003) + 6;
- }
- break;
-
- case 8:
- /* Bit 3 clear */
- if ( !(pbi->bit_pattern & 0x0008) ){
- ret_val = 1;
- *run_value = (pbi->bit_pattern & 0x0007) + 10;
- }
- break;
-
- case 10:
- /* Bit 4 clear */
- if ( !(pbi->bit_pattern & 0x0010) ){
- ret_val = 1;
- *run_value = (pbi->bit_pattern & 0x000F) + 18;
- }
- break;
-
- case 18:
- ret_val = 1;
- *run_value = (pbi->bit_pattern & 0x0FFF) + 34;
- break;
-
- default:
- ret_val = 0;
- break;
- }
-
- return ret_val;
-}
-
-int FrArrayDeCodeBlockRun( PB_INSTANCE *pbi, ogg_uint32_t bit_value,
- ogg_int32_t * run_value ){
- int ret_val = 0;
-
- /* Add in the new bit value. */
- pbi->bits_so_far++;
- pbi->bit_pattern = (pbi->bit_pattern << 1) + (bit_value & 1);
-
- /* Coding scheme:
- Codeword RunLength
- 0x 1-2
- 10x 3-4
- 110x 5-6
- 1110xx 7-10
- 11110xx 11-14
- 11111xxxx 15-30
- */
-
- switch ( pbi->bits_so_far ){
- case 2:
- /* If bit 1 is clear */
- if ( !(pbi->bit_pattern & 0x0002) ){
- ret_val = 1;
- *run_value = (pbi->bit_pattern & 0x0001) + 1;
- }
- break;
-
- case 3:
- /* If bit 1 is clear */
- if ( !(pbi->bit_pattern & 0x0002) ){
- ret_val = 1;
- *run_value = (pbi->bit_pattern & 0x0001) + 3;
- }
- break;
-
- case 4:
- /* If bit 1 is clear */
- if ( !(pbi->bit_pattern & 0x0002) ){
- ret_val = 1;
- *run_value = (pbi->bit_pattern & 0x0001) + 5;
- }
- break;
-
- case 6:
- /* If bit 2 is clear */
- if ( !(pbi->bit_pattern & 0x0004) ){
- ret_val = 1;
- *run_value = (pbi->bit_pattern & 0x0003) + 7;
- }
- break;
-
- case 7:
- /* If bit 2 is clear */
- if ( !(pbi->bit_pattern & 0x0004) ){
- ret_val = 1;
- *run_value = (pbi->bit_pattern & 0x0003) + 11;
- }
- break;
-
- case 9:
- ret_val = 1;
- *run_value = (pbi->bit_pattern & 0x000F) + 15;
- break;
- }
-
- return ret_val;
}
CODING_MODE FrArrayUnpackMode(PB_INSTANCE *pbi){
<p><p>1.2 +48 -53 theora/lib/frinit.c
Index: frinit.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/frinit.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- frinit.c 20 Sep 2002 09:30:32 -0000 1.1
+++ frinit.c 20 Sep 2002 22:01:43 -0000 1.2
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: frinit.c,v 1.1 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: frinit.c,v 1.2 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -20,7 +20,53 @@
#include "encoder_internal.h"
-void CalcPixelIndexTable( PB_INSTANCE *pbi){
+void InitializeFragCoordinates(PB_INSTANCE *pbi){
+
+ ogg_uint32_t i, j;
+
+ ogg_uint32_t HorizFrags = pbi->HFragments;
+ ogg_uint32_t VertFrags = pbi->VFragments;
+ ogg_uint32_t StartFrag = 0;
+
+ /* Y */
+
+ for(i = 0; i< VertFrags; i++){
+ for(j = 0; j< HorizFrags; j++){
+
+ ogg_uint32_t ThisFrag = i * HorizFrags + j;
+ pbi->FragCoordinates[ ThisFrag ].x=j * BLOCK_HEIGHT_WIDTH;
+ pbi->FragCoordinates[ ThisFrag ].y=i * BLOCK_HEIGHT_WIDTH;
+
+ }
+ }
+
+ /* U */
+ HorizFrags >>= 1;
+ VertFrags >>= 1;
+ StartFrag = pbi->YPlaneFragments;
+
+ for(i = 0; i< VertFrags; i++) {
+ for(j = 0; j< HorizFrags; j++) {
+ ogg_uint32_t ThisFrag = StartFrag + i * HorizFrags + j;
+ pbi->FragCoordinates[ ThisFrag ].x=j * BLOCK_HEIGHT_WIDTH;
+ pbi->FragCoordinates[ ThisFrag ].y=i * BLOCK_HEIGHT_WIDTH;
+
+ }
+ }
+
+ /* V */
+ StartFrag = pbi->YPlaneFragments + pbi->UVPlaneFragments;
+ for(i = 0; i< VertFrags; i++) {
+ for(j = 0; j< HorizFrags; j++) {
+ ogg_uint32_t ThisFrag = StartFrag + i * HorizFrags + j;
+ pbi->FragCoordinates[ ThisFrag ].x=j * BLOCK_HEIGHT_WIDTH;
+ pbi->FragCoordinates[ ThisFrag ].y=i * BLOCK_HEIGHT_WIDTH;
+
+ }
+ }
+}
+
+static void CalcPixelIndexTable( PB_INSTANCE *pbi){
ogg_uint32_t i;
ogg_uint32_t * PixelIndexTablePtr;
@@ -274,52 +320,6 @@
}
-void InitializeFragCoordinates(PB_INSTANCE *pbi){
-
- ogg_uint32_t i, j;
-
- ogg_uint32_t HorizFrags = pbi->HFragments;
- ogg_uint32_t VertFrags = pbi->VFragments;
- ogg_uint32_t StartFrag = 0;
-
- /* Y */
-
- for(i = 0; i< VertFrags; i++){
- for(j = 0; j< HorizFrags; j++){
-
- ogg_uint32_t ThisFrag = i * HorizFrags + j;
- pbi->FragCoordinates[ ThisFrag ].x=j * BLOCK_HEIGHT_WIDTH;
- pbi->FragCoordinates[ ThisFrag ].y=i * BLOCK_HEIGHT_WIDTH;
-
- }
- }
-
- /* U */
- HorizFrags >>= 1;
- VertFrags >>= 1;
- StartFrag = pbi->YPlaneFragments;
-
- for(i = 0; i< VertFrags; i++) {
- for(j = 0; j< HorizFrags; j++) {
- ogg_uint32_t ThisFrag = StartFrag + i * HorizFrags + j;
- pbi->FragCoordinates[ ThisFrag ].x=j * BLOCK_HEIGHT_WIDTH;
- pbi->FragCoordinates[ ThisFrag ].y=i * BLOCK_HEIGHT_WIDTH;
-
- }
- }
-
- /* V */
- StartFrag = pbi->YPlaneFragments + pbi->UVPlaneFragments;
- for(i = 0; i< VertFrags; i++) {
- for(j = 0; j< HorizFrags; j++) {
- ogg_uint32_t ThisFrag = StartFrag + i * HorizFrags + j;
- pbi->FragCoordinates[ ThisFrag ].x=j * BLOCK_HEIGHT_WIDTH;
- pbi->FragCoordinates[ ThisFrag ].y=i * BLOCK_HEIGHT_WIDTH;
-
- }
- }
-}
-
void InitFrameDetails(PB_INSTANCE *pbi){
int FrameSize;
@@ -392,9 +392,4 @@
CalcPixelIndexTable( pbi );
}
-
-void InitialiseConfiguration(PB_INSTANCE *pbi){
- pbi->Configuration.HFragPixels = 8;
- pbi->Configuration.VFragPixels = 8;
-}
<p><p>1.3 +6 -8 theora/lib/huffman.c
Index: huffman.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/huffman.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- huffman.c 20 Sep 2002 09:30:32 -0000 1.2
+++ huffman.c 20 Sep 2002 22:01:43 -0000 1.3
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: huffman.c,v 1.2 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: huffman.c,v 1.3 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -20,8 +20,8 @@
#include "encoder_internal.h"
#include "hufftables.h"
-void CreateHuffmanList(HUFF_ENTRY ** HuffRoot,
- ogg_uint32_t HIndex, ogg_uint32_t *FreqList ) {
+static void CreateHuffmanList(HUFF_ENTRY ** HuffRoot,
+ ogg_uint32_t HIndex, ogg_uint32_t *FreqList ) {
int i;
HUFF_ENTRY *entry_ptr;
HUFF_ENTRY *search_ptr;
@@ -78,7 +78,7 @@
}
}
-void CreateCodeArray( HUFF_ENTRY * HuffRoot,
+static void CreateCodeArray( HUFF_ENTRY * HuffRoot,
ogg_uint32_t *HuffCodeArray,
unsigned char *HuffCodeLengthArray,
ogg_uint32_t CodeValue,
@@ -97,7 +97,7 @@
}
}
-void BuildHuffmanTree( HUFF_ENTRY **HuffRoot,
+static void BuildHuffmanTree( HUFF_ENTRY **HuffRoot,
ogg_uint32_t *HuffCodeArray,
unsigned char *HuffCodeLengthArray,
ogg_uint32_t HIndex,
@@ -174,7 +174,7 @@
HuffCodeLengthArray, 0, 0);
}
-void DestroyHuffTree(HUFF_ENTRY *root_ptr){
+static void DestroyHuffTree(HUFF_ENTRY *root_ptr){
if (root_ptr){
if ( root_ptr->ZeroChild )
DestroyHuffTree(root_ptr->ZeroChild);
@@ -188,8 +188,6 @@
void ClearHuffmanSet( PB_INSTANCE *pbi ){
int i;
-
- HUFF_ENTRY **HuffRoot = pbi->HuffRoot_VP3x ;
for ( i = 0; i < NUM_HUFF_TABLES; i++ ){
if (pbi->HuffRoot_VP3x[i]) DestroyHuffTree(pbi->HuffRoot_VP3x[i]);
<p><p>1.3 +23 -23 theora/lib/idct.c
Index: idct.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/idct.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- idct.c 20 Sep 2002 09:30:32 -0000 1.2
+++ idct.c 20 Sep 2002 22:01:43 -0000 1.3
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: idct.c,v 1.2 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: idct.c,v 1.3 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -28,7 +28,7 @@
#define xC6S2 25080
#define xC7S1 12785
-void dequant_slow( ogg_int16_t * dequant_coeffs,
+static void dequant_slow( ogg_int16_t * dequant_coeffs,
ogg_int16_t * quantized_list,
ogg_int32_t * DCT_block) {
int i;
@@ -244,18 +244,18 @@
}
}
-/*////////////////////////
-// x x x x 0 0 0 0
-// x x x 0 0 0 0 0
-// x x 0 0 0 0 0 0
-// x 0 0 0 0 0 0 0
-// 0 0 0 0 0 0 0 0
-// 0 0 0 0 0 0 0 0
-// 0 0 0 0 0 0 0 0
-// 0 0 0 0 0 0 0 0
-////////////////////////*/
+/************************
+ x x x x 0 0 0 0
+ x x x 0 0 0 0 0
+ x x 0 0 0 0 0 0
+ x 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+*************************/
-void dequant_slow10( ogg_int16_t * dequant_coeffs,
+static void dequant_slow10( ogg_int16_t * dequant_coeffs,
ogg_int16_t * quantized_list,
ogg_int32_t * DCT_block){
int i;
@@ -446,16 +446,16 @@
}
}
-/*//////////////////////////
-// x 0 0 0 0 0 0 0
-// 0 0 0 0 0 0 0 0
-// 0 0 0 0 0 0 0 0
-// 0 0 0 0 0 0 0 0
-// 0 0 0 0 0 0 0 0
-// 0 0 0 0 0 0 0 0
-// 0 0 0 0 0 0 0 0
-// 0 0 0 0 0 0 0 0
-/////////////////////////*/
+/***************************
+ x 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0
+**************************/
void IDct1( Q_LIST_ENTRY * InputData,
ogg_int16_t *QuantMatrix,
<p><p>1.4 +29 -29 theora/lib/mcomp.c
Index: mcomp.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/mcomp.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- mcomp.c 20 Sep 2002 09:30:32 -0000 1.3
+++ mcomp.c 20 Sep 2002 22:01:43 -0000 1.4
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: mcomp.c,v 1.3 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: mcomp.c,v 1.4 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -96,7 +96,7 @@
cpi->MVPixelOffsetY[i] = (cpi->MVOffsetY[i]*LineStepY) + cpi->MVOffsetX[i];
}
-ogg_uint32_t GetInterErr (unsigned char * NewDataPtr,
+static ogg_uint32_t GetInterErr (unsigned char * NewDataPtr,
unsigned char * RefDataPtr1,
unsigned char * RefDataPtr2,
ogg_uint32_t PixelsPerLine ) {
@@ -204,11 +204,10 @@
return (( (XXSum<<6) - XSum*XSum ));
}
-ogg_uint32_t GetSumAbsDiffs (unsigned char * NewDataPtr,
+static ogg_uint32_t GetSumAbsDiffs (unsigned char * NewDataPtr,
unsigned char * RefDataPtr,
ogg_uint32_t PixelsPerLine,
- ogg_uint32_t ErrorSoFar,
- ogg_uint32_t BestSoFar ) {
+ ogg_uint32_t ErrorSoFar) {
ogg_uint32_t i;
ogg_uint32_t DiffVal = ErrorSoFar;
@@ -231,7 +230,7 @@
return DiffVal;
}
-ogg_uint32_t GetNextSumAbsDiffs (unsigned char * NewDataPtr,
+static ogg_uint32_t GetNextSumAbsDiffs (unsigned char * NewDataPtr,
unsigned char * RefDataPtr,
ogg_uint32_t PixelsPerLine,
ogg_uint32_t ErrorSoFar,
@@ -259,7 +258,7 @@
return DiffVal;
}
-ogg_uint32_t GetHalfPixelSumAbsDiffs (unsigned char * SrcData,
+static ogg_uint32_t GetHalfPixelSumAbsDiffs (unsigned char * SrcData,
unsigned char * RefDataPtr1,
unsigned char * RefDataPtr2,
ogg_uint32_t PixelsPerLine,
@@ -274,7 +273,7 @@
if ( RefOffset == 0 ) {
/* Simple case as for non 0.5 pixel */
DiffVal += GetSumAbsDiffs( SrcData, RefDataPtr1, PixelsPerLine,
- ErrorSoFar, BestSoFar );
+ ErrorSoFar);
} else {
for ( i=0; i < BLOCK_HEIGHT_WIDTH; i++ ) {
DiffVal += abs( ((int)SrcData[0]) - (((int)RefDataPtr1[0] +
@@ -306,7 +305,7 @@
return DiffVal;
}
-ogg_uint32_t GetIntraError (unsigned char * DataPtr,
+static ogg_uint32_t GetIntraError (unsigned char * DataPtr,
ogg_uint32_t PixelsPerLine ) {
ogg_uint32_t i;
ogg_uint32_t XSum=0;
@@ -348,7 +347,6 @@
ogg_uint32_t PixelsPerLine ) {
ogg_uint32_t LocalFragIndex = FragIndex;
ogg_uint32_t IntraError = 0;
- ogg_uint32_t TmpError = 0;
/* Add together the intra errors for those blocks in the macro block
that are coded (Y only) */
@@ -383,9 +381,12 @@
return IntraError;
}
-ogg_uint32_t GetMBInterError (CP_INSTANCE *cpi, unsigned char * SrcPtr,
- unsigned char * RefPtr, ogg_uint32_t FragIndex,
- ogg_int32_t LastXMV, ogg_int32_t LastYMV,
+ogg_uint32_t GetMBInterError (CP_INSTANCE *cpi,
+ unsigned char * SrcPtr,
+ unsigned char * RefPtr,
+ ogg_uint32_t FragIndex,
+ ogg_int32_t LastXMV,
+ ogg_int32_t LastYMV,
ogg_uint32_t PixelsPerLine ) {
ogg_uint32_t RefPixelsPerLine = cpi->pb.Configuration.YStride;
ogg_uint32_t LocalFragIndex = FragIndex;
@@ -394,7 +395,6 @@
ogg_int32_t RefPixelOffset;
ogg_int32_t RefPtr2Offset;
- ogg_uint32_t TmpError = 0;
ogg_uint32_t InterError = 0;
unsigned char * SrcPtr1;
@@ -519,19 +519,19 @@
/* Check the 0,0 candidate. */
if ( MBlockDispFrags[0] ) {
Error = GetSumAbsDiffs( SrcPtr[0], RefPtr,
- PixelsPerLine, Error, HUGE_ERROR );
+ PixelsPerLine, Error);
}
if ( MBlockDispFrags[1] ) {
Error = GetSumAbsDiffs( SrcPtr[1], RefPtr + 8,
- PixelsPerLine, Error, HUGE_ERROR );
+ PixelsPerLine, Error);
}
if ( MBlockDispFrags[2] ) {
Error = GetSumAbsDiffs( SrcPtr[2], RefPtr + RefRow2Offset,
- PixelsPerLine, Error, HUGE_ERROR );
+ PixelsPerLine, Error);
}
if ( MBlockDispFrags[3] ) {
Error = GetSumAbsDiffs( SrcPtr[3], RefPtr + RefRow2Offset + 8,
- PixelsPerLine, Error, HUGE_ERROR );
+ PixelsPerLine, Error);
}
/* Set starting values to results of 0, 0 vector. */
@@ -555,7 +555,7 @@
/* Get the score for the current offset */
if ( MBlockDispFrags[0] ) {
Error = GetSumAbsDiffs( SrcPtr[0], CandidateBlockPtr,
- PixelsPerLine, Error, MinError );
+ PixelsPerLine, Error);
}
if ( MBlockDispFrags[1] && (Error < MinError) ) {
@@ -718,19 +718,19 @@
/* Summ errors for each block. */
if ( MBlockDispFrags[0] ) {
Error = GetSumAbsDiffs( SrcPtr[0], CandidateBlockPtr,
- PixelsPerLine, Error, HUGE_ERROR );
+ PixelsPerLine, Error);
}
if ( MBlockDispFrags[1] ){
Error = GetSumAbsDiffs( SrcPtr[1], CandidateBlockPtr + 8,
- PixelsPerLine, Error, HUGE_ERROR );
+ PixelsPerLine, Error);
}
if ( MBlockDispFrags[2] ){
Error = GetSumAbsDiffs( SrcPtr[2], CandidateBlockPtr + RefRow2Offset,
- PixelsPerLine, Error, HUGE_ERROR );
+ PixelsPerLine, Error);
}
if ( MBlockDispFrags[3] ){
Error = GetSumAbsDiffs( SrcPtr[3], CandidateBlockPtr + RefRow2Offset + 8,
- PixelsPerLine, Error, HUGE_ERROR );
+ PixelsPerLine, Error);
}
/* Was this the best so far */
@@ -812,11 +812,11 @@
return InterMVError;
}
-ogg_uint32_t GetBMVExhaustiveSearch (CP_INSTANCE *cpi,
- unsigned char * RefFramePtr,
- ogg_uint32_t FragIndex,
- ogg_uint32_t PixelsPerLine,
- MOTION_VECTOR *MV ) {
+static ogg_uint32_t GetBMVExhaustiveSearch (CP_INSTANCE *cpi,
+ unsigned char * RefFramePtr,
+ ogg_uint32_t FragIndex,
+ ogg_uint32_t PixelsPerLine,
+ MOTION_VECTOR *MV ) {
ogg_uint32_t Error = 0;
ogg_uint32_t MinError = HUGE_ERROR;
ogg_uint32_t InterMVError = 0;
@@ -851,7 +851,7 @@
for ( j = 0; j < (ogg_int32_t)MAX_MV_EXTENT; j++ ){
/* Get the block error score. */
Error = GetSumAbsDiffs( SrcPtr, CandidateBlockPtr,
- PixelsPerLine, 0, HUGE_ERROR );
+ PixelsPerLine, 0);
/* Was this the best so far */
if ( Error < MinError ) {
<p><p>1.5 +3 -5 theora/lib/misc_common.c
Index: misc_common.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/misc_common.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- misc_common.c 20 Sep 2002 09:30:32 -0000 1.4
+++ misc_common.c 20 Sep 2002 22:01:43 -0000 1.5
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: misc_common.c,v 1.4 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: misc_common.c,v 1.5 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -71,7 +71,7 @@
return BytesPerBlock;
}
-void UpRegulateMB( CP_INSTANCE *cpi, ogg_uint32_t RegulationQ,
+static void UpRegulateMB( CP_INSTANCE *cpi, ogg_uint32_t RegulationQ,
ogg_uint32_t SB, ogg_uint32_t MB, int NoCheck ) {
ogg_int32_t FragIndex;
ogg_uint32_t B;
@@ -125,7 +125,7 @@
}
}
-void UpRegulateBlocks (CP_INSTANCE *cpi, ogg_uint32_t RegulationQ,
+static void UpRegulateBlocks (CP_INSTANCE *cpi, ogg_uint32_t RegulationQ,
ogg_int32_t RecoveryBlocks,
ogg_uint32_t * LastSB, ogg_uint32_t * LastMB ) {
@@ -177,8 +177,6 @@
ogg_int32_t RecoveryBlocks ) {
ogg_uint32_t LastPassMBPos = 0;
ogg_uint32_t StdLastMBPos = 0;
- ogg_uint32_t i = 0;
- ogg_uint32_t LoopTimesRound = 0;
ogg_uint32_t MaxSB = cpi->pb.YSBRows *
cpi->pb.YSBCols; /* Tot super blocks in image */
<p><p>1.4 +46 -123 theora/lib/pp.c
Index: pp.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/pp.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- pp.c 20 Sep 2002 09:45:02 -0000 1.3
+++ pp.c 20 Sep 2002 22:01:43 -0000 1.4
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: pp.c,v 1.3 2002/09/20 09:45:02 xiphmont Exp $
+ last mod: $Id: pp.c,v 1.4 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -19,26 +19,36 @@
#include <ogg/ogg.h>
#include "encoder_internal.h"
#include "pp.h"
-#include "quant_lookup.h"
#define MAX(a, b) ((a>b)?a:b)
#define MIN(a, b) ((a<b)?a:b)
#define PP_QUALITY_THRESH 49
-ogg_int32_t SharpenModifier[ Q_TABLE_SIZE ] =
+static ogg_int32_t SharpenModifier[ Q_TABLE_SIZE ] =
{ -12, -11, -10, -10, -9, -9, -9, -9,
- -6, -6, -6, -6, -6, -6, -6, -6,
- -4, -4, -4, -4, -4, -4, -4, -4,
- -2, -2, -2, -2, -2, -2, -2, -2,
- -2, -2, -2, -2, -2, -2, -2, -2,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0
+ -6, -6, -6, -6, -6, -6, -6, -6,
+ -4, -4, -4, -4, -4, -4, -4, -4,
+ -2, -2, -2, -2, -2, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+static ogg_uint32_t DcQuantScaleV1[ Q_TABLE_SIZE ] = {
+ 22, 20, 19, 18, 17, 17, 16, 16,
+ 15, 15, 14, 14, 13, 13, 12, 12,
+ 11, 11, 10, 10, 9, 9, 9, 8,
+ 8, 8, 7, 7, 7, 6, 6, 6,
+ 6, 5, 5, 5, 5, 4, 4, 4,
+ 4, 4, 3, 3, 3, 3, 3, 3,
+ 3, 2, 2, 2, 2, 2, 2, 2,
+ 2, 1, 1, 1, 1, 1, 1, 1
};
static ogg_uint32_t *DeringModifierV1=DcQuantScaleV1;
-void PClearFrameInfo(PP_INSTANCE * ppi){
+static void PClearFrameInfo(PP_INSTANCE * ppi){
int i;
if(ppi->ScanPixelIndexTable) _ogg_free(ppi->ScanPixelIndexTable);
@@ -171,12 +181,11 @@
ppi->MaxLineSearchLen = MAX_SEARCH_LINE_LEN;
}
-static void DeringBlockStrong(PB_INSTANCE *pbi,
- unsigned char *SrcPtr,
- unsigned char *DstPtr,
- ogg_int32_t Pitch,
- ogg_uint32_t FragQIndex,
- ogg_uint32_t *QuantScale){
+static void DeringBlockStrong(unsigned char *SrcPtr,
+ unsigned char *DstPtr,
+ ogg_int32_t Pitch,
+ ogg_uint32_t FragQIndex,
+ ogg_uint32_t *QuantScale){
ogg_int16_t UDMod[72];
ogg_int16_t LRMod[72];
@@ -298,12 +307,11 @@
}
}
-static void DeringBlockWeak(PB_INSTANCE *pbi,
- unsigned char *SrcPtr,
- unsigned char *DstPtr,
- ogg_int32_t Pitch,
- ogg_uint32_t FragQIndex,
- ogg_uint32_t *QuantScale){
+static void DeringBlockWeak(unsigned char *SrcPtr,
+ unsigned char *DstPtr,
+ ogg_int32_t Pitch,
+ ogg_uint32_t FragQIndex,
+ ogg_uint32_t *QuantScale){
ogg_int16_t UDMod[72];
ogg_int16_t LRMod[72];
@@ -420,91 +428,6 @@
}
}
-static void DeringBlock(const PB_INSTANCE *pbi,
- const unsigned char *SrcPtr,
- unsigned char *DstPtr,
- const ogg_int32_t Pitch,
- ogg_uint32_t FragQIndex,
- const ogg_uint32_t *QuantScale,
- ogg_uint32_t Variance){
-
- int N[8];
- unsigned int j,k,l;
- unsigned int QValue = QuantScale[FragQIndex];
-
- int atot;
- int B;
- int newVal;
-
- const unsigned char *srcRow = SrcPtr-Pitch-1;
- unsigned char *dstRow = DstPtr;
-
- unsigned int round = (1<<7);
-
- int High;
- int Low;
- int TmpMod;
- int Sharpen = SharpenModifier[FragQIndex];
-
- int Slope = 4;
-
- if(pbi->PostProcessingLevel > 100)
- QValue = pbi->PostProcessingLevel - 100;
-
- if ( Variance > 32768)
- Slope = 4;
- else if (Variance > 2048)
- Slope = 8;
-
- High = 3 * QValue;
- if(High>32)
- High=32;
- Low = 0;
-
- for(k=0;k<8;k++){
- /* loop expanded for speed */
- for(j=0;j<8;j++){
- /* set up 8 neighbors of pixel srcRow[j] */
- N[0] = srcRow[j ];
- N[1] = srcRow[j +1];
- N[2] = srcRow[j +2];
- N[3] = srcRow[j +Pitch ];
- N[4] = srcRow[j +Pitch +2];
- N[5] = srcRow[j +Pitch*2 ];
- N[6] = srcRow[j +Pitch*2 +1];
- N[7] = srcRow[j +Pitch*2 +2];
-
- // column 0
- atot = 256;
- B = round;
-
- for(l = 0; l<8; l++){
- TmpMod = 32 + QValue - (Slope *(abs(srcRow[j+Pitch+1]-N[l])) >> 2);
-
- if(TmpMod< -64)
- TmpMod = Sharpen;
-
- else if(TmpMod<Low)
- TmpMod = Low;
-
- else if(TmpMod>High)
- TmpMod = High;
-
- atot -= TmpMod;
- B += TmpMod * N[l];
-
- }
-
- newVal = ( atot * srcRow[j+Pitch+1] + B) >> 8;
-
- dstRow[j] = clamp255( newVal );
- }
-
- dstRow += Pitch;
- srcRow += Pitch;
- }
-}
-
static void DeringFrame(PB_INSTANCE *pbi,
unsigned char *Src, unsigned char *Dst){
ogg_uint32_t col,row;
@@ -539,7 +462,7 @@
ogg_int32_t Variance = pbi->FragmentVariances[Block];
if( pbi->PostProcessingLevel >5 && Variance > Thresh3 ){
- DeringBlockStrong(pbi, SrcPtr + 8 * col, DestPtr + 8 * col,
+ DeringBlockStrong(SrcPtr + 8 * col, DestPtr + 8 * col,
LineLength,Quality,QuantScale);
if( (col > 0 &&
@@ -551,18 +474,18 @@
(row > 0 &&
pbi->FragmentVariances[Block-BlocksAcross] > Thresh4) ){
- DeringBlockStrong(pbi, SrcPtr + 8 * col, DestPtr + 8 * col,
+ DeringBlockStrong(SrcPtr + 8 * col, DestPtr + 8 * col,
LineLength,Quality,QuantScale);
- DeringBlockStrong(pbi, SrcPtr + 8 * col, DestPtr + 8 * col,
+ DeringBlockStrong(SrcPtr + 8 * col, DestPtr + 8 * col,
LineLength,Quality,QuantScale);
}
} else if(Variance > Thresh2 ) {
- DeringBlockStrong(pbi, SrcPtr + 8 * col, DestPtr + 8 * col,
+ DeringBlockStrong(SrcPtr + 8 * col, DestPtr + 8 * col,
LineLength,Quality,QuantScale);
} else if(Variance > Thresh1 ) {
- DeringBlockWeak(pbi, SrcPtr + 8 * col, DestPtr + 8 * col,
+ DeringBlockWeak(SrcPtr + 8 * col, DestPtr + 8 * col,
LineLength,Quality,QuantScale);
} else {
@@ -592,18 +515,18 @@
ogg_int32_t Variance = pbi->FragmentVariances[Block];
if( pbi->PostProcessingLevel >5 && Variance > Thresh4 ) {
- DeringBlockStrong(pbi,SrcPtr + 8 * col, DestPtr + 8 * col,
+ DeringBlockStrong(SrcPtr + 8 * col, DestPtr + 8 * col,
LineLength,Quality,QuantScale);
- DeringBlockStrong(pbi,SrcPtr + 8 * col, DestPtr + 8 * col,
+ DeringBlockStrong(SrcPtr + 8 * col, DestPtr + 8 * col,
LineLength,Quality,QuantScale);
- DeringBlockStrong(pbi,SrcPtr + 8 * col, DestPtr + 8 * col,
+ DeringBlockStrong(SrcPtr + 8 * col, DestPtr + 8 * col,
LineLength,Quality,QuantScale);
}else if(Variance > Thresh2 ){
- DeringBlockStrong(pbi,SrcPtr + 8 * col, DestPtr + 8 * col,
+ DeringBlockStrong(SrcPtr + 8 * col, DestPtr + 8 * col,
LineLength,Quality,QuantScale);
}else if(Variance > Thresh1 ){
- DeringBlockWeak(pbi,SrcPtr + 8 * col, DestPtr + 8 * col,
+ DeringBlockWeak(SrcPtr + 8 * col, DestPtr + 8 * col,
LineLength,Quality,QuantScale);
}else{
CopyBlock(SrcPtr + 8 * col, DestPtr + 8 * col, LineLength);
@@ -628,18 +551,18 @@
if( pbi->PostProcessingLevel >5 && Variance > Thresh4 ) {
- DeringBlockStrong(pbi,SrcPtr + 8 * col, DestPtr + 8 * col,
+ DeringBlockStrong(SrcPtr + 8 * col, DestPtr + 8 * col,
LineLength,Quality,QuantScale);
- DeringBlockStrong(pbi,SrcPtr + 8 * col, DestPtr + 8 * col,
+ DeringBlockStrong(SrcPtr + 8 * col, DestPtr + 8 * col,
LineLength,Quality,QuantScale);
- DeringBlockStrong(pbi,SrcPtr + 8 * col, DestPtr + 8 * col,
+ DeringBlockStrong(SrcPtr + 8 * col, DestPtr + 8 * col,
LineLength,Quality,QuantScale);
}else if(Variance > Thresh2 ){
- DeringBlockStrong(pbi,SrcPtr + 8 * col, DestPtr + 8 * col,
+ DeringBlockStrong(SrcPtr + 8 * col, DestPtr + 8 * col,
LineLength,Quality,QuantScale);
}else if(Variance > Thresh1 ){
- DeringBlockWeak(pbi,SrcPtr + 8 * col, DestPtr + 8 * col,
+ DeringBlockWeak(SrcPtr + 8 * col, DestPtr + 8 * col,
LineLength,Quality,QuantScale);
}else{
CopyBlock(SrcPtr + 8 * col, DestPtr + 8 * col, LineLength);
<p><p>1.2 +60 -5 theora/lib/quant.c
Index: quant.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/quant.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- quant.c 20 Sep 2002 09:30:32 -0000 1.1
+++ quant.c 20 Sep 2002 22:01:43 -0000 1.2
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: quant.c,v 1.1 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: quant.c,v 1.2 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -19,11 +19,67 @@
#include "encoder_internal.h"
#include "quant_lookup.h"
+static ogg_uint32_t QThreshTableV1[Q_TABLE_SIZE] = {
+ 500, 450, 400, 370, 340, 310, 285, 265,
+ 245, 225, 210, 195, 185, 180, 170, 160,
+ 150, 145, 135, 130, 125, 115, 110, 107,
+ 100, 96, 93, 89, 85, 82, 75, 74,
+ 70, 68, 64, 60, 57, 56, 52, 50,
+ 49, 45, 44, 43, 40, 38, 37, 35,
+ 33, 32, 30, 29, 28, 25, 24, 22,
+ 21, 19, 18, 17, 15, 13, 12, 10
+};
+
+static Q_LIST_ENTRY DcScaleFactorTableV1[ Q_TABLE_SIZE ] = {
+ 220, 200, 190, 180, 170, 170, 160, 160,
+ 150, 150, 140, 140, 130, 130, 120, 120,
+ 110, 110, 100, 100, 90, 90, 90, 80,
+ 80, 80, 70, 70, 70, 60, 60, 60,
+ 60, 50, 50, 50, 50, 40, 40, 40,
+ 40, 40, 30, 30, 30, 30, 30, 30,
+ 30, 20, 20, 20, 20, 20, 20, 20,
+ 20, 10, 10, 10, 10, 10, 10, 10
+};
+
+static Q_LIST_ENTRY Y_coeffsV1[64] ={
+ 16, 11, 10, 16, 24, 40, 51, 61,
+ 12, 12, 14, 19, 26, 58, 60, 55,
+ 14, 13, 16, 24, 40, 57, 69, 56,
+ 14, 17, 22, 29, 51, 87, 80, 62,
+ 18, 22, 37, 58, 68, 109, 103, 77,
+ 24, 35, 55, 64, 81, 104, 113, 92,
+ 49, 64, 78, 87, 103, 121, 120, 101,
+ 72, 92, 95, 98, 112, 100, 103, 99
+};
+
+static Q_LIST_ENTRY UV_coeffsV1[64] ={
+ 17, 18, 24, 47, 99, 99, 99, 99,
+ 18, 21, 26, 66, 99, 99, 99, 99,
+ 24, 26, 56, 99, 99, 99, 99, 99,
+ 47, 66, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99
+};
+
+/* Different matrices for different encoder versions */
+static Q_LIST_ENTRY Inter_coeffsV1[64] ={
+ 16, 16, 16, 20, 24, 28, 32, 40,
+ 16, 16, 20, 24, 28, 32, 40, 48,
+ 16, 20, 24, 28, 32, 40, 48, 64,
+ 20, 24, 28, 32, 40, 48, 64, 64,
+ 24, 28, 32, 40, 48, 64, 64, 64,
+ 28, 32, 40, 48, 64, 64, 64, 96,
+ 32, 40, 48, 64, 64, 64, 96, 128,
+ 40, 48, 64, 64, 64, 96, 128, 128
+};
+
void InitQTables( PB_INSTANCE *pbi ){
memcpy ( pbi->QThreshTable, QThreshTableV1, sizeof( pbi->QThreshTable ) );
}
-void BuildQuantIndex_Generic(PB_INSTANCE *pbi){
+static void BuildQuantIndex_Generic(PB_INSTANCE *pbi){
ogg_int32_t i,j;
/* invert the dequant index into the quant index */
@@ -33,7 +89,7 @@
}
}
-void init_quantizer ( CP_INSTANCE *cpi,
+static void init_quantizer ( CP_INSTANCE *cpi,
ogg_uint32_t scale_factor,
unsigned char QIndex ){
int i;
@@ -255,7 +311,6 @@
ogg_int16_t * DCT_blockPtr = DCT_block;
ogg_uint32_t * QIndexPtr = (ogg_uint32_t *)pbi->quant_index;
ogg_int32_t temp;
- int x = -7 >> 1;
/* Set the quantized_list to default to 0 */
memset( quantized_list, 0, 64 * sizeof(Q_LIST_ENTRY) );
@@ -373,7 +428,7 @@
}
}
-void init_dequantizer ( PB_INSTANCE *pbi,
+static void init_dequantizer ( PB_INSTANCE *pbi,
ogg_uint32_t scale_factor,
unsigned char QIndex ){
int i, j;
<p><p>1.2 +2 -70 theora/lib/quant_lookup.h
Index: quant_lookup.h
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/quant_lookup.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- quant_lookup.h 20 Sep 2002 09:30:32 -0000 1.1
+++ quant_lookup.h 20 Sep 2002 22:01:43 -0000 1.2
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: quant_lookup.h,v 1.1 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: quant_lookup.h,v 1.2 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -23,75 +23,6 @@
#define IDCT_SCALE_FACTOR 2 /* Shift left bits to improve IDCT precision */
#define OLD_SCHEME 1
-static ogg_uint32_t QThreshTableV1[Q_TABLE_SIZE] = {
- 500, 450, 400, 370, 340, 310, 285, 265,
- 245, 225, 210, 195, 185, 180, 170, 160,
- 150, 145, 135, 130, 125, 115, 110, 107,
- 100, 96, 93, 89, 85, 82, 75, 74,
- 70, 68, 64, 60, 57, 56, 52, 50,
- 49, 45, 44, 43, 40, 38, 37, 35,
- 33, 32, 30, 29, 28, 25, 24, 22,
- 21, 19, 18, 17, 15, 13, 12, 10
-};
-
-
-static Q_LIST_ENTRY DcScaleFactorTableV1[ Q_TABLE_SIZE ] = {
- 220, 200, 190, 180, 170, 170, 160, 160,
- 150, 150, 140, 140, 130, 130, 120, 120,
- 110, 110, 100, 100, 90, 90, 90, 80,
- 80, 80, 70, 70, 70, 60, 60, 60,
- 60, 50, 50, 50, 50, 40, 40, 40,
- 40, 40, 30, 30, 30, 30, 30, 30,
- 30, 20, 20, 20, 20, 20, 20, 20,
- 20, 10, 10, 10, 10, 10, 10, 10
-};
-
-static ogg_uint32_t DcQuantScaleV1[ Q_TABLE_SIZE ] = {
- 22, 20, 19, 18, 17, 17, 16, 16,
- 15, 15, 14, 14, 13, 13, 12, 12,
- 11, 11, 10, 10, 9, 9, 9, 8,
- 8, 8, 7, 7, 7, 6, 6, 6,
- 6, 5, 5, 5, 5, 4, 4, 4,
- 4, 4, 3, 3, 3, 3, 3, 3,
- 3, 2, 2, 2, 2, 2, 2, 2,
- 2, 1, 1, 1, 1, 1, 1, 1
-};
-
-
-static Q_LIST_ENTRY Y_coeffsV1[64] ={
- 16, 11, 10, 16, 24, 40, 51, 61,
- 12, 12, 14, 19, 26, 58, 60, 55,
- 14, 13, 16, 24, 40, 57, 69, 56,
- 14, 17, 22, 29, 51, 87, 80, 62,
- 18, 22, 37, 58, 68, 109, 103, 77,
- 24, 35, 55, 64, 81, 104, 113, 92,
- 49, 64, 78, 87, 103, 121, 120, 101,
- 72, 92, 95, 98, 112, 100, 103, 99
-};
-
-static Q_LIST_ENTRY UV_coeffsV1[64] ={
- 17, 18, 24, 47, 99, 99, 99, 99,
- 18, 21, 26, 66, 99, 99, 99, 99,
- 24, 26, 56, 99, 99, 99, 99, 99,
- 47, 66, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99
-};
-
-/* Different matrices for different encoder versions */
-static Q_LIST_ENTRY Inter_coeffsV1[64] ={
- 16, 16, 16, 20, 24, 28, 32, 40,
- 16, 16, 20, 24, 28, 32, 40, 48,
- 16, 20, 24, 28, 32, 40, 48, 64,
- 20, 24, 28, 32, 40, 48, 64, 64,
- 24, 28, 32, 40, 48, 64, 64, 64,
- 28, 32, 40, 48, 64, 64, 64, 96,
- 32, 40, 48, 64, 64, 64, 96, 128,
- 40, 48, 64, 64, 64, 96, 128, 128
-};
-
static ogg_uint32_t dequant_index[64] = {
0, 1, 8, 16, 9, 2, 3, 10,
17, 24, 32, 25, 18, 11, 4, 5,
@@ -102,4 +33,5 @@
58, 59, 52, 45, 38, 31, 39, 46,
53, 60, 61, 54, 47, 55, 62, 63
};
+
<p><p>1.2 +2 -2 theora/lib/reconstruct.c
Index: reconstruct.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/reconstruct.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- reconstruct.c 20 Sep 2002 09:30:32 -0000 1.1
+++ reconstruct.c 20 Sep 2002 22:01:43 -0000 1.2
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: reconstruct.c,v 1.1 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: reconstruct.c,v 1.2 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -19,7 +19,7 @@
#include "encoder_internal.h"
-void SatUnsigned8( unsigned char * ResultPtr, ogg_int16_t * DataBlock,
+static void SatUnsigned8( unsigned char * ResultPtr, ogg_int16_t * DataBlock,
ogg_uint32_t ResultLineStep, ogg_uint32_t DataLineStep ) {
int i;
<p><p>1.3 +4 -15 theora/lib/scan.c
Index: scan.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/scan.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- scan.c 20 Sep 2002 09:45:02 -0000 1.2
+++ scan.c 20 Sep 2002 22:01:43 -0000 1.3
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: scan.c,v 1.2 2002/09/20 09:45:02 xiphmont Exp $
+ last mod: $Id: scan.c,v 1.3 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -356,7 +356,6 @@
unsigned char *ExternalFragmentsPtr ) {
ogg_uint32_t i;
ogg_uint32_t HistoryBlocksAdded = 0;
- ogg_uint32_t KFScore = 0;
ogg_uint32_t YBand = (ppi->ScanYPlaneFragments/8); /* 1/8th of Y image. */
ppi->OutputBlocksUpdated = 0;
@@ -1016,7 +1015,6 @@
unsigned char RowType ){
unsigned char changed_locals = 0;
- unsigned char Score = 0;
unsigned char * PixelsChangedPtr0;
unsigned char * PixelsChangedPtr1;
unsigned char * PixelsChangedPtr2;
@@ -1790,16 +1788,10 @@
}
static void RowBarEnhBlockMap( PP_INSTANCE *ppi,
- ogg_uint32_t * FragScorePtr,
- signed char * FragSgcPtr,
signed char * UpdatedBlockMapPtr,
signed char * BarBlockMapPtr,
ogg_uint32_t RowNumber ){
- /* For boundary blocks relax thresholds */
- ogg_uint32_t BarBlockThresh = ppi->BlockThreshold / 10;
- ogg_uint32_t BarSGCThresh = ppi->BlockSgcThresh / 2;
-
- ogg_int32_t i;
+ int i;
/* Start by blanking the row in the bar block map structure. */
memset( BarBlockMapPtr, BLOCK_NOT_CODED, ppi->PlaneHFragments );
@@ -2270,8 +2262,7 @@
/* BAR algorithm */
if ( (RowNumber3 >= 0) && (RowNumber3 < ppi->PlaneVFragments) ){
ScoreFragIndex3 = (RowNumber3 * ppi->PlaneHFragments) + FragArrayOffset;
- RowBarEnhBlockMap(ppi, &ppi->FragScores[ScoreFragIndex3],
- &ppi->SameGreyDirPixels[ScoreFragIndex3],
+ RowBarEnhBlockMap(ppi,
&ppi->ScanDisplayFragments[ScoreFragIndex3],
&ppi->BarBlockMap[(RowNumber3 % 3) *
ppi->PlaneHFragments],
@@ -2295,9 +2286,7 @@
}
ogg_uint32_t YUVAnalyseFrame( PP_INSTANCE *ppi, ogg_uint32_t * KFIndicator ){
- ogg_uint32_t UpdatedYBlocks = 0;
- ogg_uint32_t UpdatedUVBlocks = 0;
-
+
/* Initialise the map arrays. */
InitScanMapArrays(ppi);
<p><p>1.5 +9 -26 theora/lib/toplevel.c
Index: toplevel.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/toplevel.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- toplevel.c 20 Sep 2002 09:30:32 -0000 1.4
+++ toplevel.c 20 Sep 2002 22:01:43 -0000 1.5
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: toplevel.c,v 1.4 2002/09/20 09:30:32 xiphmont Exp $
+ last mod: $Id: toplevel.c,v 1.5 2002/09/20 22:01:43 xiphmont Exp $
********************************************************************/
@@ -298,17 +298,8 @@
}
void UpdateFrame(CP_INSTANCE *cpi){
- ogg_int32_t AvKeyFrameFrequency =
- (ogg_int32_t) (cpi->CurrentFrame / cpi->KeyFrameCount);
- ogg_int32_t AvKeyFrameBytes =
- (ogg_int32_t) (cpi->TotKeyFrameBytes / cpi->KeyFrameCount);
- ogg_int32_t TotalWeight = 0;
double CorrectionFactor;
- ogg_uint32_t fragment_count = 0;
-
- ogg_uint32_t diff_tokens = 0;
- ogg_uint32_t bits_per_token = 0;
/* Reset the DC predictors. */
cpi->pb.LastIntraDC = 0;
@@ -476,9 +467,8 @@
cpi->FragmentLastQ[i] = cpi->pb.ThisFrameQualityValue;
/* Compress and output the frist frame. */
- PickIntra( cpi, cpi->pb.YSBRows, cpi->pb.YSBCols,
- cpi->pb.HFragments%4, cpi->pb.VFragments%4,
- cpi->pb.Configuration.VideoFrameWidth);
+ PickIntra( cpi,
+ cpi->pb.YSBRows, cpi->pb.YSBCols);
UpdateFrame(cpi);
/* Initialise the carry over rate targeting variables. */
@@ -489,12 +479,6 @@
static void CompressKeyFrame(CP_INSTANCE *cpi){
ogg_uint32_t i;
- /* Average key frame frequency and size */
- ogg_int32_t AvKeyFrameFrequency =
- (ogg_int32_t) (cpi->CurrentFrame / cpi->KeyFrameCount);
- ogg_int32_t AvKeyFrameBytes =
- (ogg_int32_t) (cpi->TotKeyFrameBytes / cpi->KeyFrameCount);
-
/* Before we compress reset the carry over to the actual frame carry over */
cpi->CarryOver = cpi->Configuration.TargetBandwidth * cpi->CurrentFrame /
cpi->Configuration.OutputFrameRate - cpi->TotalByteCount;
@@ -533,14 +517,13 @@
/* Compress and output the frist frame. */
- PickIntra( cpi, cpi->pb.YSBRows, cpi->pb.YSBCols,
- cpi->pb.HFragments%4, cpi->pb.VFragments%4,
- cpi->pb.Configuration.VideoFrameWidth);
+ PickIntra( cpi,
+ cpi->pb.YSBRows, cpi->pb.YSBCols);
UpdateFrame(cpi);
}
-static void CompressFrame( CP_INSTANCE *cpi, ogg_uint32_t FrameNumber ) {
+static void CompressFrame( CP_INSTANCE *cpi) {
ogg_int32_t min_blocks_per_frame;
ogg_uint32_t i;
int DropFrame = 0;
@@ -730,8 +713,8 @@
/* 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.HFragments%4,
- cpi->pb.VFragments%4, cpi->pb.Configuration.VideoFrameWidth,
+ PickModes( cpi, cpi->pb.YSBRows, cpi->pb.YSBCols,
+ cpi->pb.Configuration.VideoFrameWidth,
&InterError, &IntraError );
/* decide whether we really should have made this frame a key frame */
@@ -1010,7 +993,7 @@
cpi->ThisIsKeyFrame = 0;
} else {
/* Compress the frame. */
- CompressFrame( cpi, (unsigned int) cpi->CurrentFrame );
+ CompressFrame( cpi );
}
/* Update stats variables. */
<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