[FFmpeg-cvslog] r19231 - in trunk/libavcodec: wma.c wma.h wmadec.c wmaenc.c

faust3 subversion
Sat Jun 20 11:05:28 CEST 2009


Author: faust3
Date: Sat Jun 20 11:05:28 2009
New Revision: 19231

Log:
Introduce WMACoef typedef for decoded coefficients
and change default type to float so that the run level
decoding functionality can be shared with wmapro

Modified:
   trunk/libavcodec/wma.c
   trunk/libavcodec/wma.h
   trunk/libavcodec/wmadec.c
   trunk/libavcodec/wmaenc.c

Modified: trunk/libavcodec/wma.c
==============================================================================
--- trunk/libavcodec/wma.c	Sat Jun 20 11:00:12 2009	(r19230)
+++ trunk/libavcodec/wma.c	Sat Jun 20 11:05:28 2009	(r19231)
@@ -444,12 +444,12 @@ int ff_wma_end(AVCodecContext *avctx)
 int ff_wma_run_level_decode(AVCodecContext* avctx, GetBitContext* gb,
                             VLC *vlc,
                             const uint16_t *level_table, const uint16_t *run_table,
-                            int version, int16_t *ptr, int offset,
+                            int version, WMACoef *ptr, int offset,
                             int num_coefs, int block_len, int frame_len_bits,
                             int coef_nb_bits)
 {
     int code, run, level, sign;
-    int16_t* eptr = ptr + num_coefs;
+    WMACoef* eptr = ptr + num_coefs;
     for(;;) {
         code = get_vlc2(gb, vlc->table, VLCBITS, VLCMAX);
         if (code < 0)

Modified: trunk/libavcodec/wma.h
==============================================================================
--- trunk/libavcodec/wma.h	Sat Jun 20 11:00:12 2009	(r19230)
+++ trunk/libavcodec/wma.h	Sat Jun 20 11:05:28 2009	(r19231)
@@ -51,6 +51,8 @@
 #define VLCBITS 9
 #define VLCMAX ((22+VLCBITS-1)/VLCBITS)
 
+typedef float WMACoef;          ///< type for decoded coefficients, int16_t would be enough for wma 1/2
+
 typedef struct CoefVLCTable {
     int n;                      ///< total number of codes
     int max_level;
@@ -111,7 +113,7 @@ typedef struct WMACodecContext {
     int exponents_bsize[MAX_CHANNELS];      ///< log2 ratio frame/exp. length
     DECLARE_ALIGNED_16(float, exponents[MAX_CHANNELS][BLOCK_MAX_SIZE]);
     float max_exponent[MAX_CHANNELS];
-    int16_t coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE];
+    WMACoef coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE];
     DECLARE_ALIGNED_16(float, coefs[MAX_CHANNELS][BLOCK_MAX_SIZE]);
     DECLARE_ALIGNED_16(FFTSample, output[BLOCK_MAX_SIZE * 2]);
     MDCTContext mdct_ctx[BLOCK_NB_SIZES];
@@ -151,7 +153,7 @@ int ff_wma_end(AVCodecContext *avctx);
 int ff_wma_run_level_decode(AVCodecContext* avctx, GetBitContext* gb,
                             VLC *vlc,
                             const uint16_t *level_table, const uint16_t *run_table,
-                            int version, int16_t *ptr, int offset,
+                            int version, WMACoef *ptr, int offset,
                             int num_coefs, int block_len, int frame_len_bits,
                             int coef_nb_bits);
 

Modified: trunk/libavcodec/wmadec.c
==============================================================================
--- trunk/libavcodec/wmadec.c	Sat Jun 20 11:00:12 2009	(r19230)
+++ trunk/libavcodec/wmadec.c	Sat Jun 20 11:05:28 2009	(r19231)
@@ -486,12 +486,12 @@ static int wma_decode_block(WMACodecCont
     for(ch = 0; ch < s->nb_channels; ch++) {
         if (s->channel_coded[ch]) {
             int tindex;
-            int16_t* ptr = &s->coefs1[ch][0];
+            WMACoef* ptr = &s->coefs1[ch][0];
 
             /* special VLC tables are used for ms stereo because
                there is potentially less energy there */
             tindex = (ch == 1 && s->ms_stereo);
-            memset(ptr, 0, s->block_len * sizeof(int16_t));
+            memset(ptr, 0, s->block_len * sizeof(WMACoef));
             ff_wma_run_level_decode(s->avctx, &s->gb, &s->coef_vlc[tindex],
                   s->level_table[tindex], s->run_table[tindex],
                   0, ptr, 0, nb_coefs[ch],
@@ -514,7 +514,7 @@ static int wma_decode_block(WMACodecCont
     /* finally compute the MDCT coefficients */
     for(ch = 0; ch < s->nb_channels; ch++) {
         if (s->channel_coded[ch]) {
-            int16_t *coefs1;
+            WMACoef *coefs1;
             float *coefs, *exponents, mult, mult1, noise;
             int i, j, n, n1, last_high_band, esize;
             float exp_power[HIGH_BAND_MAX_SIZE];

Modified: trunk/libavcodec/wmaenc.c
==============================================================================
--- trunk/libavcodec/wmaenc.c	Sat Jun 20 11:00:12 2009	(r19230)
+++ trunk/libavcodec/wmaenc.c	Sat Jun 20 11:05:28 2009	(r19231)
@@ -186,7 +186,7 @@ static int encode_block(WMACodecContext 
 
     for(ch = 0; ch < s->nb_channels; ch++) {
         if (s->channel_coded[ch]) {
-            int16_t *coefs1;
+            WMACoef *coefs1;
             float *coefs, *exponents, mult;
             int i, n;
 
@@ -264,7 +264,7 @@ static int encode_block(WMACodecContext 
     for(ch = 0; ch < s->nb_channels; ch++) {
         if (s->channel_coded[ch]) {
             int run, tindex;
-            int16_t *ptr, *eptr;
+            WMACoef *ptr, *eptr;
             tindex = (ch == 1 && s->ms_stereo);
             ptr = &s->coefs1[ch][0];
             eptr = ptr + nb_coefs[ch];



More information about the ffmpeg-cvslog mailing list