[xiph-cvs] cvs commit: theora/include/theora theora.h
Arc
arc at xiph.org
Wed Dec 3 00:59:47 PST 2003
arc 03/12/03 03:59:47
Modified: lib blockmap.c comment.c compglobals.c dct.c
dct_decode.c decode.c encode.c frarray.c frinit.c
huffman.c idct.c mcomp.c misc_common.c pb.c pp.c
quant.c reconstruct.c scan.c toplevel.c
block_inline.h encoder_internal.h encoder_lookup.h
hufftables.h mcomp.h quant_lookup.h
toplevel_lookup.h
include/theora theora.h
Log:
Added libogg2 support. The example encoder/player need libogg2 support
added to them as well, which isn't happening tonight since I can't get
them to compile.
I may go to hell for using #ifdef, but it's just temporary until support
for libogg1 is dropped. Set -DLIBOGG2 to compile for libogg2.
Revision Changes Path
1.5 +1 -2 theora/lib/blockmap.c
Index: blockmap.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/blockmap.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- blockmap.c 10 Jun 2003 01:31:33 -0000 1.4
+++ blockmap.c 3 Dec 2003 08:59:39 -0000 1.5
@@ -11,11 +11,10 @@
********************************************************************
function:
- last mod: $Id: blockmap.c,v 1.4 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: blockmap.c,v 1.5 2003/12/03 08:59:39 arc Exp $
********************************************************************/
-#include <ogg/ogg.h>
#include "encoder_internal.h"
static void CreateMapping ( ogg_int32_t (*BlockMap)[4][4],
<p><p>1.9 +1 -3 theora/lib/comment.c
Index: comment.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/comment.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- comment.c 27 Sep 2003 22:25:15 -0000 1.8
+++ comment.c 3 Dec 2003 08:59:39 -0000 1.9
@@ -11,15 +11,13 @@
********************************************************************
function: read/write and client interface for comment header packet
- last mod: $Id: comment.c,v 1.8 2003/09/27 22:25:15 tterribe Exp $
+ last mod: $Id: comment.c,v 1.9 2003/12/03 08:59:39 arc Exp $
********************************************************************/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#include <ogg/ogg.h>
-#include <theora/theora.h>
#include "encoder_internal.h"
void theora_comment_init(theora_comment *tc){
<p><p>1.4 +1 -2 theora/lib/compglobals.c
Index: compglobals.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/compglobals.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- compglobals.c 10 Jun 2003 01:31:33 -0000 1.3
+++ compglobals.c 3 Dec 2003 08:59:39 -0000 1.4
@@ -11,11 +11,10 @@
********************************************************************
function:
- last mod: $Id: compglobals.c,v 1.3 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: compglobals.c,v 1.4 2003/12/03 08:59:39 arc Exp $
********************************************************************/
-#include "ogg/ogg.h"
#include "encoder_internal.h"
/* the Roundup32 silliness is dangerous on non-Intel processors and
<p><p>1.6 +2 -2 theora/lib/dct.c
Index: dct.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/dct.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- dct.c 22 Jun 2003 18:14:00 -0000 1.5
+++ dct.c 3 Dec 2003 08:59:39 -0000 1.6
@@ -11,11 +11,11 @@
********************************************************************
function:
- last mod: $Id: dct.c,v 1.5 2003/06/22 18:14:00 giles Exp $
+ last mod: $Id: dct.c,v 1.6 2003/12/03 08:59:39 arc Exp $
********************************************************************/
-#include <ogg/ogg.h>
+#include "encoder_internal.h"
static ogg_int32_t xC1S7 = 64277;
static ogg_int32_t xC2S6 = 60547;
<p><p>1.9 +1 -2 theora/lib/dct_decode.c
Index: dct_decode.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/dct_decode.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- dct_decode.c 10 Nov 2003 02:46:21 -0000 1.8
+++ dct_decode.c 3 Dec 2003 08:59:39 -0000 1.9
@@ -11,13 +11,12 @@
********************************************************************
function:
- last mod: $Id: dct_decode.c,v 1.8 2003/11/10 02:46:21 giles Exp $
+ last mod: $Id: dct_decode.c,v 1.9 2003/12/03 08:59:39 arc Exp $
********************************************************************/
#include <stdlib.h>
#include <string.h>
-#include <ogg/ogg.h>
#include "encoder_internal.h"
<p><p>1.9 +55 -30 theora/lib/decode.c
Index: decode.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/decode.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- decode.c 6 Nov 2003 23:44:57 -0000 1.8
+++ decode.c 3 Dec 2003 08:59:39 -0000 1.9
@@ -11,12 +11,11 @@
********************************************************************
function:
- last mod: $Id: decode.c,v 1.8 2003/11/06 23:44:57 giles Exp $
+ last mod: $Id: decode.c,v 1.9 2003/12/03 08:59:39 arc Exp $
********************************************************************/
#include <string.h>
-#include <ogg/ogg.h>
#include "encoder_internal.h"
#include "block_inline.h"
@@ -61,23 +60,29 @@
}
static int LoadFrameHeader(PB_INSTANCE *pbi){
+ long ret;
unsigned char DctQMask;
unsigned char SpareBits; /* Spare cfg bits */
/* Is the frame and inter frame or a key frame */
- pbi->FrameType = (unsigned char)oggpackB_read(&pbi->opb,1);
+ theora_read(&pbi->opb,1,&ret);
+ pbi->FrameType = (unsigned char)ret;
/* Quality (Q) index */
- DctQMask = (unsigned char)oggpackB_read( &pbi->opb, 6 );
+ theora_read(&pbi->opb,6,&ret);
+ DctQMask = (unsigned char)ret;
/* spare bit for possible additional Q indicies - should be 0 */
- SpareBits = (unsigned char)oggpackB_read(&pbi->opb,1);
+ theora_read(&pbi->opb,1,&ret);
+ SpareBits = (unsigned char)ret;
if ( (pbi->FrameType == BASE_FRAME) ){
/* Read the type / coding method for the key frame. */
- pbi->KeyFrameType = (unsigned char)oggpackB_read( &pbi->opb, 1 );
+ theora_read(&pbi->opb,1,&ret);
+ pbi->KeyFrameType = (unsigned char)ret;
- SpareBits = (unsigned char)oggpackB_read( &pbi->opb, 2 );
+ theora_read(&pbi->opb,2,&ret);
+ SpareBits = (unsigned char)ret;
}
@@ -116,6 +121,7 @@
static void DecodeModes (PB_INSTANCE *pbi,
ogg_uint32_t SBRows,
ogg_uint32_t SBCols){
+ long ret;
ogg_int32_t FragIndex;
ogg_uint32_t MB;
ogg_uint32_t SBrow;
@@ -144,14 +150,15 @@
const CODING_MODE *ModeList;
/* Read the coding method */
- CodingScheme = oggpackB_read( &pbi->opb, MODE_METHOD_BITS );
+ theora_read(&pbi->opb, MODE_METHOD_BITS, &CodingScheme);
/* If the coding method is method 0 then we have to read in a
custom coding scheme */
if ( CodingScheme == 0 ){
/* Read the coding scheme. */
for ( i = 0; i < MAX_MODES; i++ ){
- CustomModeAlphabet[oggpackB_read(&pbi->opb, MODE_BITS)]=i;
+ theora_read(&pbi->opb, MODE_BITS, &ret);
+ CustomModeAlphabet[ret]=i;
}
ModeList=CustomModeAlphabet;
}
@@ -176,8 +183,8 @@
if ( CodingScheme == (MODE_METHODS-1) ){
/* This is the fall back coding scheme. */
/* Simply MODE_BITS bits per mode entry. */
- CodingMethod = (CODING_MODE)oggpackB_read( &pbi->opb,
- MODE_BITS );
+ theora_read(&pbi->opb, MODE_BITS, &ret);
+ CodingMethod = (CODING_MODE)ret;
}else{
ModeEntry = FrArrayUnpackMode(pbi);
CodingMethod = ModeList[ModeEntry];
@@ -213,12 +220,13 @@
}
static ogg_int32_t ExtractMVectorComponentA(PB_INSTANCE *pbi){
+ long ret;
ogg_int32_t MVectComponent;
ogg_uint32_t MVCode = 0;
ogg_uint32_t ExtraBits = 0;
/* Get group to which coded component belongs */
- MVCode = oggpackB_read( &pbi->opb, 3 );
+ theora_read(&pbi->opb, 3, &MVCode);
/* Now extract the appropriate number of bits to identify the component */
switch ( MVCode ){
@@ -232,33 +240,38 @@
MVectComponent = -1;
break;
case 3:
- if ( oggpackB_read( &pbi->opb, 1 ))
+ theora_read(&pbi->opb,1,&ret);
+ if (ret)
MVectComponent = -2;
else
MVectComponent = 2;
break;
case 4:
- if ( oggpackB_read( &pbi->opb, 1 ) )
+ theora_read(&pbi->opb,1,&ret);
+ if (ret)
MVectComponent = -3;
else
MVectComponent = 3;
break;
case 5:
- ExtraBits = oggpackB_read( &pbi->opb, 2 );
+ theora_read(&pbi->opb,2,&ExtraBits);
MVectComponent = 4 + ExtraBits;
- if ( oggpackB_read( &pbi->opb, 1 ) )
+ theora_read(&pbi->opb,1,&ret);
+ if (ret)
MVectComponent = -MVectComponent;
break;
case 6:
- ExtraBits = oggpackB_read( &pbi->opb, 3 );
+ theora_read(&pbi->opb,3,&ExtraBits);
MVectComponent = 8 + ExtraBits;
- if ( oggpackB_read( &pbi->opb, 1 ))
+ theora_read(&pbi->opb,1,&ret);
+ if (ret)
MVectComponent = -MVectComponent;
break;
case 7:
- ExtraBits = oggpackB_read( &pbi->opb, 4 );
+ theora_read(&pbi->opb,4,&ExtraBits);
MVectComponent = 16 + ExtraBits;
- if ( oggpackB_read( &pbi->opb, 1 ) )
+ theora_read(&pbi->opb,1,&ret);
+ if (ret)
MVectComponent = -MVectComponent;
break;
}
@@ -267,11 +280,13 @@
}
static ogg_int32_t ExtractMVectorComponentB(PB_INSTANCE *pbi){
+ long ret;
ogg_int32_t MVectComponent;
/* Get group to which coded component belongs */
- MVectComponent = oggpackB_read( &pbi->opb, 5 );
- if ( oggpackB_read( &pbi->opb, 1 ) )
+ theora_read(&pbi->opb,5,&MVectComponent);
+ theora_read(&pbi->opb,1,&ret);
+ if (ret)
MVectComponent = -MVectComponent;
return MVectComponent;
@@ -280,6 +295,7 @@
static void DecodeMVectors ( PB_INSTANCE *pbi,
ogg_uint32_t SBRows,
ogg_uint32_t SBCols ){
+ long ret;
ogg_int32_t FragIndex;
ogg_uint32_t MB;
ogg_uint32_t SBrow;
@@ -313,7 +329,8 @@
PriorLastInterMV.y = 0;
/* Read the entropy method used and set up the appropriate decode option */
- if ( oggpackB_read( &pbi->opb, 1) == 0 )
+ theora_read(&pbi->opb, 1, &ret);
+ if ( ret == 0 )
ExtractMVectorComponent = ExtractMVectorComponentA;
else
ExtractMVectorComponent = ExtractMVectorComponentB;
@@ -474,13 +491,15 @@
static ogg_uint32_t ExtractToken(oggpack_buffer *opb,
HUFF_ENTRY * CurrentRoot){
+ long ret;
ogg_uint32_t Token;
/* Loop searches down through tree based upon bits read from the
bitstream */
/* until it hits a leaf at which point we have decoded a token */
while ( CurrentRoot->Value < 0 ){
- if ( oggpackB_read(opb,1) )
+ theora_read(opb, 1, &ret);
+ if (ret)
CurrentRoot = CurrentRoot->OneChild;
else
CurrentRoot = CurrentRoot->ZeroChild;
@@ -504,7 +523,7 @@
*/
if ( pbi->ExtraBitLengths_VP3x[Token] > 0 ){
/* Extract the appropriate number of extra bits. */
- ExtraBits = oggpackB_read(&pbi->opb, pbi->ExtraBitLengths_VP3x[Token]);
+ theora_read(&pbi->opb,pbi->ExtraBitLengths_VP3x[Token], &ExtraBits);
}
@@ -567,7 +586,7 @@
*/
if ( pbi->ExtraBitLengths_VP3x[Token] > 0 ){
/* Extract the appropriate number of extra bits. */
- ExtraBits = oggpackB_read(&pbi->opb,pbi->ExtraBitLengths_VP3x[Token]);
+ theora_read(&pbi->opb,pbi->ExtraBitLengths_VP3x[Token], &ExtraBits);
}
/* Take token dependant action */
@@ -617,6 +636,7 @@
}
static void UnPackVideo (PB_INSTANCE *pbi){
+ long ret;
ogg_int32_t EncodedCoeffs = 1;
ogg_int32_t FragIndex;
ogg_int32_t * CodedBlockListPtr;
@@ -646,8 +666,10 @@
pbi->BlocksToDecode = pbi->CodedBlockIndex;
/* Get the DC huffman table choice for Y and then UV */
- DcHuffChoice1 = oggpackB_read( &pbi->opb, DC_HUFF_CHOICE_BITS ) + DC_HUFF_OFFSET;
- DcHuffChoice2 = oggpackB_read( &pbi->opb, DC_HUFF_CHOICE_BITS ) + DC_HUFF_OFFSET;
+ theora_read(&pbi->opb,DC_HUFF_CHOICE_BITS,&ret);
+ DcHuffChoice1 = ret + DC_HUFF_OFFSET;
+ theora_read(&pbi->opb,DC_HUFF_CHOICE_BITS,&ret);
+ DcHuffChoice2 = ret + DC_HUFF_OFFSET;
/* UnPack DC coefficients / tokens */
CodedBlockListPtr = pbi->CodedBlockList;
@@ -681,8 +703,11 @@
}
/* Get the AC huffman table choice for Y and then for UV. */
- AcHuffIndex1 = oggpackB_read( &pbi->opb, AC_HUFF_CHOICE_BITS ) + AC_HUFF_OFFSET;
- AcHuffIndex2 = oggpackB_read( &pbi->opb, AC_HUFF_CHOICE_BITS ) + AC_HUFF_OFFSET;
+
+ theora_read(&pbi->opb,AC_HUFF_CHOICE_BITS,&ret);
+ AcHuffIndex1 = ret + AC_HUFF_OFFSET;
+ theora_read(&pbi->opb,AC_HUFF_CHOICE_BITS,&ret);
+ AcHuffIndex2 = ret + AC_HUFF_OFFSET;
/* Unpack Lower AC coefficients. */
while ( EncodedCoeffs < 64 ) {
<p><p>1.15 +1 -2 theora/lib/encode.c
Index: encode.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/encode.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- encode.c 6 Nov 2003 23:44:57 -0000 1.14
+++ encode.c 3 Dec 2003 08:59:40 -0000 1.15
@@ -11,13 +11,12 @@
********************************************************************
function:
- last mod: $Id: encode.c,v 1.14 2003/11/06 23:44:57 giles Exp $
+ last mod: $Id: encode.c,v 1.15 2003/12/03 08:59:40 arc Exp $
********************************************************************/
#include <stdlib.h>
#include <string.h>
-#include <ogg/ogg.h>
#include "encoder_internal.h"
#include "encoder_lookup.h"
#include "block_inline.h"
<p><p>1.7 +38 -19 theora/lib/frarray.c
Index: frarray.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/frarray.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- frarray.c 10 Jun 2003 01:31:33 -0000 1.6
+++ frarray.c 3 Dec 2003 08:59:41 -0000 1.7
@@ -11,12 +11,11 @@
********************************************************************
function:
- last mod: $Id: frarray.c,v 1.6 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: frarray.c,v 1.7 2003/12/03 08:59:41 arc Exp $
********************************************************************/
#include <string.h>
-#include <ogg/ogg.h>
#include "encoder_internal.h"
#include "block_inline.h"
@@ -378,23 +377,29 @@
}
static void GetNextBInit(PB_INSTANCE *pbi){
- pbi->NextBit = (unsigned char)oggpackB_read(&pbi->opb,1);
+ long ret;
+
+ theora_read(&pbi->opb,1,&ret);
+ pbi->NextBit = (unsigned char)ret;
/* Read run length */
FrArrayDeCodeInit(pbi);
- while ( FrArrayDeCodeBlockRun( pbi, oggpackB_read(&pbi->opb,1),
- &pbi->BitsLeft ) == 0 );
+ do if (theora_read(&pbi->opb,1,&ret)<=0) break;
+ while (FrArrayDeCodeBlockRun(pbi,ret,&pbi->BitsLeft)==0);
+
}
static unsigned char GetNextBBit (PB_INSTANCE *pbi){
+ long ret;
if ( !pbi->BitsLeft ){
/* Toggle the value. */
pbi->NextBit = ( pbi->NextBit == 1 ) ? 0 : 1;
/* Read next run */
FrArrayDeCodeInit(pbi);
- while ( FrArrayDeCodeBlockRun( pbi,oggpackB_read(&pbi->opb,1),
- &pbi->BitsLeft ) == 0 );
+ do if (theora_read(&pbi->opb,1,&ret)<=0) break;
+ while (FrArrayDeCodeBlockRun(pbi,ret,&pbi->BitsLeft)==0);
+
}
/* Have read a bit */
@@ -405,23 +410,30 @@
}
static void GetNextSbInit(PB_INSTANCE *pbi){
- pbi->NextBit = (unsigned char)oggpackB_read(&pbi->opb,1);
+ long ret;
+
+ theora_read(&pbi->opb,1,&ret);
+ pbi->NextBit = (unsigned char)ret;
/* Read run length */
FrArrayDeCodeInit(pbi);
- while ( FrArrayDeCodeSBRun( pbi,oggpackB_read(&pbi->opb,1),
- &pbi->BitsLeft ) == 0 );
+ do if (theora_read(&pbi->opb,1,&ret)<=0) break;
+ while (FrArrayDeCodeBlockRun(pbi,ret,&pbi->BitsLeft)==0);
+
}
static unsigned char GetNextSbBit (PB_INSTANCE *pbi){
+ long ret;
+
if ( !pbi->BitsLeft ){
/* Toggle the value. */
pbi->NextBit = ( pbi->NextBit == 1 ) ? 0 : 1;
/* Read next run */
FrArrayDeCodeInit(pbi);
- while ( FrArrayDeCodeSBRun( pbi, oggpackB_read(&pbi->opb,1),
- &pbi->BitsLeft ) == 0 );
+ do if (theora_read(&pbi->opb,1,&ret)<=0) break;
+ while (FrArrayDeCodeBlockRun(pbi,ret,&pbi->BitsLeft)==0);
+
}
/* Have read a bit */
@@ -531,6 +543,7 @@
}
CODING_MODE FrArrayUnpackMode(PB_INSTANCE *pbi){
+ long ret;
/* Coding scheme:
Token Codeword Bits
Entry 0 (most frequent) 0 1
@@ -547,44 +560,50 @@
pbi->bit_pattern = 0;
pbi->bits_so_far = 0;
- pbi->bit_pattern = oggpackB_read(&pbi->opb,1);
+ theora_read(&pbi->opb,1,&pbi->bit_pattern);
/* Do we have a match */
if ( pbi->bit_pattern == 0 )
return (CODING_MODE)0;
/* Get the next bit */
- pbi->bit_pattern = (pbi->bit_pattern << 1) | oggpackB_read(&pbi->opb,1);
+ theora_read(&pbi->opb,1,&ret);
+ pbi->bit_pattern = (pbi->bit_pattern << 1) | ret;
/* Do we have a match */
if ( pbi->bit_pattern == 0x0002 )
return (CODING_MODE)1;
- pbi->bit_pattern = (pbi->bit_pattern << 1) | oggpackB_read(&pbi->opb,1);
+ theora_read(&pbi->opb,1,&ret);
+ pbi->bit_pattern = (pbi->bit_pattern << 1) | ret;
/* Do we have a match */
if ( pbi->bit_pattern == 0x0006 )
return (CODING_MODE)2;
- pbi->bit_pattern = (pbi->bit_pattern << 1) | oggpackB_read(&pbi->opb,1);
+ theora_read(&pbi->opb,1,&ret);
+ pbi->bit_pattern = (pbi->bit_pattern << 1) | ret;
/* Do we have a match */
if ( pbi->bit_pattern == 0x000E )
return (CODING_MODE)3;
- pbi->bit_pattern = (pbi->bit_pattern << 1) | oggpackB_read(&pbi->opb,1);
+ theora_read(&pbi->opb,1,&ret);
+ pbi->bit_pattern = (pbi->bit_pattern << 1) | ret;
/* Do we have a match */
if ( pbi->bit_pattern == 0x001E )
return (CODING_MODE)4;
- pbi->bit_pattern = (pbi->bit_pattern << 1) | oggpackB_read(&pbi->opb,1);
+ theora_read(&pbi->opb,1,&ret);
+ pbi->bit_pattern = (pbi->bit_pattern << 1) | ret;
/* Do we have a match */
if ( pbi->bit_pattern == 0x003E )
return (CODING_MODE)5;
- pbi->bit_pattern = (pbi->bit_pattern << 1) | oggpackB_read(&pbi->opb,1);
+ theora_read(&pbi->opb,1,&ret);
+ pbi->bit_pattern = (pbi->bit_pattern << 1) | ret;
/* Do we have a match */
if ( pbi->bit_pattern == 0x007E )
<p><p>1.8 +1 -2 theora/lib/frinit.c
Index: frinit.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/frinit.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- frinit.c 10 Jun 2003 01:31:33 -0000 1.7
+++ frinit.c 3 Dec 2003 08:59:41 -0000 1.8
@@ -11,12 +11,11 @@
********************************************************************
function:
- last mod: $Id: frinit.c,v 1.7 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: frinit.c,v 1.8 2003/12/03 08:59:41 arc Exp $
********************************************************************/
#include <stdlib.h>
-#include <ogg/ogg.h>
#include "encoder_internal.h"
<p><p>1.11 +3 -4 theora/lib/huffman.c
Index: huffman.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/huffman.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- huffman.c 26 Oct 2003 21:48:11 -0000 1.10
+++ huffman.c 3 Dec 2003 08:59:41 -0000 1.11
@@ -11,13 +11,12 @@
********************************************************************
function:
- last mod: $Id: huffman.c,v 1.10 2003/10/26 21:48:11 giles Exp $
+ last mod: $Id: huffman.c,v 1.11 2003/12/03 08:59:41 arc Exp $
********************************************************************/
#include <stdlib.h>
#include <stdio.h>
-#include <ogg/ogg.h>
#include "encoder_internal.h"
#include "hufftables.h"
@@ -226,7 +225,7 @@
static int ReadHuffTree(HUFF_ENTRY * HuffRoot, int depth,
oggpack_buffer *opb) {
long bit;
- bit = oggpackB_read(opb, 1);
+ theora_read(opb,1,&bit);
if(bit < 0) return OC_BADHEADER;
else if(!bit) {
int ret;
@@ -241,7 +240,7 @@
} else {
HuffRoot->ZeroChild = NULL;
HuffRoot->OneChild = NULL;
- HuffRoot->Value = oggpackB_read(opb, 5);
+ theora_read(opb,5,&HuffRoot->Value);
if (HuffRoot->Value < 0) return OC_BADHEADER;
}
return 0;
<p><p>1.6 +1 -2 theora/lib/idct.c
Index: idct.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/idct.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- idct.c 10 Jun 2003 01:31:33 -0000 1.5
+++ idct.c 3 Dec 2003 08:59:41 -0000 1.6
@@ -11,12 +11,11 @@
********************************************************************
function:
- last mod: $Id: idct.c,v 1.5 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: idct.c,v 1.6 2003/12/03 08:59:41 arc Exp $
********************************************************************/
#include <string.h>
-#include <ogg/ogg.h>
#include "encoder_internal.h"
#include "quant_lookup.h"
<p><p>1.8 +1 -2 theora/lib/mcomp.c
Index: mcomp.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/mcomp.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- mcomp.c 10 Jun 2003 01:31:33 -0000 1.7
+++ mcomp.c 3 Dec 2003 08:59:41 -0000 1.8
@@ -11,13 +11,12 @@
********************************************************************
function:
- last mod: $Id: mcomp.c,v 1.7 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: mcomp.c,v 1.8 2003/12/03 08:59:41 arc Exp $
********************************************************************/
#include <stdlib.h>
#include <stdio.h>
-#include <ogg/ogg.h>
#include "encoder_internal.h"
/* Initialises motion compentsation. */
<p><p>1.10 +1 -2 theora/lib/misc_common.c
Index: misc_common.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/misc_common.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- misc_common.c 10 Jun 2003 01:31:33 -0000 1.9
+++ misc_common.c 3 Dec 2003 08:59:41 -0000 1.10
@@ -11,12 +11,11 @@
********************************************************************
function:
- last mod: $Id: misc_common.c,v 1.9 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: misc_common.c,v 1.10 2003/12/03 08:59:41 arc Exp $
********************************************************************/
#include <string.h>
-#include <ogg/ogg.h>
#include "encoder_internal.h"
#include "block_inline.h"
<p><p>1.6 +1 -2 theora/lib/pb.c
Index: pb.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/pb.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- pb.c 10 Jun 2003 01:31:33 -0000 1.5
+++ pb.c 3 Dec 2003 08:59:41 -0000 1.6
@@ -11,13 +11,12 @@
********************************************************************
function:
- last mod: $Id: pb.c,v 1.5 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: pb.c,v 1.6 2003/12/03 08:59:41 arc Exp $
********************************************************************/
#include <stdlib.h>
#include <string.h>
-#include <ogg/ogg.h>
#include "encoder_internal.h"
void ClearTmpBuffers(PB_INSTANCE * pbi){
<p><p>1.9 +1 -2 theora/lib/pp.c
Index: pp.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/pp.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- pp.c 10 Jun 2003 01:31:33 -0000 1.8
+++ pp.c 3 Dec 2003 08:59:41 -0000 1.9
@@ -11,13 +11,12 @@
********************************************************************
function:
- last mod: $Id: pp.c,v 1.8 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: pp.c,v 1.9 2003/12/03 08:59:41 arc Exp $
********************************************************************/
#include <stdlib.h>
#include <string.h>
-#include <ogg/ogg.h>
#include "encoder_internal.h"
#include "pp.h"
<p><p>1.10 +6 -7 theora/lib/quant.c
Index: quant.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/quant.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- quant.c 10 Jun 2003 01:31:33 -0000 1.9
+++ quant.c 3 Dec 2003 08:59:41 -0000 1.10
@@ -11,12 +11,11 @@
********************************************************************
function:
- last mod: $Id: quant.c,v 1.9 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: quant.c,v 1.10 2003/12/03 08:59:41 arc Exp $
********************************************************************/
#include <string.h>
-#include <ogg/ogg.h>
#include "encoder_internal.h"
#include "quant_lookup.h"
@@ -143,27 +142,27 @@
long bits;
int x;
for(x=0; x<Q_TABLE_SIZE; x++) {
- bits=oggpackB_read(opb, 16);
+ theora_read(opb,16,&bits);
if(bits<0)return OC_BADHEADER;
ci->QThreshTable[x]=bits;
}
for(x=0; x<Q_TABLE_SIZE; x++) {
- bits=oggpackB_read(opb, 16);
+ theora_read(opb,16,&bits);
if(bits<0)return OC_BADHEADER;
ci->DcScaleFactorTable[x]=(Q_LIST_ENTRY)bits;
}
for(x=0; x<64; x++) {
- bits=oggpackB_read(opb, 8);
+ theora_read(opb,8,&bits);
if(bits<0)return OC_BADHEADER;
ci->Y_coeffs[x]=(Q_LIST_ENTRY)bits;
}
for(x=0; x<64; x++) {
- bits=oggpackB_read(opb, 8);
+ theora_read(opb,8,&bits);
if(bits<0)return OC_BADHEADER;
ci->UV_coeffs[x]=(Q_LIST_ENTRY)bits;
}
for(x=0; x<64; x++) {
- bits=oggpackB_read(opb, 8);
+ theora_read(opb,8,&bits);
if(bits<0)return OC_BADHEADER;
ci->Inter_coeffs[x]=(Q_LIST_ENTRY)bits;
}
<p><p>1.6 +1 -2 theora/lib/reconstruct.c
Index: reconstruct.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/reconstruct.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- reconstruct.c 10 Jun 2003 01:31:33 -0000 1.5
+++ reconstruct.c 3 Dec 2003 08:59:41 -0000 1.6
@@ -11,11 +11,10 @@
********************************************************************
function:
- last mod: $Id: reconstruct.c,v 1.5 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: reconstruct.c,v 1.6 2003/12/03 08:59:41 arc Exp $
********************************************************************/
-#include <ogg/ogg.h>
#include "encoder_internal.h"
void ReconIntra( PB_INSTANCE *pbi, unsigned char * ReconPtr,
<p><p>1.9 +1 -2 theora/lib/scan.c
Index: scan.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/scan.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- scan.c 31 Oct 2003 14:25:51 -0000 1.8
+++ scan.c 3 Dec 2003 08:59:41 -0000 1.9
@@ -11,14 +11,13 @@
********************************************************************
function:
- last mod: $Id: scan.c,v 1.8 2003/10/31 14:25:51 giles Exp $
+ last mod: $Id: scan.c,v 1.9 2003/12/03 08:59:41 arc Exp $
********************************************************************/
#include <stdlib.h>
#include <math.h>
#include <string.h>
-#include <ogg/ogg.h>
#include "encoder_internal.h"
#define MAX_SEARCH_LINE_LEN 7
<p><p>1.34 +79 -31 theora/lib/toplevel.c
Index: toplevel.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/toplevel.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- toplevel.c 31 Oct 2003 13:53:49 -0000 1.33
+++ toplevel.c 3 Dec 2003 08:59:42 -0000 1.34
@@ -11,14 +11,12 @@
********************************************************************
function:
- last mod: $Id: toplevel.c,v 1.33 2003/10/31 13:53:49 giles Exp $
+ last mod: $Id: toplevel.c,v 1.34 2003/12/03 08:59:42 arc Exp $
********************************************************************/
#include <stdlib.h>
#include <string.h>
-#include <ogg/ogg.h>
-#include <theora/theora.h>
#include "encoder_internal.h"
#include "toplevel_lookup.h"
@@ -850,8 +848,11 @@
cpi->QTargetModifier[i] = 1.0;
/* Set up an encode buffer */
+#ifndef LIBOGG2
oggpackB_writeinit(&cpi->oggbuffer);
-
+#else
+ oggpackB_writeinit(&cpi->oggbuffer, ogg_buffer_create());
+#endif
/* Set data rate related variables. */
cpi->Configuration.TargetBandwidth = (c->target_bitrate) / 8;
@@ -998,7 +999,11 @@
if(!cpi->packetflag)return(0);
if(cpi->doneflag)return(-1);
+#ifndef LIBOGG2
op->packet=oggpackB_get_buffer(&cpi->oggbuffer);
+#else
+ op->packet=oggpackB_writebuffer(&cpi->oggbuffer);
+#endif
op->bytes=bytes;
op->b_o_s=0;
op->e_o_s=last_p;
@@ -1060,7 +1065,11 @@
oggpackB_write(&cpi->oggbuffer,0,5); /* spare config bits */
+#ifndef LIBOGG2
op->packet=oggpackB_get_buffer(&cpi->oggbuffer);
+#else
+ op->packet=oggpackB_writebuffer(&cpi->oggbuffer);
+#endif
op->bytes=oggpackB_bytes(&cpi->oggbuffer);
op->b_o_s=1;
@@ -1103,7 +1112,12 @@
{
int bytes=oggpack_bytes(&opb);
op->packet=malloc(bytes);
+#ifndef LIBOGG2
memcpy(op->packet, oggpack_get_buffer(&opb), bytes);
+#else
+ /* I don't know why memcpy is used above, but it wont work here */
+ op->packet = oggpack_writebuffer(&opb);
+#endif
op->bytes=bytes;
}
oggpack_writeclear(&opb);
@@ -1197,34 +1211,57 @@
static int _theora_unpack_info(theora_info *ci, oggpack_buffer *opb){
long ret;
- ci->version_major=(unsigned char)oggpackB_read(opb,8);
- ci->version_minor=(unsigned char)oggpackB_read(opb,8);
- ci->version_subminor=(unsigned char)oggpackB_read(opb,8);
+ theora_read(opb,8,&ret);
+ ci->version_major=(unsigned char)ret;
+ theora_read(opb,8,&ret);
+ ci->version_minor=(unsigned char)ret;
+ theora_read(opb,8,&ret);
+ ci->version_subminor=(unsigned char)ret;
if(ci->version_major!=VERSION_MAJOR)return(OC_VERSION);
if(ci->version_minor>VERSION_MINOR)return(OC_VERSION);
- ci->width=oggpackB_read(opb,16)<<4;
- ci->height=oggpackB_read(opb,16)<<4;
- ci->frame_width=oggpackB_read(opb,24);
- ci->frame_height=oggpackB_read(opb,24);
- ci->offset_x=oggpackB_read(opb,8);
- ci->offset_y=oggpackB_read(opb,8);
-
- ci->fps_numerator=oggpackB_read(opb,32);
- ci->fps_denominator=oggpackB_read(opb,32);
- ci->aspect_numerator=oggpackB_read(opb,24);
- ci->aspect_denominator=oggpackB_read(opb,24);
-
- ci->colorspace=oggpackB_read(opb,8);
- ci->target_bitrate=oggpackB_read(opb,24);
- ci->quality=ret=oggpackB_read(opb,6);
-
- ci->keyframe_frequency_force=1<<oggpackB_read(opb,5);
-
- ret=oggpackB_read(opb,5); /* spare configuration bits */
-
- if(ret==-1L)return(OC_BADHEADER);
+ theora_read(opb,16,&ret);
+ ci->width=ret<<4;
+ theora_read(opb,16,&ret);
+ ci->height=ret<<4;
+ theora_read(opb,24,&ret);
+ ci->frame_width=ret;
+ theora_read(opb,24,&ret);
+ ci->frame_height=ret;
+ theora_read(opb,8,&ret);
+ ci->offset_x=ret;
+ theora_read(opb,8,&ret);
+ ci->offset_y=ret;
+
+ theora_read(opb,32,&ret);
+ ci->fps_numerator=ret;
+ theora_read(opb,32,&ret);
+ ci->fps_denominator=ret;
+ theora_read(opb,24,&ret);
+ ci->aspect_numerator=ret;
+ theora_read(opb,24,&ret);
+ ci->aspect_denominator=ret;
+
+ theora_read(opb,8,&ret);
+ ci->colorspace=ret;
+ theora_read(opb,24,&ret);
+ ci->target_bitrate=ret;
+ theora_read(opb,6,&ret);
+ ci->quality=ret=ret;
+
+ theora_read(opb,5,&ret);
+ ci->keyframe_frequency_force=1<<ret;
+
+ /* spare configuration bits */
+ /* This has to be #ifdef for now since it needs to know if the packet
+ has terminated early, and this is the only place this is needed. */
+#ifndef LIBOGG2
+ if ( oggpackB_read(opb,5) < 0 )
+#else
+ if ( oggpackB_read(opb,5,&ret) < 5 )
+#endif
+ return (OC_BADHEADER);
return(0);
}
@@ -1271,12 +1308,16 @@
oggpack_buffer opb;
if(!op)return OC_BADHEADER;
+#ifndef LIBOGG2
oggpackB_readinit(&opb,op->packet,op->bytes);
-
+#else
+ oggpackB_readinit(&opb,op->packet);
+#endif
{
char id[6];
- int typeflag=oggpackB_read(&opb,8);
+ int typeflag;
+ theora_read(&opb,8,&typeflag);
if(!(typeflag&0x80))return(OC_NOTFORMAT);
_tp_readbuffer(&opb,id,6);
@@ -1362,10 +1403,17 @@
PB_INSTANCE *pbi=(PB_INSTANCE *)(th->internal_decode);
pbi->DecoderErrorCode = 0;
+
+#ifndef LIBOGG2
oggpackB_readinit(&pbi->opb,op->packet,op->bytes);
+#else
+ oggpackB_readinit(&pbi->opb,op->packet);
+#endif
/* verify that this is a video frame */
- if(oggpackB_read(&pbi->opb,1)==0){
+ theora_read(&pbi->opb,1,&ret);
+
+ if (ret==0) {
ret=LoadAndDecode(pbi);
if(ret)return ret;
<p><p>1.6 +3 -1 theora/lib/block_inline.h
Index: block_inline.h
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/block_inline.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- block_inline.h 10 Jun 2003 01:31:33 -0000 1.5
+++ block_inline.h 3 Dec 2003 08:59:42 -0000 1.6
@@ -11,10 +11,12 @@
********************************************************************
function:
- last mod: $Id: block_inline.h,v 1.5 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: block_inline.h,v 1.6 2003/12/03 08:59:42 arc Exp $
********************************************************************/
+#include "encoder_internal.h"
+
static ogg_int32_t MBOrderMap[4] = { 0, 2, 3, 1 };
static ogg_int32_t BlockOrderMap1[4][4] = {
{ 0, 1, 3, 2 },
<p><p>1.16 +12 -3 theora/lib/encoder_internal.h
Index: encoder_internal.h
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/encoder_internal.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- encoder_internal.h 29 Sep 2003 14:36:44 -0000 1.15
+++ encoder_internal.h 3 Dec 2003 08:59:42 -0000 1.16
@@ -11,13 +11,21 @@
********************************************************************
function:
- last mod: $Id: encoder_internal.h,v 1.15 2003/09/29 14:36:44 giles Exp $
+ last mod: $Id: encoder_internal.h,v 1.16 2003/12/03 08:59:42 arc Exp $
********************************************************************/
-#include <ogg/ogg.h>
+#ifndef ENCODER_INTERNAL_H
+#define ENCODER_INTERNAL_H
+
+#include <theora/theora.h>
#include "huffman.h"
-#include "theora/theora.h"
+
+#ifndef LIBOGG2
+#define theora_read(x,y,z) ( *z = oggpackB_read(x,y) )
+#else
+#define theora_read(x,y,z) ( oggpackB_read(x,y,z) )
+#endif
#define CURRENT_ENCODE_VERSION 1
#define HUGE_ERROR (1<<28) /* Out of range test value */
@@ -786,3 +794,4 @@
extern void ScanYUVInit( PP_INSTANCE * ppi,
SCAN_CONFIG_DATA * ScanConfigPtr);
extern int LoadAndDecode(PB_INSTANCE *pbi);
+#endif
<p><p>1.8 +3 -1 theora/lib/encoder_lookup.h
Index: encoder_lookup.h
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/encoder_lookup.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- encoder_lookup.h 11 Jun 2003 02:24:29 -0000 1.7
+++ encoder_lookup.h 3 Dec 2003 08:59:42 -0000 1.8
@@ -11,10 +11,12 @@
********************************************************************
function: simple static lookups for VP3 frame encoder
- last mod: $Id: encoder_lookup.h,v 1.7 2003/06/11 02:24:29 tterribe Exp $
+ last mod: $Id: encoder_lookup.h,v 1.8 2003/12/03 08:59:42 arc Exp $
********************************************************************/
+#include "encoder_internal.h"
+
ogg_uint32_t MvPattern[(MAX_MV_EXTENT * 2) + 1] = {
0x000000ff, 0x000000fd, 0x000000fb, 0x000000f9,
0x000000f7, 0x000000f5, 0x000000f3, 0x000000f1,
<p><p>1.6 +2 -1 theora/lib/hufftables.h
Index: hufftables.h
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/hufftables.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- hufftables.h 10 Jun 2003 01:31:33 -0000 1.5
+++ hufftables.h 3 Dec 2003 08:59:42 -0000 1.6
@@ -11,11 +11,12 @@
********************************************************************
function:
- last mod: $Id: hufftables.h,v 1.5 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: hufftables.h,v 1.6 2003/12/03 08:59:42 arc Exp $
********************************************************************/
#include "huffman.h"
+#include "encoder_internal.h"
unsigned char ExtraBitLengths_VP31[MAX_ENTROPY_TOKENS] = {
0, 0, 0, 2, 3, 4, 12,3, 6, /* EOB and Zero-run tokens. */
<p><p>1.4 +3 -1 theora/lib/mcomp.h
Index: mcomp.h
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/mcomp.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- mcomp.h 10 Jun 2003 01:31:33 -0000 1.3
+++ mcomp.h 3 Dec 2003 08:59:43 -0000 1.4
@@ -11,10 +11,12 @@
********************************************************************
function: simple static lookups for VP3 codec
- last mod: $Id: mcomp.h,v 1.3 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: mcomp.h,v 1.4 2003/12/03 08:59:43 arc Exp $
********************************************************************/
+#include "encoder_internal.h"
+
ogg_int32_t XX_LUT[511]={
65025, 64516, 64009, 63504, 63001, 62500, 62001, 61504,
61009, 60516, 60025, 59536, 59049, 58564, 58081, 57600,
<p><p>1.5 +3 -1 theora/lib/quant_lookup.h
Index: quant_lookup.h
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/quant_lookup.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- quant_lookup.h 10 Jun 2003 01:31:33 -0000 1.4
+++ quant_lookup.h 3 Dec 2003 08:59:43 -0000 1.5
@@ -11,10 +11,12 @@
********************************************************************
function:
- last mod: $Id: quant_lookup.h,v 1.4 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: quant_lookup.h,v 1.5 2003/12/03 08:59:43 arc Exp $
********************************************************************/
+#include "encoder_internal.h"
+
#define MIN16 ((1<<16)-1)
#define SHIFT16 (1<<16)
<p><p>1.4 +3 -1 theora/lib/toplevel_lookup.h
Index: toplevel_lookup.h
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/toplevel_lookup.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- toplevel_lookup.h 10 Jun 2003 01:31:33 -0000 1.3
+++ toplevel_lookup.h 3 Dec 2003 08:59:43 -0000 1.4
@@ -11,10 +11,12 @@
********************************************************************
function:
- last mod: $Id: toplevel_lookup.h,v 1.3 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: toplevel_lookup.h,v 1.4 2003/12/03 08:59:43 arc Exp $
********************************************************************/
+#include "encoder_internal.h"
+
ogg_uint32_t PriorKeyFrameWeight[KEY_FRAME_CONTEXT] = { 1,2,3,4,5 };
/* Data structures controlling addition of residue blocks */
<p><p>1.16 +5 -1 theora/include/theora/theora.h
Index: theora.h
===================================================================
RCS file: /usr/local/cvsroot/theora/include/theora/theora.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- theora.h 21 Oct 2003 22:06:29 -0000 1.15
+++ theora.h 3 Dec 2003 08:59:47 -0000 1.16
@@ -11,14 +11,18 @@
********************************************************************
function:
- last mod: $Id: theora.h,v 1.15 2003/10/21 22:06:29 giles Exp $
+ last mod: $Id: theora.h,v 1.16 2003/12/03 08:59:47 arc Exp $
********************************************************************/
#ifndef _O_THEORA_H_
#define _O_THEORA_H_
+#ifndef LIBOGG2
#include <ogg/ogg.h>
+#else
+#include <ogg2/ogg.h>
+#endif
typedef struct {
int y_width;
<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