[FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding

Umair Khan omerjerk at gmail.com
Thu Jul 28 09:28:36 EEST 2016


On Thu, Jul 28, 2016 at 12:22 AM, Clément Bœsch <u at pkh.me> wrote:
> On Wed, Jul 27, 2016 at 07:48:56PM +0200, Thilo Borgmann wrote:
>> > @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext *avctx)
>> >      ctx->raw_buffer       = av_mallocz_array(avctx->channels * channel_size, sizeof(*ctx->raw_buffer));
>> >      ctx->raw_samples      = av_malloc_array(avctx->channels, sizeof(*ctx->raw_samples));
>> >
>> > +    if (sconf->floating) {
>> > +        ctx->acf               = av_malloc_array(avctx->channels, sizeof(*ctx->acf));
>> > +        ctx->shift_value       = av_malloc_array(avctx->channels, sizeof(*ctx->shift_value));
>> > +        ctx->last_shift_value  = av_malloc_array(avctx->channels, sizeof(*ctx->last_shift_value));
>> > +        ctx->last_acf_mantissa = av_malloc_array(avctx->channels, sizeof(*ctx->last_acf_mantissa));
>> > +        ctx->raw_mantissa      = av_malloc_array(avctx->channels, sizeof(*ctx->raw_mantissa));
>> > +
>> > +        ctx->larray = av_malloc_array(ctx->cur_frame_length * 4, sizeof(*ctx->larray));
>> > +        ctx->nbits  = av_malloc_array(ctx->cur_frame_length, sizeof(*ctx->nbits));
>> > +        ctx->mlz    = av_malloc(sizeof(*ctx->mlz));
>> > +        ff_mlz_init_dict(avctx, ctx->mlz);
>> > +        ff_mlz_flush_dict(ctx->mlz);
>> > +
>> > +        if (!ctx->mlz || !ctx->acf || !ctx->shift_value || !ctx->last_shift_value
>> > +            || !ctx->last_acf_mantissa || !ctx->raw_mantissa) {
>> > +            av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory failed.\n");
>> > +            ret = AVERROR(ENOMEM);
>> > +            goto fail;
>> > +        }
>>
>> > +        for (c = 0; c < avctx->channels; ++c) {
>> > +            ctx->raw_mantissa[c] = av_malloc_array(ctx->cur_frame_length, sizeof(**ctx->raw_mantissa));
>>
>> Is there no av_malloc_arrayz() ?
>>
>
> there is av_mallocz_array()

Updated and tested.

- Umair
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-avcodec-alsdec-implement-floating-point-decoding.patch
Type: application/octet-stream
Size: 28067 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160728/ca0c3f2a/attachment.obj>


More information about the ffmpeg-devel mailing list