[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec vorbis.c, 1.10, 1.11 vorbis.h, 1.2, 1.3
Michael Niedermayer CVS
michael
Tue May 31 00:02:02 CEST 2005
Update of /cvsroot/ffmpeg/ffmpeg/libavcodec
In directory mail:/var2/tmp/cvs-serv7417
Modified Files:
vorbis.c vorbis.h
Log Message:
decrease V_NB_BITS if possible
Index: vorbis.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/vorbis.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- vorbis.c 30 May 2005 20:34:05 -0000 1.10
+++ vorbis.c 30 May 2005 22:02:00 -0000 1.11
@@ -30,7 +30,8 @@
#include "vorbis.h"
-#define V_NB_BITS 11
+#define V_NB_BITS 8
+#define V_NB_BITS2 11
#define V_MAX_VLCS (1<<16)
#ifndef V_DEBUG
@@ -361,9 +362,12 @@
for(t=0;t<entries;++t)
if (tmp_vlc_bits[t]>=codebook_setup->maxdepth) codebook_setup->maxdepth=tmp_vlc_bits[t];
- codebook_setup->maxdepth=(codebook_setup->maxdepth+V_NB_BITS-1)/V_NB_BITS;
+ if(codebook_setup->maxdepth > 3*V_NB_BITS) codebook_setup->nb_bits=V_NB_BITS2;
+ else codebook_setup->nb_bits=V_NB_BITS;
- if (init_vlc(&codebook_setup->vlc, V_NB_BITS, entries, tmp_vlc_bits, sizeof(*tmp_vlc_bits), sizeof(*tmp_vlc_bits), tmp_vlc_codes, sizeof(*tmp_vlc_codes), sizeof(*tmp_vlc_codes), INIT_VLC_LE)) {
+ codebook_setup->maxdepth=(codebook_setup->maxdepth+codebook_setup->nb_bits-1)/codebook_setup->nb_bits;
+
+ if (init_vlc(&codebook_setup->vlc, codebook_setup->nb_bits, entries, tmp_vlc_bits, sizeof(*tmp_vlc_bits), sizeof(*tmp_vlc_bits), tmp_vlc_codes, sizeof(*tmp_vlc_codes), sizeof(*tmp_vlc_codes), INIT_VLC_LE)) {
av_log(vc->avccontext, AV_LOG_ERROR, " Error generating vlc tables. \n");
goto error;
}
@@ -899,7 +903,7 @@
if (cbits) { // this reads all subclasses for this partition's class
cval=get_vlc2(gb, vc->codebooks[vf->class_masterbook[class_]].vlc.table,
- V_NB_BITS, 3);
+ vc->codebooks[vf->class_masterbook[class_]].nb_bits, 3);
}
for(j=0;j<cdim;++j) {
@@ -910,7 +914,7 @@
cval=cval>>cbits;
if (book>0) {
floor1_Y[offset+j]=get_vlc2(gb, vc->codebooks[book].vlc.table,
- V_NB_BITS, 3);
+ vc->codebooks[book].nb_bits, 3);
} else {
floor1_Y[offset+j]=0;
}
@@ -1096,7 +1100,7 @@
for(j_times_ptns_to_read=0, j=0;j<ch_used;++j) {
if (!do_not_decode[j]) {
uint_fast32_t temp=get_vlc2(gb, vc->codebooks[vr->classbook].vlc.table,
- V_NB_BITS, 3);
+ vc->codebooks[vr->classbook].nb_bits, 3);
AV_DEBUG("Classword: %d \n", temp);
@@ -1129,7 +1133,7 @@
voffs=voffset+j*vlen;
for(k=0;k<step;++k) {
- coffs=get_vlc2(gb, codebook.vlc.table, V_NB_BITS, 3) * codebook.dimensions;
+ coffs=get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * codebook.dimensions;
for(l=0;l<codebook.dimensions;++l) {
vec[voffs+k+l*step]+=codebook.codevectors[coffs+l]; // FPMATH
}
@@ -1138,7 +1142,7 @@
else if (vr->type==1) {
voffs=voffset+j*vlen;
for(k=0;k<step;++k) {
- coffs=get_vlc2(gb, codebook.vlc.table, V_NB_BITS, 3) * codebook.dimensions;
+ coffs=get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * codebook.dimensions;
for(l=0;l<codebook.dimensions;++l, ++voffs) {
vec[voffs]+=codebook.codevectors[coffs+l]; // FPMATH
@@ -1150,7 +1154,7 @@
voffs=voffset>>1;
for(k=0;k<step;++k) {
- coffs=get_vlc2(gb, codebook.vlc.table, V_NB_BITS, 3) * codebook.dimensions;
+ coffs=get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * codebook.dimensions;
for(l=0;l<codebook.dimensions;l+=2, voffs++) {
vec[voffs ]+=codebook.codevectors[coffs+l ]; // FPMATH
vec[voffs+vlen]+=codebook.codevectors[coffs+l+1]; // FPMATH
@@ -1164,7 +1168,7 @@
voffs=voffset;
for(k=0;k<step;++k) {
- coffs=get_vlc2(gb, codebook.vlc.table, V_NB_BITS, 3) * codebook.dimensions;
+ coffs=get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * codebook.dimensions;
for(l=0;l<codebook.dimensions;++l, ++voffs) {
vec[voffs/ch+(voffs%ch)*vlen]+=codebook.codevectors[coffs+l]; // FPMATH FIXME use if and counter instead of / and %
Index: vorbis.h
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/vorbis.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- vorbis.h 29 May 2005 22:11:05 -0000 1.2
+++ vorbis.h 30 May 2005 22:02:00 -0000 1.3
@@ -9,6 +9,7 @@
uint_fast8_t maxdepth;
VLC vlc;
float *codevectors;
+ unsigned int nb_bits;
} vorbis_codebook;
typedef struct {
More information about the ffmpeg-cvslog
mailing list