diff mbox series

[FFmpeg-devel,1/4] mpeg4audio: rename AOT_USAC_NOSBR to AOT_USAC

Message ID 20240605030843.2807174-1-dev@lynne.ee
State Accepted
Commit 8a2fe8a5b964e8ccb0cba642f7aefe256a0fb356
Headers show
Series [FFmpeg-devel,1/4] mpeg4audio: rename AOT_USAC_NOSBR to AOT_USAC | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Lynne June 5, 2024, 3:08 a.m. UTC
The issue is that AOT 45 isn't defined anywhere, and looking at the git
blame, it seems to have sprung up through a reordering of the enum,
and adding a hole.

The spec does not define an explicit AOT for SBR and no SBR, and only
uses AOT 42 (previously AOT_USAC_NOSBR), so just rename AOT_USAC to
it and replace its use everywhere.
---
 libavcodec/aac/aacdec.c | 7 ++-----
 libavcodec/mpeg4audio.h | 3 +--
 2 files changed, 3 insertions(+), 7 deletions(-)

Comments

James Almer June 5, 2024, 4:15 p.m. UTC | #1
On 6/5/2024 12:08 AM, Lynne via ffmpeg-devel wrote:
> The issue is that AOT 45 isn't defined anywhere, and looking at the git
> blame, it seems to have sprung up through a reordering of the enum,
> and adding a hole.
> 
> The spec does not define an explicit AOT for SBR and no SBR, and only
> uses AOT 42 (previously AOT_USAC_NOSBR), so just rename AOT_USAC to
> it and replace its use everywhere.
> ---
>   libavcodec/aac/aacdec.c | 7 ++-----
>   libavcodec/mpeg4audio.h | 3 +--
>   2 files changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/aac/aacdec.c b/libavcodec/aac/aacdec.c
> index 2b8322fc68..24d2bdde4c 100644
> --- a/libavcodec/aac/aacdec.c
> +++ b/libavcodec/aac/aacdec.c
> @@ -1046,7 +1046,6 @@ static int decode_audio_specific_config_gb(AACDecContext *ac,
>               return ret;
>           break;
>   #if CONFIG_AAC_DECODER
> -    case AOT_USAC_NOSBR: /* fallthrough */
>       case AOT_USAC:
>           if ((ret = ff_aac_usac_config_decode(ac, avctx, gb,
>                                                oc, m4ac->chan_config)) < 0)
> @@ -1571,8 +1570,7 @@ int ff_aac_decode_tns(AACDecContext *ac, TemporalNoiseShaping *tns,
>                         GetBitContext *gb, const IndividualChannelStream *ics)
>   {
>       int tns_max_order = INT32_MAX;
> -    const int is_usac = ac->oc[1].m4ac.object_type == AOT_USAC ||
> -                        ac->oc[1].m4ac.object_type == AOT_USAC_NOSBR;
> +    const int is_usac = ac->oc[1].m4ac.object_type == AOT_USAC;
>       int w, filt, i, coef_len, coef_res, coef_compress;
>       const int is8 = ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE;
>   
> @@ -2421,8 +2419,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, AVFrame *frame,
>   
>       ac->tags_mapped = 0;
>   
> -    if ((ac->oc[1].m4ac.object_type == AOT_USAC) ||
> -        (ac->oc[1].m4ac.object_type == AOT_USAC_NOSBR)) {
> +    if (ac->oc[1].m4ac.object_type == AOT_USAC) {
>           if (ac->is_fixed) {
>               avpriv_report_missing_feature(ac->avctx,
>                                             "AAC USAC fixed-point decoding");
> diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h
> index 56615ef321..5daba7824b 100644
> --- a/libavcodec/mpeg4audio.h
> +++ b/libavcodec/mpeg4audio.h
> @@ -108,10 +108,9 @@ enum AudioObjectType {
>       AOT_ER_AAC_ELD,            ///< N                       Error Resilient Enhanced Low Delay
>       AOT_SMR_SIMPLE,            ///< N                       Symbolic Music Representation Simple
>       AOT_SMR_MAIN,              ///< N                       Symbolic Music Representation Main
> -    AOT_USAC_NOSBR,            ///< N                       Unified Speech and Audio Coding (no SBR)
> +    AOT_USAC,                  ///< Y                       Unified Speech and Audio Coding
>       AOT_SAOC,                  ///< N                       Spatial Audio Object Coding
>       AOT_LD_SURROUND,           ///< N                       Low Delay MPEG Surround
> -    AOT_USAC,                  ///< N                       Unified Speech and Audio Coding
>   };
>   
>   #define MAX_PCE_SIZE 320 ///<Maximum size of a PCE including the 3-bit ID_PCE

Should be ok.
diff mbox series

Patch

diff --git a/libavcodec/aac/aacdec.c b/libavcodec/aac/aacdec.c
index 2b8322fc68..24d2bdde4c 100644
--- a/libavcodec/aac/aacdec.c
+++ b/libavcodec/aac/aacdec.c
@@ -1046,7 +1046,6 @@  static int decode_audio_specific_config_gb(AACDecContext *ac,
             return ret;
         break;
 #if CONFIG_AAC_DECODER
-    case AOT_USAC_NOSBR: /* fallthrough */
     case AOT_USAC:
         if ((ret = ff_aac_usac_config_decode(ac, avctx, gb,
                                              oc, m4ac->chan_config)) < 0)
@@ -1571,8 +1570,7 @@  int ff_aac_decode_tns(AACDecContext *ac, TemporalNoiseShaping *tns,
                       GetBitContext *gb, const IndividualChannelStream *ics)
 {
     int tns_max_order = INT32_MAX;
-    const int is_usac = ac->oc[1].m4ac.object_type == AOT_USAC ||
-                        ac->oc[1].m4ac.object_type == AOT_USAC_NOSBR;
+    const int is_usac = ac->oc[1].m4ac.object_type == AOT_USAC;
     int w, filt, i, coef_len, coef_res, coef_compress;
     const int is8 = ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE;
 
@@ -2421,8 +2419,7 @@  static int aac_decode_frame_int(AVCodecContext *avctx, AVFrame *frame,
 
     ac->tags_mapped = 0;
 
-    if ((ac->oc[1].m4ac.object_type == AOT_USAC) ||
-        (ac->oc[1].m4ac.object_type == AOT_USAC_NOSBR)) {
+    if (ac->oc[1].m4ac.object_type == AOT_USAC) {
         if (ac->is_fixed) {
             avpriv_report_missing_feature(ac->avctx,
                                           "AAC USAC fixed-point decoding");
diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h
index 56615ef321..5daba7824b 100644
--- a/libavcodec/mpeg4audio.h
+++ b/libavcodec/mpeg4audio.h
@@ -108,10 +108,9 @@  enum AudioObjectType {
     AOT_ER_AAC_ELD,            ///< N                       Error Resilient Enhanced Low Delay
     AOT_SMR_SIMPLE,            ///< N                       Symbolic Music Representation Simple
     AOT_SMR_MAIN,              ///< N                       Symbolic Music Representation Main
-    AOT_USAC_NOSBR,            ///< N                       Unified Speech and Audio Coding (no SBR)
+    AOT_USAC,                  ///< Y                       Unified Speech and Audio Coding
     AOT_SAOC,                  ///< N                       Spatial Audio Object Coding
     AOT_LD_SURROUND,           ///< N                       Low Delay MPEG Surround
-    AOT_USAC,                  ///< N                       Unified Speech and Audio Coding
 };
 
 #define MAX_PCE_SIZE 320 ///<Maximum size of a PCE including the 3-bit ID_PCE