[FFmpeg-devel] [PATCH] Add ATRAC3+ decoder
Paul B Mahol
onemda at gmail.com
Fri Oct 11 11:17:54 CEST 2013
On 10/10/13, Maxim Polijakowski <max_pole at gmx.de> wrote:
> Hi crews,
>
> the attached patch adds an open-source decoder for Sony's ATRAC3+
> format. There is a partial description of its internals located here:
> http://wiki.multimedia.cx/index.php?title=ATRAC3plus
>
> Samples: http://samples.mplayerhq.hu/A-codecs/ATRAC3+/
>
> Because the patch is huge, I expect several review rounds.
>
> Therefore, I would like to kindly ask you to sort your review comments
> according to the following priority list:
> --> functionality improvements (code refractions resulting in faster or
> smaller code)
> --> security improvements (code refractions resulting in more secure code)
> --> cosmetic improvements (grammar, spelling etc.)
>
> Any help regarding fuzzy testing and pointing out insecure code would be
> very appreciated!
>
> Thank you in advance!
> Best regards
> Maxim
>
> From e425cb32249a9044c773f0c26ee8f231b818a470 Mon Sep 17 00:00:00 2001
> From: Maxim Poliakovski <max_pole at gmx.de>
> Date: Thu, 10 Oct 2013 20:32:14 +0200
> Subject: [PATCH 1/2] ATRAC+ decoder
>
> Cleanup by Diego Biurrun.
> ---
> Changelog | 1 +
> configure | 1 +
> doc/general.texi | 1 +
> libavcodec/Makefile | 3 +
> libavcodec/allcodecs.c | 1 +
> libavcodec/atrac3plus.c | 1735 +++++++++++++++++++++++++++++++++++++
> libavcodec/atrac3plus.h | 183 ++++
> libavcodec/atrac3plus_data.c | 1940 ++++++++++++++++++++++++++++++++++++++++++
> libavcodec/atrac3plus_data.h | 144 ++++
> libavcodec/atrac3plusdec.c | 394 +++++++++
> libavcodec/atrac3plusdsp.c | 658 ++++++++++++++
> libavcodec/version.h | 2 +-
> 12 files changed, 5062 insertions(+), 1 deletion(-)
> create mode 100644 libavcodec/atrac3plus.c
> create mode 100644 libavcodec/atrac3plus.h
> create mode 100644 libavcodec/atrac3plus_data.c
> create mode 100644 libavcodec/atrac3plus_data.h
> create mode 100644 libavcodec/atrac3plusdec.c
> create mode 100644 libavcodec/atrac3plusdsp.c
>
[...]
> + 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;
> +
> + if (get_bits1(&ctx->gb)) {
> + av_log(avctx, AV_LOG_ERROR, "Invalid start bit!\n");
> + return AVERROR_INVALIDDATA;
> + }
> + */
[...]
> +
> +/**
> + * @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.
> +
> +/**
> + * ATRAC3+ uses two different MDCT windows:
> + * - The first one is just the plain sine window of size 256.
> + * - The 2nd one is the plain sine window of size 128
> + * wrapped into zero (at the start) and one (at the end) regions.
> + * Both regions are 32 samples long. */
> +static float mdct_wind_steep[128]; ///< second MDCT window
> +
[...]
More information about the ffmpeg-devel
mailing list