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 ED6944356C for ; Thu, 16 Feb 2023 12:37:13 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4178568BEFF; Thu, 16 Feb 2023 14:37:10 +0200 (EET) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EE48268BE85 for ; Thu, 16 Feb 2023 14:37:03 +0200 (EET) Received: by mail-lf1-f48.google.com with SMTP id j17so2607760lfr.3 for ; Thu, 16 Feb 2023 04:37:03 -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=yBNh0O5kZ5Z+nNfP+K7SskWsRcBPHE0oV+yYY663lUQ=; b=djsZ//rA7b0IU9L3R7pjHUcuujqLioZ7PPLbsXvTxb2z/6YEC3alk9sYb1bDEjJA5M BZdhuDI67LD/fuKjhsEnaTKMi3EnyzR9SvuDhggcV5hafXHvazlJTkbRuC6oHKbKkn7Q ukc3jh8BPn30ITs3p9QfA3k1+zK9mYt5YO9j5cVaxDYzhkM75hKt/0G2m5foiznGxtAl oCtqlcdRy5wr2GvtqDcNKkYPDkQUfisXbJKZtggEMmZZW5fYDpx1SCn3GQU1/aBOCGhR OkwmqbJqBOtJ/xxXug3AM1JW2SVvFZDrNMZCYvSUYyrPxofuQFQN1OFj4GSGHIqeEkDE 3EjA== 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=yBNh0O5kZ5Z+nNfP+K7SskWsRcBPHE0oV+yYY663lUQ=; b=S0+G5aTzqlWh+welwvJoqxqcFGk1Tz61Chez1v9IJudvNLGSrfrhsGyDKFJ6e1AQ1Q 0qtUc/DhvgXQYAkjw2E6BpfqCxVA9LUXG4ybaFC23M6PQda45WN9SlH2+nkEts6KmNuM pirXTpTuXD3RAaAoRHqQ8gjUI/2sabzjj3UlaKFSM5lKp6Haev1Cc12FyAlmKbPHU40L +lZYVDFlFe5dTnQxS8Su238tTJgaot/OTTUODP6jSXHnDpj0W8zW5kzh4mGoBsaC78By QOaCdQXjPKuhUTzJ0XSzEwOUooSMZBCE5FdPz9D54iV54bEQzYm8tmpnUqcnlQeJadhq 7NeA== X-Gm-Message-State: AO0yUKXOocecH61RzHpU0inQ6sqoaf2uaiONQDXIQfvsXqplLmKnv8fT QauY7ZeYteZHJUOy83cxZImNLminjTR9XRqxu4ebBBw0NM4= X-Google-Smtp-Source: AK7set/69yuFHxvhhuxS/pvI49ERVeKqVHJJ9Dk16UkASEgpOnO+Evc+0lTg/QVUoms6fwZ5bz75/3OtDijpG1ok29k= X-Received: by 2002:ac2:593a:0:b0:4db:4568:6fe9 with SMTP id v26-20020ac2593a000000b004db45686fe9mr1623744lfi.3.1676551021650; Thu, 16 Feb 2023 04:37:01 -0800 (PST) MIME-Version: 1.0 References: <20230212005240.3167630-1-marth64@proxyid.net> In-Reply-To: <20230212005240.3167630-1-marth64@proxyid.net> From: Hendrik Leppkes Date: Thu, 16 Feb 2023 13:36:53 +0100 Message-ID: To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH] ffprobe/eac3/mlp/dca: add detection of spatial audio extensions 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 Sun, Feb 12, 2023 at 1:53 AM Marth64 wrote: > diff --git a/libavcodec/dca_syncwords.h b/libavcodec/dca_syncwords.h > index 4d2cd5f56d..200702f89e 100644 > --- a/libavcodec/dca_syncwords.h > +++ b/libavcodec/dca_syncwords.h > @@ -33,4 +33,7 @@ > #define DCA_SYNCWORD_SUBSTREAM_CORE 0x02B09261U > #define DCA_SYNCWORD_REV1AUX 0x9A1105A0U > > +#define DCA_SYNCWORD_XLL_X 0x00020008U > +#define DCA_SYNCWORD_XLL_X_IMAX 0x00F14000U > + > #endif /* AVCODEC_DCA_SYNCWORDS_H */ > diff --git a/libavcodec/dca_xll.c b/libavcodec/dca_xll.c > index fe2c766d98..efbbae67f8 100644 > --- a/libavcodec/dca_xll.c > +++ b/libavcodec/dca_xll.c > @@ -19,6 +19,7 @@ > */ > > #include "libavutil/channel_layout.h" > +#include "avcodec.h" > #include "dcadec.h" > #include "dcadata.h" > #include "dcamath.h" > @@ -1043,6 +1044,7 @@ static int parse_band_data(DCAXllDecoder *s) > static int parse_frame(DCAXllDecoder *s, const uint8_t *data, int size, DCAExssAsset *asset) > { > int ret; > + int extradata_peek_pos; > > if ((ret = init_get_bits8(&s->gb, data, size)) < 0) > return ret; > @@ -1054,10 +1056,23 @@ static int parse_frame(DCAXllDecoder *s, const uint8_t *data, int size, DCAExssA > return ret; > if ((ret = parse_band_data(s)) < 0) > return ret; > + > + extradata_peek_pos = (get_bits_count(&s->gb) + 31) & ~31; > + if (s->frame_size * 8 > extradata_peek_pos) { > + unsigned int extradata_syncword = show_bits_long(&s->gb, 32); > + > + if (extradata_syncword == DCA_SYNCWORD_XLL_X) { > + s->x_syncword_present = 1; > + } else if (extradata_syncword == DCA_SYNCWORD_XLL_X_IMAX) { > + s->x_imax_syncword_present = 1; > + } > + } > + I was testing this, and the DTS detections were not very reliable for me. This is what I came up with instead: #define DCA_SYNCWORD_XLL_X 0x02000850U #define DCA_SYNCWORD_XLL_X_IMAX 0xF14000D0U if (s->frame_size * 8 > FFALIGN(get_bits_count(&s->gb), 32)) { unsigned int extradata_syncword; // align to dword skip_bits_long(&s->gb, -get_bits_count(&s->gb) & 31); // get sync code extradata_syncword = show_bits_long(&s->gb, 32); if (extradata_syncword == DCA_SYNCWORD_XLL_X) { s->x_syncword_present = 1; } else if ((extradata_syncword >> 1) == (DCA_SYNCWORD_XLL_X_IMAX >> 1)) { s->x_imax_syncword_present = 1; } } I don't have many DTS:X discs, but this worked on them, the old code did not. Aligning to DWORD for a new section is a typical DTS thing to do, which then also resulted in the syncwords to shift a bit, and actually include more digits. The IMAX case is a bit weird, there seems to be an extra bit in there thats not stable, so shifting it out improves the detection (or it could be masked out, but same difference). - Hendrik _______________________________________________ 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".