r6398 - in trunk/libavcodec: Makefile vorbis.c vorbis.h vorbis_data.c
Author: ods15 Date: Sat Sep 30 20:47:15 2006 New Revision: 6398 Added: trunk/libavcodec/vorbis.h trunk/libavcodec/vorbis_data.c - copied, changed from r6396, /trunk/libavcodec/vorbis.h Modified: trunk/libavcodec/Makefile trunk/libavcodec/vorbis.c Log: vorbis.h -> vorbis_data.c move tables from vorbis.h to a C file so they can be used later in vorbis_enc.c Modified: trunk/libavcodec/Makefile ============================================================================== --- trunk/libavcodec/Makefile (original) +++ trunk/libavcodec/Makefile Sat Sep 30 20:47:15 2006 @@ -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 Modified: trunk/libavcodec/vorbis.c ============================================================================== --- trunk/libavcodec/vorbis.c (original) +++ trunk/libavcodec/vorbis.c Sat Sep 30 20:47:15 2006 @@ -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_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 @@ "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 @@ 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 @@ 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 @@ } 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 @@ 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 @@ 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]; } } Added: trunk/libavcodec/vorbis.h ============================================================================== --- (empty file) +++ trunk/libavcodec/vorbis.h Sat Sep 30 20:47:15 2006 @@ -0,0 +1,25 @@ +/* + * copyright (c) 2006 Oded Shimon <ods15 at ods15.dyndns.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef VORBIS_H +#define VORBIS_H + +extern const float ff_vorbis_floor1_inverse_db_table[256]; +extern const float * ff_vorbis_vwin[8]; + +#endif Copied: trunk/libavcodec/vorbis_data.c (from r6396, /trunk/libavcodec/vorbis.h) ============================================================================== --- /trunk/libavcodec/vorbis.h (original) +++ trunk/libavcodec/vorbis_data.c Sat Sep 30 20:47:15 2006 @@ -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,5 @@ 0.82788260F, 0.88168307F, 0.9389798F, 1.F, }; +const float * ff_vorbis_vwin[8] = { vwin64, vwin128, vwin256, vwin512, vwin1024, vwin2048, vwin4096, vwin8192 }; +
On Sat, Sep 30, 2006 at 08:47:24PM +0200, ods15 wrote:
Author: ods15 Date: Sat Sep 30 20:47:15 2006 New Revision: 6398
Added: trunk/libavcodec/vorbis.h trunk/libavcodec/vorbis_data.c - copied, changed from r6396, /trunk/libavcodec/vorbis.h Modified: trunk/libavcodec/Makefile trunk/libavcodec/vorbis.c
Added: trunk/libavcodec/vorbis.h ============================================================================== --- (empty file) +++ trunk/libavcodec/vorbis.h Sat Sep 30 20:47:15 2006 @@ -0,0 +1,25 @@ +/* + * copyright (c) 2006 Oded Shimon <ods15 at ods15.dyndns.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */
SVN doesn't seem to suck too bad, it really did everything as expected here... :) - ods15
participants (2)
-
ods15@ods15.dyndns.org -
subversion@mplayerhq.hu