[FFmpeg-devel] [PATCH] ALS decoder

Diego Biurrun diego
Thu Sep 3 20:19:24 CEST 2009


On Thu, Sep 03, 2009 at 07:57:21PM +0200, Thilo Borgmann wrote:
> Revision 15 attached.
> 
> --- libavcodec/alsdec.c	(revision 0)
> +++ libavcodec/alsdec.c	(revision 0)
> @@ -0,0 +1,1033 @@
> +
> +    int joint_stereo;         ///< joint Stereo: 1 = on, 0 = off

stereo

> +#ifdef DEBUG
> +static av_cold void dprint_specific_config(ALSDecContext *ctx)
> +{
> +    AVCodecContext *avctx    = ctx->avctx;
> +    ALSSpecificConfig *sconf = &ctx->sconf;
> +
> +    dprintf(avctx, " num_frames = %i\n",          ctx->num_frames);
> +    dprintf(avctx, " last_frame_length = %i\n",   ctx->last_frame_length);
> +}
> +#endif

Wild idea: Maybe this could be an empty function if DEBUG is not set?

> +    config_offset = ff_mpeg4audio_get_config(&m4ac, buffer, avctx->extradata_size);

long line

> +    // read fixed header and trailer sizes, if size = 0xFFFFFFFF then there is no data field!

long line

> +/** Parses the bs_info field to extract the block partitioning used in block switching mode,
> + *  refer to ISO/IEC 14496-3, section 11.6.2.

ditto

> +static void parse_bs_info(const uint32_t bs_info, unsigned int n, unsigned int div,
> +                          unsigned int **div_blocks, unsigned int *num_blocks)

ditto

> +/** Reformat block sizes from log2 format to direct form. Also assure that the
> + *  block sizes of the last frame correspond to the actual number of samples.

ditto

> +    // store carryover raw samples, the others channel raw samples are stored by the calling function.

ditto

> +    unsigned int div_blocks[32];                ///< Block sizes.

block sizes

> +            // if joint_stereo and block_switching is set, independent decoding
> +            // is signaled via the first bit of bs_info

signaLLed

> +    // increment the frame counter
> +    ctx->frame_id++;

pointless comment?

> +
> +    // check for size of decoded data
> +    size = ctx->cur_frame_length * avctx->channels *
> +           (av_get_bits_per_sample_format(avctx->sample_fmt) >> 3);
> +
> +    if (size > *data_size) {
> +        av_log(avctx, AV_LOG_ERROR, "Decoded data exceeds buffer size.\n");
> +        return -1;
> +    }
> +
> +    *data_size = size;
> +
> +
> +
> +    ctx->prev_raw_samples = av_malloc (sizeof(*ctx->prev_raw_samples) * sconf->max_order);
> +    ctx->raw_buffer       = av_mallocz(sizeof(*ctx->raw_buffer)  * avctx->channels * channel_size);
> +    ctx->raw_samples      = av_malloc (sizeof(*ctx->raw_samples) * avctx->channels);

    ctx->prev_raw_samples =  av_malloc(sizeof(*ctx->prev_raw_samples) * sconf->max_order);
    ctx->raw_buffer       = av_mallocz(sizeof(*ctx->raw_buffer)       * avctx->channels * channel_size);
    ctx->raw_samples      =  av_malloc(sizeof(*ctx->raw_samples)      * avctx->channels);

:)

> --- Changelog	(revision 19754)
> +++ Changelog	(working copy)
> @@ -37,6 +37,7 @@
>  - Wmapro decoder
> +- MPEG-4 ALS decoder

Please use the long name here.

Diego



More information about the ffmpeg-devel mailing list