[FFmpeg-devel] [PATCH v3 09/10] aacdec: add a decoder for AAC USAC (xHE-AAC)

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon May 27 20:36:23 EEST 2024


Lynne via ffmpeg-devel:
> This commit adds a decoder for the frequency-domain part of USAC.
> 
> What works:
>  - Mono
>  - Stereo (no prediction)
>  - Stereo (mid/side coding)
>  - Stereo (complex prediction)
> 
> What's left:
>  - Speech coding
> 
> Known issues:
>  - Desync with certain sequences
>  - Preroll crossover missing (shouldn't matter, bitrate adaptation only)
> ---
>  libavcodec/aac/Makefile              |    3 +-
>  libavcodec/aac/aacdec.c              |  188 +--
>  libavcodec/aac/aacdec.h              |  187 +++
>  libavcodec/aac/aacdec_ac.c           |  208 ++++
>  libavcodec/aac/aacdec_ac.h           |   54 +
>  libavcodec/aac/aacdec_dsp_template.c |    4 +-
>  libavcodec/aac/aacdec_latm.h         |   14 +-
>  libavcodec/aac/aacdec_lpd.c          |  198 ++++
>  libavcodec/aac/aacdec_lpd.h          |   33 +
>  libavcodec/aac/aacdec_usac.c         | 1592 ++++++++++++++++++++++++++
>  libavcodec/aac/aacdec_usac.h         |   37 +
>  libavcodec/aactab.c                  |   42 +
>  libavcodec/aactab.h                  |   10 +
>  13 files changed, 2494 insertions(+), 76 deletions(-)
>  create mode 100644 libavcodec/aac/aacdec_ac.c
>  create mode 100644 libavcodec/aac/aacdec_ac.h
>  create mode 100644 libavcodec/aac/aacdec_lpd.c
>  create mode 100644 libavcodec/aac/aacdec_lpd.h
>  create mode 100644 libavcodec/aac/aacdec_usac.c
>  create mode 100644 libavcodec/aac/aacdec_usac.h
> 

> +
> +    if (samples) {
> +        frame->nb_samples = samples;
> +        frame->sample_rate = avctx->sample_rate;
> +        frame->flags = indep_flag ? AV_FRAME_FLAG_KEY : 0x0;
> +        *got_frame_ptr = 1;
> +    } else {
> +        av_frame_unref(ac->frame);
> +        frame->flags = indep_flag ? AV_FRAME_FLAG_KEY : 0x0;
> +        *got_frame_ptr = 0;

Doesn't this actually imply that you need to remove the intra-only flag
from the AAC codec descriptor (which would then also affect (de)muxers
and the encoders (which would need to be updated)?

> +    }
> +
> +    /* for dual-mono audio (SCE + SCE) */
> +    is_dmono = ac->dmono_mode && sce_count == 2 &&
> +               !av_channel_layout_compare(&ac->oc[1].ch_layout,
> +                                          &(AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO);
> +    if (is_dmono) {
> +        if (ac->dmono_mode == 1)
> +            frame->data[1] = frame->data[0];
> +        else if (ac->dmono_mode == 2)
> +            frame->data[0] = frame->data[1];
> +    }
> +
> +    return 0;
> +}



More information about the ffmpeg-devel mailing list