[FFmpeg-devel] [PATCH] Add ATRAC3+ decoder

Paul B Mahol onemda at gmail.com
Mon Oct 14 21:04:26 CEST 2013


On 10/14/13, Maxim Polijakowski <max_pole at gmx.de> wrote:
>
>>> +    const uint8_t *buf  = avpkt->data;
>>> +    int buf_size        = avpkt->size;
>>> +    ATRAC3PContext *ctx = avctx->priv_data;
>>> +    AVFrame *frame      = data;
>>> +    int i, ret, ch_unit_id, ch_block = 0, out_ch_index = 0,
>>> channels_to_process;
>>> +    float **samples_p = (float **)frame->extended_data;
>>> +
>>> +    frame->nb_samples = ATRAC3P_FRAME_SAMPLES;
>>> +    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
>>> +        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
>>> +        return ret;
>>> +    }
>>> +
>>> +    init_get_bits(&ctx->gb, buf, buf_size * 8);
>> if ((ret = init_get_bits8(&ctx->gb, avpkt->data, avpkt->size)) < 0)
>>      return ret;
>
> Done.
>
>> [...]
>>
>>> +
>>> +/**
>>> + *  @file
>>> + *  DSP functions for ATRAC3+ decoder.
>>> + */
>>> +
>>> +#include <math.h>
>>> +
>>> +#include "libavutil/float_dsp.h"
>>> +#include "avcodec.h"
>>> +#include "sinewin.h"
>>> +#include "fft.h"
>>> +#include "atrac3plus.h"
>>> +#include "atrac3plus_data.h"
>>> +
>>> +#define ATRAC3P_MDCT_SIZE (ATRAC3P_SUBBAND_SAMPLES * 2)
>>> +
>>> +static AVFloatDSPContext atrac3p_dsp;
>> This looks strange and is probably incorrect, it probably should be in
>> private context.
>>
>
> What is wrong with that?
>
> atrac3plusdsp.c is the only part that uses this float DSP context.
> Moving it to decoder context will require to pass around pointers to
> this DSP context, which is not very elegant...

If I'm not mistaken this would be the only decoder that does that.

>
> Best regards
> Maxim
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list