[FFmpeg-devel] [PATCH 1/3] refactor the actual aac decoding code into its own function

Alex Converse alex.converse
Tue Oct 19 05:15:01 CEST 2010


On Mon, Oct 18, 2010 at 10:37 AM, Janne Grunau <janne-ffmpeg at jannau.net> wrote:

[snip]

> --- a/libavcodec/aacdec.c
> +++ b/libavcodec/aacdec.c
> @@ -84,6 +84,7 @@
> ?#include "lpc.h"
>
> ?#include "aac.h"
> +#include "aacdec.h"
> ?#include "aactab.h"
> ?#include "aacdectab.h"
> ?#include "cbrt_tablegen.h"
> @@ -1918,24 +1919,17 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
> ? ? return size;
> ?}
>
> -static int aac_decode_frame(AVCodecContext *avctx, void *data,
> - ? ? ? ? ? ? ? ? ? ? ? ? ? ?int *data_size, AVPacket *avpkt)
> +int ff_aac_decode_frame_int(AVCodecContext *avctx, void *data,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ?int *data_size, GetBitContext *gb)
> ?{
> - ? ?const uint8_t *buf = avpkt->data;
> - ? ?int buf_size = avpkt->size;
> ? ? AACContext *ac = avctx->priv_data;
> ? ? ChannelElement *che = NULL, *che_prev = NULL;
> - ? ?GetBitContext gb;
> ? ? enum RawDataBlockType elem_type, elem_type_prev = TYPE_END;
> ? ? int err, elem_id, data_size_tmp;
> - ? ?int buf_consumed;
> ? ? int samples = 0, multiplier;
> - ? ?int buf_offset;
>
> - ? ?init_get_bits(&gb, buf, buf_size * 8);
> -
> - ? ?if (show_bits(&gb, 12) == 0xfff) {
> - ? ? ? ?if (parse_adts_frame_header(ac, &gb) < 0) {
> + ? ?if (show_bits(gb, 12) == 0xfff) {
> + ? ? ? ?if (parse_adts_frame_header(ac, gb) < 0) {
> ? ? ? ? ? ? av_log(avctx, AV_LOG_ERROR, "Error decoding AAC frame header.\n");
> ? ? ? ? ? ? return -1;
> ? ? ? ? }

If ADTS inside LATM exists in the wild I'm shooting myself.

[snip]

> --- /dev/null
> +++ b/libavcodec/aacdec.h
> @@ -0,0 +1,35 @@
[LGPL snip]
> +/**
> + * @file
> + * AAC decoder functions used by the AAC LATM decoder
> + */
> +
> +#ifndef AVCODEC_AACDEC_H
> +#define AVCODEC_AACDEC_H
> +
> +#include "avcodec.h"
> +#include "get_bits.h"
> +
> +
> +int ff_aac_decode_frame_int(AVCodecContext *avctx, void *data,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ?int *data_size, GetBitContext *gb);
> +
> +#endif /* AVCODEC_AACDEC_H */

Is the LATM decoder destined to share a file with the parser or is it
going to be a little tiny stub file? It seems like it might make the
most sense to live with the aac decoder and not make this function
public.



More information about the ffmpeg-devel mailing list