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

Ronald S. Bultje rsbultje
Sun May 2 23:47:23 CEST 2010


Hi,

On Sun, May 2, 2010 at 5:24 PM, Martin Storsj? <martin at martin.st> wrote:
> On Sun, 2 May 2010, Ronald S. Bultje wrote:
>> On May 2, 2010, at 4:33 PM, Benjamin Larsson <banan at ludd.ltu.se> wrote:
>> > On 02/05/10 22:31, Martin Storsj? wrote:
>> >>
>> >> 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);
>> >
>> > I'm quite sure the scaling can be added to some other step, so the
>> > loop wouldn't be needed.
>>
>> Yes, multiply it with highpass_gain in the function call before.
>
> Thanks! Yes, that works just as well, see the attached.

Patch OK, I think.

Ronald



More information about the ffmpeg-devel mailing list