Commit cc0ba5a5 authored by Oded Shimon's avatar Oded Shimon

vorbis.h -> vorbis_data.c

move tables from vorbis.h to a C file so they can be used later in
vorbis_enc.c

Originally committed as revision 6398 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 18239edf
......@@ -121,7 +121,7 @@ OBJS-$(CONFIG_VCR1_ENCODER) += vcr1.o
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
......
......@@ -43,6 +43,124 @@
#undef NDEBUG
#include <assert.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;
/* Helper functions */
#define ilog(i) av_log2(2*(i))
......@@ -849,7 +967,6 @@ static int vorbis_parse_setup_hdr(vorbis_context *vc) {
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') ||
......@@ -879,8 +996,8 @@ static int vorbis_parse_id_hdr(vorbis_context *vc){
"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;
......@@ -1251,7 +1368,7 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data *
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);
......@@ -1278,7 +1395,7 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data *
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);
......@@ -1290,7 +1407,7 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data *
} 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);
}
......@@ -1307,7 +1424,7 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data *
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];
}
}*/
......@@ -1318,7 +1435,7 @@ static uint_fast8_t vorbis_floor1_decode(vorbis_context *vc, vorbis_floor_data *
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];
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment