[FFmpeg-devel] [PATCH] Fix amrnb decoder scaling

Martin Storsjö martin
Sun May 2 22:31:16 CEST 2010


Hi,

The output from the amrnb decoder is currently broken, since rev 22937. In 
that commit, this chunk removed both scaling and clipping, even if only 
clipping was intended to be removed:

@@ -1048,10 +1046,6 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data, int *data_size
                                              highpass_poles, highpass_gain,
                                              p->high_pass_mem, AMR_BLOCK_SIZE);
 
-    for (i = 0; i < AMR_BLOCK_SIZE; i++)
-        buf_out[i] = av_clipf(buf_out[i] * AMR_SAMPLE_SCALE,
-                              -1.0, 32767.0 / 32768.0);
-
     /* Update averaged lsf vector (used for fixed gain smoothing).
      *
      * Note that lsf_avg should not incorporate the current frame's LSFs

The scaling factory is defined as:
#define AMR_SAMPLE_SCALE  (2.0 / 32768.0)

This patch readds the loop, only scaling the output values, without any 
clipping.

// Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Scale-amrnbdec-output-correctly.patch
Type: text/x-diff
Size: 1112 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100502/74e4f0d5/attachment.patch>



More information about the ffmpeg-devel mailing list