From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 670A4456DB for ; Sat, 18 Feb 2023 16:45:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0817068B9FF; Sat, 18 Feb 2023 18:45:22 +0200 (EET) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D981168B9FF for ; Sat, 18 Feb 2023 18:45:15 +0200 (EET) Received: by mail-lf1-f52.google.com with SMTP id b1so1374582lfs.8 for ; Sat, 18 Feb 2023 08:45:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=jrwE5h0oh68LSKoCQyahtss9L2mJiQlD1VFvWDh/uTc=; b=SPf87Lf0dgmjY6EYtq6FdvKrtA8ciSXbYn3oTF1hXyX5KyHK93IpPD3s4GKBJEWq5C B6HJIWvNpkBa7q9alNSONQ2+oU+t9Yx4BnRQTNbo6K2FuwGWxajC2WqitzSPQ+/9eoaf grW0YT2CtiTTr+DIXrVFaLznwPy72bdVUEzfdYCQMaF+An2oKJQo0RyIxGeGnrx8KwPl eirOYdmTwCBQ6U/vyByHlXWY8QM2SnaawxAYWrvr3oRYdj079Fqhw+vEYlmqXy/JRjde rMrYPOPF+5czekmQMlhzoLlCXEynGmFyQibpZdH6QcLysZ5FcSuopvHLR3pSuu34e7xZ zRtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jrwE5h0oh68LSKoCQyahtss9L2mJiQlD1VFvWDh/uTc=; b=M3Y/ihLajU6zIzy4PlxcWfiKfCuo/wIuUvCDhgEdAl+91GR7S1RzMx5U1Lr0cqT74D yO4Ddan3jQnivxizoppOxgQwPu/1sow/CxHiBlTdIvNl9hbm67X2Wh0sRvj72etygv/s 40yyMDFJ+m/7ofPMkpP01k+5MrJVTZilc/Pm8jiuBxFPsSLfu+fKUxt974XGzJIj48k6 I9fAOmCpCBTg9gSf7I9w8X8Cq29q2+A9Pz27FZPylh9AWWIM7reoJ88Ky5+wBqG8zRfe S4325fNoFqnUne7IkyWsNsVyUuIbpmHJpPNUJuCOy7N/6o74l8zqXs3xfCm8yaFBdOYp 9WJQ== X-Gm-Message-State: AO0yUKXmE9xYsDmVmtRtJAOXl92eKzdjOZlcdgHgvf/fN7ht9NqFD0rA XihROBv3rhDsNnyZWvwXwjq3ff0Mk5T3hMouz1PNEKt1yV0= X-Google-Smtp-Source: AK7set9QF5Md7/z+JMCLlElXEl1F2F8BNw/3DanRKn+GLcA4Q4uHkP750W4lhx1gCGhkwbFIHOUE0WcEpsobx4RIqlM= X-Received: by 2002:ac2:55ab:0:b0:4db:3353:c891 with SMTP id y11-20020ac255ab000000b004db3353c891mr1470737lfg.3.1676738713983; Sat, 18 Feb 2023 08:45:13 -0800 (PST) MIME-Version: 1.0 References: <20230218011457.346660-1-marth64@proxyid.net> In-Reply-To: <20230218011457.346660-1-marth64@proxyid.net> From: Hendrik Leppkes Date: Sat, 18 Feb 2023 17:45:01 +0100 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH v2 1/4] avcodec/eac3dec: add detection of Atmos spatial extension profile X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Sat, Feb 18, 2023 at 2:15 AM Marth64 wrote: > > Signed-off-by: Marth64 > --- > libavcodec/ac3dec.c | 3 +++ > libavcodec/ac3dec.h | 1 + > libavcodec/avcodec.h | 2 ++ > libavcodec/codec_desc.c | 1 + > libavcodec/eac3dec.c | 11 ++++++++++- > libavcodec/profiles.c | 5 +++++ > libavcodec/profiles.h | 1 + > 7 files changed, 23 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c > index 0b120e6140..8cede139b8 100644 > --- a/libavcodec/ac3dec.c > +++ b/libavcodec/ac3dec.c > @@ -1714,6 +1714,9 @@ skip: > if (!err) { > avctx->sample_rate = s->sample_rate; > avctx->bit_rate = s->bit_rate + s->prev_bit_rate; > + > + if (s->eac3_extension_type_a == 1) > + avctx->profile = FF_PROFILE_EAC3_DDP_ATMOS; > } This should probably be something like: avctx->profile = s->eac3_extension_type_a == 1 ? FF_PROFILE_EAC3_DDP_ATMOS : FF_PROFILE_UNKNOWN; This way the profile is properly reset when there is no extension (anymore). > > if (!avctx->sample_rate) { > diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h > index 138b462abb..0829f4b40d 100644 > --- a/libavcodec/ac3dec.h > +++ b/libavcodec/ac3dec.h > @@ -102,6 +102,7 @@ typedef struct AC3DecodeContext { > int eac3; ///< indicates if current frame is E-AC-3 > int eac3_frame_dependent_found; ///< bitstream has E-AC-3 dependent frame(s) > int eac3_subsbtreamid_found; ///< bitstream has E-AC-3 additional substream(s) > + int eac3_extension_type_a; ///< bitstream has E-AC-3 extension type A enabled frame(s) > int dolby_surround_mode; ///< dolby surround mode (dsurmod) > int dolby_surround_ex_mode; ///< dolby surround ex mode (dsurexmod) > int dolby_headphone_mode; ///< dolby headphone mode (dheadphonmod) > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 39881a1d2b..0e85dd50a4 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -1591,6 +1591,8 @@ typedef struct AVCodecContext { > #define FF_PROFILE_DTS_HD_MA 60 > #define FF_PROFILE_DTS_EXPRESS 70 > > +#define FF_PROFILE_EAC3_DDP_ATMOS 30 > + > #define FF_PROFILE_MPEG2_422 0 > #define FF_PROFILE_MPEG2_HIGH 1 > #define FF_PROFILE_MPEG2_SS 2 > diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c > index 199f62df15..4098d4f5a5 100644 > --- a/libavcodec/codec_desc.c > +++ b/libavcodec/codec_desc.c > @@ -2931,6 +2931,7 @@ static const AVCodecDescriptor codec_descriptors[] = { > .name = "eac3", > .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"), > .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, > + .profiles = NULL_IF_CONFIG_SMALL(ff_eac3_profiles), > }, > { > .id = AV_CODEC_ID_SIPR, > diff --git a/libavcodec/eac3dec.c b/libavcodec/eac3dec.c > index deca51dd3d..5c71751a0c 100644 > --- a/libavcodec/eac3dec.c > +++ b/libavcodec/eac3dec.c > @@ -464,7 +464,16 @@ static int ff_eac3_parse_header(AC3DecodeContext *s) > if (get_bits1(gbc)) { > int addbsil = get_bits(gbc, 6); > for (i = 0; i < addbsil + 1; i++) { > - skip_bits(gbc, 8); // skip additional bit stream info > + if (i == 0) { > + /* In this 8 bit chunk, the LSB is equal to flag_ec3_extension_type_a > + which can be used to detect Atmos presence */ > + skip_bits(gbc, 7); > + if (get_bits1(gbc)) { > + s->eac3_extension_type_a = 1; > + } > + } else { > + skip_bits(gbc, 8); // skip additional bit stream info > + } > } > } > > diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c > index 7af7fbeb13..343b08f363 100644 > --- a/libavcodec/profiles.c > +++ b/libavcodec/profiles.c > @@ -45,6 +45,11 @@ const AVProfile ff_dca_profiles[] = { > { FF_PROFILE_UNKNOWN }, > }; > > +const AVProfile ff_eac3_profiles[] = { > + { FF_PROFILE_EAC3_DDP_ATMOS, "Dolby Digital Plus + Dolby Atmos"}, > + { FF_PROFILE_UNKNOWN }, > +}; > + > const AVProfile ff_dnxhd_profiles[] = { > { FF_PROFILE_DNXHD, "DNXHD"}, > { FF_PROFILE_DNXHR_LB, "DNXHR LB"}, > diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h > index 41a19aa9ad..6ebedbd03f 100644 > --- a/libavcodec/profiles.h > +++ b/libavcodec/profiles.h > @@ -58,6 +58,7 @@ > > extern const AVProfile ff_aac_profiles[]; > extern const AVProfile ff_dca_profiles[]; > +extern const AVProfile ff_eac3_profiles[]; > extern const AVProfile ff_dnxhd_profiles[]; > extern const AVProfile ff_h264_profiles[]; > extern const AVProfile ff_hevc_profiles[]; > -- > 2.25.1 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".