[xiph-cvs] cvs commit: theora/lib decode.c
Timothy Terriberry
tterribe at xiph.org
Wed Jun 18 16:01:27 PDT 2003
tterribe 03/06/18 19:01:27
Modified: lib decode.c
Log:
Cleaned up the mode coding to not use global variables when decoding a custom alphabet.
This allows this portion of the code to be re-entrant.
Revision Changes Path
1.6 +11 -11 theora/lib/decode.c
Index: decode.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/decode.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- decode.c 10 Jun 2003 01:31:33 -0000 1.5
+++ decode.c 18 Jun 2003 23:01:27 -0000 1.6
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: decode.c,v 1.5 2003/06/10 01:31:33 tterribe Exp $
+ last mod: $Id: decode.c,v 1.6 2003/06/18 23:01:27 tterribe Exp $
********************************************************************/
@@ -20,13 +20,7 @@
#include "encoder_internal.h"
#include "block_inline.h"
-CODING_MODE ModeAlphabet[MODE_METHODS-1][MAX_MODES] = {
-
- /* Reserved for custom alphabet. */
- { (CODING_MODE)0, (CODING_MODE)0,
- (CODING_MODE)0, (CODING_MODE)0,
- (CODING_MODE)0, (CODING_MODE)0,
- (CODING_MODE)0, (CODING_MODE)0 },
+static const CODING_MODE ModeAlphabet[MODE_METHODS-2][MAX_MODES] = {
/* Last motion vector dominates */
{ CODE_INTER_LAST_MV, CODE_INTER_PRIOR_LAST,
@@ -144,7 +138,9 @@
pbi->FragCodingMethod[i] = CODE_INTRA;
}
}else{
- ogg_uint32_t ModeEntry; /* Mode bits read */
+ ogg_uint32_t ModeEntry; /* Mode bits read */
+ CODING_MODE CustomModeAlphabet[MAX_MODES];
+ const CODING_MODE *ModeList;
/* Read the coding method */
CodingScheme = oggpackB_read( &pbi->opb, MODE_METHOD_BITS );
@@ -154,8 +150,12 @@
if ( CodingScheme == 0 ){
/* Read the coding scheme. */
for ( i = 0; i < MAX_MODES; i++ ){
- ModeAlphabet[0][ oggpackB_read( &pbi->opb, MODE_BITS) ] = i;
+ CustomModeAlphabet[oggpackB_read(&pbi->opb, MODE_BITS)]=i;
}
+ ModeList=CustomModeAlphabet;
+ }
+ else{
+ ModeList=ModeAlphabet[CodingScheme-1];
}
/* Unravel the quad-tree */
@@ -179,7 +179,7 @@
MODE_BITS );
}else{
ModeEntry = FrArrayUnpackMode(pbi);
- CodingMethod = ModeAlphabet[CodingScheme][ ModeEntry ];
+ CodingMethod = ModeList[ModeEntry];
}
/* Note the coding mode for each block in macro block. */
<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