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 56BBC4757E for ; Tue, 12 Sep 2023 06:14:31 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A15E268C98E; Tue, 12 Sep 2023 09:14:28 +0300 (EEST) Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2421268C946 for ; Tue, 12 Sep 2023 09:14:22 +0300 (EEST) Received: from tutadb.w10.tutanota.de (unknown [192.168.1.10]) by w4.tutanota.de (Postfix) with ESMTP id CD6E21060152 for ; Tue, 12 Sep 2023 06:14:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1694499261; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=696GEUQLsgD1y4PRTMqjwKsCvtc5Q6QTweUePr88GqY=; b=kQvpIAV5kWxlBaZsqgT9KpNFfqoYqfgaaxdpAZGUsKw6PzQ41AV6XL4epQ94aZyC XfG7XbcNb40Ct3ixTetTozwW2uiphjh4aIVfVPpltthZa/Q0C0Nz8q6yCucY882OXi3 5uqJiNlMRMKvKllM94stp/4VHPdYXtTJSKmka+7/ruK4sKjqB4j1nHjbJYQEy4XCf+u ftu8vzdhSd8XJVXPJaT5Amu8K2L1CLq0EKD48RSc22wyvTJPIEJmiJifEaYjg9WcZEf YjAKvbByPQkn7YX9/fQXzrsa/crKAHIpBWUd0RAGUw07dBVtAr5NkLMMFp7USdfIqg2 QEFyEtEb7A== Date: Tue, 12 Sep 2023 08:14:21 +0200 (CEST) From: Lynne To: FFmpeg development discussions and patches Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_893119_1560482857.1694499261832" Subject: [FFmpeg-devel] [RFC PATCH 3/3] aacdec: allow to skip sbr start-up delay 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: ------=_Part_893119_1560482857.1694499261832 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit As it happens, there's no standard between startup delay for SBR between decoders either. libfdkaac uses 5056 samples, but Apple's encoder (via afconvert) uses 3136. Currently, this only fixes libfdk-aac. Would like to have more samples from more encoders so I can fix all known cases. ------=_Part_893119_1560482857.1694499261832 Content-Type: text/x-diff; charset=us-ascii; name=0001-aacdec-always-skip-the-first-2048-samples-if-there-s.patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-aacdec-always-skip-the-first-2048-samples-if-there-s.patch >From 079235e1f1a9caeadfd2b8d78b3fe2273d86018a Mon Sep 17 00:00:00 2001 From: Lynne Date: Fri, 11 Aug 2023 17:50:54 +0200 Subject: [PATCH 1/3] aacdec: always skip the first 2048 samples if there's no side data For some reason, this was never set, which meant all **raw** AAC in ADTS streams, except faac, had extra samples at the start. Despite this being a standard MDCT-based codec with a frame size of 1024, hence a delay of 1024 samples at the start, all major encoders, excluding faac and FFmpeg, use 2048 samples of padding. The FFmpeg encoder will be modified to also output 2048 samples of padding at the start, to make it in line with other encoders. --- libavcodec/aacdec_template.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index f8039e490b..0e4a274fea 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -1273,6 +1273,9 @@ static av_cold int aac_decode_init(AVCodecContext *avctx) if (ret < 0) return ret; + /* Usually overridden by side data */ + avctx->internal->skip_samples = 2048; + return 0; } @@ -2417,14 +2420,16 @@ static int decode_dynamic_range(DynamicRangeControl *che_drc, return n; } -static int decode_fill(AACContext *ac, GetBitContext *gb, int len) { +static int decode_fill(AACContext *ac, GetBitContext *gb, int len) +{ uint8_t buf[256]; - int i, major, minor; + int i, major, minor, micro; if (len < 13+7*8) goto unknown; - get_bits(gb, 13); len -= 13; + get_bits(gb, 13); + len -= 13; for(i=0; i+1=8; i++, len-=8) buf[i] = get_bits(gb, 8); @@ -2434,7 +2439,11 @@ static int decode_fill(AACContext *ac, GetBitContext *gb, int len) { av_log(ac->avctx, AV_LOG_DEBUG, "FILL:%s\n", buf); if (sscanf(buf, "libfaac %d.%d", &major, &minor) == 2){ - ac->avctx->internal->skip_samples = 1024; + ac->avctx->internal->skip_samples -= 1024; + } + + if ((sscanf(buf, "avc %d.%d.%d", &major, &minor, µ) == 3)) { + ac->avctx->internal->skip_samples -= 1024; } unknown: -- 2.40.1 ------=_Part_893119_1560482857.1694499261832 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". ------=_Part_893119_1560482857.1694499261832--