[FFmpeg-devel] [PATCH 3/3] lavc: implement an ATRAC9 decoder

Rostislav Pehlivanov atomnuker at gmail.com
Sat Jun 30 11:15:55 EEST 2018


On 30 June 2018 at 08:44, Rostislav Pehlivanov <atomnuker at gmail.com> wrote:

>
> +static inline void fill_with_noise(ATRAC9Context *s, ATRAC9ChannelData *c,
> +                                   int start, int count)
> +{
> +    float maxval = 0.0f;
> +    for (int i = 0; i < count; i += 2) {
> +        double tmp[2];
> +        av_bmg_get(&s->lfg, tmp);
> +        c->coeffs[start + i + 0] = tmp[0];
> +        c->coeffs[start + i + 1] = tmp[1];
> +        maxval = FFMAX(tmp[0], FFMAX(tmp[1], maxval));
>

Erm this should be maxval = FFMAX(FFABS(tmp[0]), FFMAX(FFABS(tmp[1]),
maxval));
Attached new patch to fix that.



> +    }
> +    /* Normalize */
> +    for (int i = 0; i < count; i++)
> +        c->coeffs[start + i] /= maxval;
> +}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavc-implement-an-ATRAC9-decoder.patch
Type: text/x-patch
Size: 121435 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180630/eba76562/attachment.bin>


More information about the ffmpeg-devel mailing list