[Ffmpeg-devel] [PATCH] vorbis.h -> vorbis_data.c
Oded Shimon
ods15
Sat Sep 30 17:27:16 CEST 2006
On Sat, Sep 30, 2006 at 05:15:51PM +0200, Michael Niedermayer wrote:
> Hi
>
> On Sat, Sep 30, 2006 at 06:09:02PM +0300, Oded Shimon wrote:
> > It would be silly for me to send this as a patch, because it's an almost
> > completely unreadable ~260kb patch. These are the changes to be made:
> >
> > 1. the attached patch, for Makefile and vorbis.c
>
> nothing is attached ...
sorry :)
> > 2. vorbis.h would be changed to what is attached below
> > 3. vorbis_data.c would be svn-cp'ed from vorbis.h, having the
> > struct/typedefs removed, and a single line added:
> >
> > const float * ff_vorbis_vwin[8] = { vwin64, vwin128, vwin256, vwin512, vwin1024, vwin2048, vwin4096, vwin8192 };
> >
> >
> > I'll commit tommorrow, this is first step for me making vorbis_enc clean
> > enough to commit to lavc...
>
> iam against it, moving stuff from 1 file to another leads to a 0k patch
> not a 260k one, diff the files relative to their correctly matching
> counterparts, that could also be an empty file if not a single line
> is matching
ok, Here's the patch between (the current) vorbis.h, and vorbis_data.c ,
and yes it's a small patch.
however, the patch between the current vorbis.h and the one I'm attaching
here again, is an uninteresting 130kb one of all the tables being removed.
So, again:
1. the attacked patch for makefile and vorbis.c
2. vorbis.h to what is attached below
3. vorbis_data.c from vorbis.h and the attached patch for it
made 2 changes as Mans and Denes requested, the structs stay in vorbis.h
- ods15
-------------- next part --------------
Index: Makefile
===================================================================
--- Makefile (revision 6260)
+++ Makefile (working copy)
@@ -121,7 +121,7 @@
OBJS-$(CONFIG_VMDAUDIO_DECODER) += vmdav.o
OBJS-$(CONFIG_VMDVIDEO_DECODER) += vmdav.o
OBJS-$(CONFIG_VMNC_DECODER) += vmnc.o
-OBJS-$(CONFIG_VORBIS_DECODER) += vorbis.o
+OBJS-$(CONFIG_VORBIS_DECODER) += vorbis.o vorbis_data.o
OBJS-$(CONFIG_VP3_DECODER) += vp3.o
OBJS-$(CONFIG_VP5_DECODER) += vp5.o vp56.o vp56data.o
OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o
Index: vorbis.c
===================================================================
--- vorbis.c (revision 6328)
+++ vorbis.c (working copy)
@@ -860,7 +860,6 @@
static int vorbis_parse_id_hdr(vorbis_context *vc){
GetBitContext *gb=&vc->gb;
uint_fast8_t bl0, bl1;
- const float *vwin[8]={ vwin64, vwin128, vwin256, vwin512, vwin1024, vwin2048, vwin4096, vwin8192 };
if ((get_bits(gb, 8)!='v') || (get_bits(gb, 8)!='o') ||
(get_bits(gb, 8)!='r') || (get_bits(gb, 8)!='b') ||
@@ -890,8 +889,8 @@
"output packets too large.\n");
return 4;
}
- vc->win[0]=vwin[bl0-6];
- vc->win[1]=vwin[bl1-6];
+ vc->win[0]=ff_vorbis_vwin[bl0-6];
+ vc->win[1]=ff_vorbis_vwin[bl1-6];
if(vc->exp_bias){
int i, j;
@@ -1262,7 +1261,7 @@
lx=0;
ly=floor1_Y_final[0]*vf->multiplier; // conforms to SPEC
- vec[0]=floor1_inverse_db_table[ly];
+ vec[0]=ff_vorbis_floor1_inverse_db_table[ly];
for(i=1;i<vf->x_list_dim;++i) {
AV_DEBUG(" Looking at post %d \n", i);
@@ -1289,7 +1288,7 @@
sy=base+1;
}
ady=ady-(base<0 ? -base : base)*adx;
- vec[x]=floor1_inverse_db_table[y];
+ vec[x]=ff_vorbis_floor1_inverse_db_table[y];
AV_DEBUG(" vec[ %d ] = %d \n", x, y);
@@ -1301,7 +1300,7 @@
} else {
y+=base;
}
- vec[x]=floor1_inverse_db_table[y];
+ vec[x]=ff_vorbis_floor1_inverse_db_table[y];
AV_DEBUG(" vec[ %d ] = %d \n", x, y);
}
@@ -1318,7 +1317,7 @@
predicted=ly+off;
}
if (lx+j < vf->x_list[1]) {
- vec[lx+j]=floor1_inverse_db_table[predicted];
+ vec[lx+j]=ff_vorbis_floor1_inverse_db_table[predicted];
}
}*/
@@ -1329,7 +1328,7 @@
if (hx<vf->x_list[1]) {
for(i=hx;i<vf->x_list[1];++i) {
- vec[i]=floor1_inverse_db_table[hy];
+ vec[i]=ff_vorbis_floor1_inverse_db_table[hy];
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vorbis.h
Type: text/x-chdr
Size: 4364 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060930/e5866f88/attachment.h>
-------------- next part --------------
--- vorbis.h 2006-09-30 18:19:18.000000000 +0300
+++ vorbis_data.c 2006-09-30 17:56:58.000000000 +0300
@@ -16,130 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#define ALT_BITSTREAM_READER_LE
-#include "avcodec.h"
-#include "bitstream.h"
-#include "dsputil.h"
-
-typedef struct {
- uint_fast8_t dimensions;
- uint_fast8_t lookup_type;
- uint_fast8_t maxdepth;
- VLC vlc;
- float *codevectors;
- unsigned int nb_bits;
-} vorbis_codebook;
-
-typedef union vorbis_floor_u vorbis_floor_data;
-typedef struct vorbis_floor0_s vorbis_floor0;
-typedef struct vorbis_floor1_s vorbis_floor1;
-struct vorbis_context_s;
-typedef
-uint_fast8_t (* vorbis_floor_decode_func)
- (struct vorbis_context_s *, vorbis_floor_data *, float *);
-typedef struct {
- uint_fast8_t floor_type;
- vorbis_floor_decode_func decode;
- union vorbis_floor_u
- {
- struct vorbis_floor0_s
- {
- uint_fast8_t order;
- uint_fast16_t rate;
- uint_fast16_t bark_map_size;
- int_fast32_t * map[2];
- uint_fast32_t map_size[2];
- uint_fast8_t amplitude_bits;
- uint_fast8_t amplitude_offset;
- uint_fast8_t num_books;
- uint_fast8_t * book_list;
- float * lsp;
- } t0;
- struct vorbis_floor1_s
- {
- uint_fast8_t partitions;
- uint_fast8_t maximum_class;
- uint_fast8_t partition_class[32];
- uint_fast8_t class_dimensions[16];
- uint_fast8_t class_subclasses[16];
- uint_fast8_t class_masterbook[16];
- int_fast16_t subclass_books[16][8];
- uint_fast8_t multiplier;
- uint_fast16_t x_list_dim;
- uint_fast16_t *x_list;
- uint_fast16_t *x_list_order;
- uint_fast16_t *low_neighbour;
- uint_fast16_t *high_neighbour;
- } t1;
- } data;
-} vorbis_floor;
-
-typedef struct {
- uint_fast16_t type;
- uint_fast32_t begin;
- uint_fast32_t end;
- uint_fast32_t partition_size;
- uint_fast8_t classifications;
- uint_fast8_t classbook;
- int_fast16_t books[64][8];
- uint_fast8_t maxpass;
-} vorbis_residue;
-
-typedef struct {
- uint_fast8_t submaps;
- uint_fast16_t coupling_steps;
- uint_fast8_t *magnitude;
- uint_fast8_t *angle;
- uint_fast8_t *mux;
- uint_fast8_t submap_floor[16];
- uint_fast8_t submap_residue[16];
-} vorbis_mapping;
-
-typedef struct {
- uint_fast8_t blockflag;
- uint_fast16_t windowtype;
- uint_fast16_t transformtype;
- uint_fast8_t mapping;
-} vorbis_mode;
-
-typedef struct vorbis_context_s {
- AVCodecContext *avccontext;
- GetBitContext gb;
- DSPContext dsp;
-
- MDCTContext mdct[2];
- uint_fast8_t first_frame;
- uint_fast32_t version;
- uint_fast8_t audio_channels;
- uint_fast32_t audio_samplerate;
- uint_fast32_t bitrate_maximum;
- uint_fast32_t bitrate_nominal;
- uint_fast32_t bitrate_minimum;
- uint_fast32_t blocksize[2];
- const float * win[2];
- uint_fast16_t codebook_count;
- vorbis_codebook *codebooks;
- uint_fast8_t floor_count;
- vorbis_floor *floors;
- uint_fast8_t residue_count;
- vorbis_residue *residues;
- uint_fast8_t mapping_count;
- vorbis_mapping *mappings;
- uint_fast8_t mode_count;
- vorbis_mode *modes;
- uint_fast8_t mode_number; // mode number for the current packet
- float *channel_residues;
- float *channel_floors;
- float *saved;
- uint_fast16_t saved_start;
- float *ret;
- float *buf;
- float *buf_tmp;
- uint_fast32_t add_bias; // for float->int conversion
- uint_fast32_t exp_bias;
-} vorbis_context;
-
-
+#include "vorbis.h"
static const float vwin64[32] = {
0.0009460463F, 0.0085006468F, 0.0235352254F, 0.0458950567F,
@@ -2205,7 +2082,7 @@
1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F,
};
-static const float floor1_inverse_db_table[256]={
+const float ff_vorbis_floor1_inverse_db_table[256]={
1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F,
1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F,
1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F,
@@ -2272,3 +2149,4 @@
0.82788260F, 0.88168307F, 0.9389798F, 1.F,
};
+const float * ff_vorbis_vwin[8] = { vwin64, vwin128, vwin256, vwin512, vwin1024, vwin2048, vwin4096, vwin8192 };
More information about the ffmpeg-devel
mailing list