[xiph-cvs] cvs commit: theora/lib encoder_internal.h quant.c
Ralph Giles
giles at xiph.org
Sat Mar 6 18:27:05 PST 2004
giles 04/03/06 21:27:05
Modified: lib encoder_internal.h quant.c
Log:
Revert to static arrays for the three q matricies we actually us. This makes no difference, but
we're attempting to track down whatever's mysteriously wrong with the new code.
Also, complete conversion of the new header patch to use theora_read() so we work with libogg2.
Revision Changes Path
1.19 +4 -4 theora/lib/encoder_internal.h
Index: encoder_internal.h
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/encoder_internal.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- encoder_internal.h 5 Mar 2004 17:44:28 -0000 1.18
+++ encoder_internal.h 7 Mar 2004 02:27:04 -0000 1.19
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: encoder_internal.h,v 1.18 2004/03/05 17:44:28 giles Exp $
+ last mod: $Id: encoder_internal.h,v 1.19 2004/03/07 02:27:04 giles Exp $
********************************************************************/
@@ -251,9 +251,9 @@
Q_LIST_ENTRY DcScaleFactorTable[Q_TABLE_SIZE];
int MaxQMatrixIndex;
Q_LIST_ENTRY *qmats;
- Q_LIST_ENTRY *Y_coeffs;
- Q_LIST_ENTRY *UV_coeffs;
- Q_LIST_ENTRY *Inter_coeffs;
+ Q_LIST_ENTRY Y_coeffs[64];
+ Q_LIST_ENTRY UV_coeffs[64];
+ Q_LIST_ENTRY Inter_coeffs[64];
HUFF_ENTRY *HuffRoot[NUM_HUFF_TABLES];
} codec_setup_info;
<p><p>1.14 +35 -35 theora/lib/quant.c
Index: quant.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/quant.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- quant.c 7 Mar 2004 01:31:35 -0000 1.13
+++ quant.c 7 Mar 2004 02:27:04 -0000 1.14
@@ -11,7 +11,7 @@
********************************************************************
function:
- last mod: $Id: quant.c,v 1.13 2004/03/07 01:31:35 giles Exp $
+ last mod: $Id: quant.c,v 1.14 2004/03/07 02:27:04 giles Exp $
********************************************************************/
@@ -180,7 +180,6 @@
ci->DcScaleFactorTable[x]=(Q_LIST_ENTRY)bits;
}
/* base matricies */
- //N=(unsigned int)oggpackB_read(opb, 9) + 1;
theora_read(opb,9,&N);
N++;
if(N!=3)return OC_BADHEADER; /* we only support the VP3 config */
@@ -188,7 +187,6 @@
ci->MaxQMatrixIndex = N;
for(y=0; y<N; y++) {
for(x=0; x<64; x++) {
- //bits=oggpackB_read(opb, 8);
theora_read(opb,8,&bits);
if(bits<0)return OC_BADHEADER;
ci->qmats[(y<<6)+x]=(Q_LIST_ENTRY)bits;
@@ -199,18 +197,14 @@
int index, range, flag;
int qi = 0;
/* intra Y */
- //index=oggpackB_read(opb, _ilog(N-1)); /* qi=0 index */
- theora_read(opb,_ilog(N-1),&index);
+ theora_read(opb,_ilog(N-1),&index); /* qi=0 index */
while(qi<63) {
- //range=oggpackB_read(opb,_ilog(63-qi));
- theora_read(opb,_ilog(63-qi),&range);
+ theora_read(opb,_ilog(63-qi),&range); /* range to next code q matrix */
if(range<=0) return OC_BADHEADER;
qi+=range;
- //index=oggpackB_read(opb, _ilog(N-1));
theora_read(opb,_ilog(N-1),&index); /* next index */
}
/* intra U */
- //flag=oggpackB_read(opb, 1);
theora_read(opb,1,&flag);
if(flag<0) return OC_BADHEADER;
if(flag) {
@@ -227,36 +221,36 @@
/* same as previous */
}
/* intra V */
- flag=oggpackB_read(opb, 1);
+ theora_read(opb,1,&flag);
if(flag<0) return OC_BADHEADER;
if(flag) {
/* explicitly coded */
qi=0;
- index=oggpackB_read(opb, _ilog(N-1)); /* first index */
+ theora_read(opb,_ilog(N-1),&index); /* first index */
while(qi<63) {
- range=oggpackB_read(opb, _ilog(63-qi)); /* range */
+ theora_read(opb,_ilog(63-qi),&range); /* range */
if(range<=0) return OC_BADHEADER;
qi+=range;
- index=oggpackB_read(opb, _ilog(N-1)); /* next index */
+ theora_read(opb,_ilog(N-1),&index); /* next index */
}
} else {
/* same as previous */
}
/* inter Y */
- flag=oggpackB_read(opb, 1);
+ theora_read(opb,1,&flag);
if(flag<0) return OC_BADHEADER;
if(flag) {
/* explicitly coded */
qi=0;
- index=oggpackB_read(opb, _ilog(N-1)); /* first index */
+ theora_read(opb,_ilog(N-1),&index); /* first index */
while(qi<63) {
- range=oggpackB_read(opb, _ilog(63-qi)); /* range */
+ theora_read(opb,_ilog(63-qi),&range); /* range */
if(range<=0) return OC_BADHEADER;
qi+=range;
- index=oggpackB_read(opb, _ilog(N-1)); /* next index */
+ theora_read(opb,_ilog(N-1),&index); /* next index */
}
} else {
- flag=oggpackB_read(opb, 1);
+ theora_read(opb,1,&flag);
if(flag<0) return OC_BADHEADER;
if(flag) {
/* same as corresponding intra */
@@ -265,20 +259,20 @@
}
}
/* inter U */
- flag=oggpackB_read(opb, 1);
+ theora_read(opb,1,&flag);
if(flag<0) return OC_BADHEADER;
if(flag) {
/* explicitly coded */
qi=0;
- index=oggpackB_read(opb, _ilog(N-1)); /* first index */
+ theora_read(opb,_ilog(N-1),&index); /* first index */
while(qi<63) {
- range=oggpackB_read(opb, _ilog(63-qi)); /* range */
+ theora_read(opb,_ilog(63-qi),&range); /* range */
if(range<=0) return OC_BADHEADER;
qi+=range;
- index=oggpackB_read(opb, _ilog(N-1)); /* next index */
+ theora_read(opb,_ilog(N-1),&index); /* next index */
}
} else {
- flag=oggpackB_read(opb, 1);
+ theora_read(opb,1,&flag);
if(flag<0) return OC_BADHEADER;
if(flag) {
/* same as corresponding intra */
@@ -287,20 +281,20 @@
}
}
/* inter V */
- flag=oggpackB_read(opb, 1);
+ theora_read(opb,1,&flag);
if(flag<0) return OC_BADHEADER;
if(flag) {
/* explicitly coded */
qi=0;
- index=oggpackB_read(opb, _ilog(N-1)); /* first index */
+ theora_read(opb,_ilog(N-1),&index); /* first index */
while(qi<63) {
- range=oggpackB_read(opb, _ilog(63-qi)); /* range */
+ theora_read(opb,_ilog(63-qi),&range); /* range */
if(range<=0) return OC_BADHEADER;
qi+=range;
- index=oggpackB_read(opb, _ilog(N-1)); /* next index */
+ theora_read(opb,_ilog(N-1),&index); /* next index */
}
} else {
- flag=oggpackB_read(opb, 1);
+ theora_read(opb,1,&flag);
if(flag<0) return OC_BADHEADER;
if(flag) {
/* same as corresponding intra */
@@ -311,10 +305,16 @@
}
/* ignore the range table and reference the matricies we use */
+#if 0
ci->Y_coeffs=&(ci->qmats[0]);
ci->UV_coeffs=&(ci->qmats[64]);
ci->Inter_coeffs=&(ci->qmats[2*64]);
-
+#else
+ memcpy(ci->Y_coeffs, &ci->qmats[0], sizeof(ci->Y_coeffs));
+ memcpy(ci->UV_coeffs, &ci->qmats[64], sizeof(ci->UV_coeffs));
+ memcpy(ci->Inter_coeffs, &ci->qmats[2*64], sizeof(ci->Inter_coeffs));
+#endif
+
return 0;
}
@@ -322,9 +322,9 @@
memcpy(pbi->QThreshTable, ci->QThreshTable, sizeof(pbi->QThreshTable));
memcpy(pbi->DcScaleFactorTable, ci->DcScaleFactorTable,
sizeof(pbi->DcScaleFactorTable));
- memcpy(pbi->Y_coeffs, ci->Y_coeffs, 64 * sizeof(*ci->Y_coeffs));
- memcpy(pbi->UV_coeffs, ci->UV_coeffs, 64 * sizeof(*ci->UV_coeffs));
- memcpy(pbi->Inter_coeffs, ci->Inter_coeffs, 64 * sizeof(*ci->Inter_coeffs));
+ memcpy(pbi->Y_coeffs, ci->Y_coeffs, sizeof(pbi->Y_coeffs));
+ memcpy(pbi->UV_coeffs, ci->UV_coeffs, sizeof(pbi->UV_coeffs));
+ memcpy(pbi->Inter_coeffs, ci->Inter_coeffs, sizeof(pbi->Inter_coeffs));
}
/* Initialize custom qtables using the VP31 values.
@@ -334,9 +334,9 @@
memcpy(pbi->QThreshTable, QThreshTableV1, sizeof(pbi->QThreshTable));
memcpy(pbi->DcScaleFactorTable, DcScaleFactorTableV1,
sizeof(pbi->DcScaleFactorTable));
- memcpy(pbi->Y_coeffs, Y_coeffsV1, 64 * sizeof(*Y_coeffsV1));
- memcpy(pbi->UV_coeffs, UV_coeffsV1, 64 * sizeof(*UV_coeffsV1));
- memcpy(pbi->Inter_coeffs, Inter_coeffsV1, 64 * sizeof(*Inter_coeffsV1));
+ memcpy(pbi->Y_coeffs, Y_coeffsV1, sizeof(Y_coeffsV1));
+ memcpy(pbi->UV_coeffs, UV_coeffsV1, sizeof(UV_coeffsV1));
+ memcpy(pbi->Inter_coeffs, Inter_coeffsV1, sizeof(Inter_coeffsV1));
}
static void BuildQuantIndex_Generic(PB_INSTANCE *pbi){
<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