From patchwork Thu Sep 15 19:28:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37945 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp521366pzh; Thu, 15 Sep 2022 12:29:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7gI4GuiI/wQ9Nimi/YPKTEQRBbPhfLXPethtKR+84gqdTj9cA9YKM2UohdafyGx38AM7Wu X-Received: by 2002:aa7:d6d9:0:b0:44d:e1b7:d905 with SMTP id x25-20020aa7d6d9000000b0044de1b7d905mr1183589edr.32.1663270164310; Thu, 15 Sep 2022 12:29:24 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f12-20020a1709062c4c00b0076daf135b26si12662301ejh.791.2022.09.15.12.29.24; Thu, 15 Sep 2022 12:29:24 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=L4bFsYzz; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1568168BBBB; Thu, 15 Sep 2022 22:28:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069055.outbound.protection.outlook.com [40.92.69.55]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E237B68BBD1 for ; Thu, 15 Sep 2022 22:28:39 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zh7FSwofkqBksISvjCQR8lej1/ozFEMS4VGXsCdWTtaRA4hAAKHsy7Fd+69Agg//buwWVtDr+az/z0uFcHjlHeeapf7gRF22zO2cItK2bCaQMf/B6MjE8ahULXWCuR1TEXYoiFABJMx8NaMjCOJDeuEjrLcys8g52cpBePKLMA2bLcAMedLtRTGLLPY6D+aDwf+N+5VUt/QkLh+mwIgPR/5NYuuJIfBkYefzbttt/TSuZyOzbLt2WDPpqMbQOpGLPr7ilNWGxDo3edgp/y9G2hdNMdW6icuriAVFNJFHgFjURc3UKuk9hKiV/34TOfkYr0uzN7iiu0i6n9gATXTWVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YxgoHSi4N2llWAaWiTnZlCk03yLex5JgcSTiU7i20+s=; b=moJYRIAjEQv5sukhplCFrVvYe6esdHqge5trwuXBbOhmalsxSsMKXxpLPnL6KktOCLjOkC7/ea73hITskaMlLPMzgTwD6viSL0szEAuJqUmlgw1u9p76HaZXuUGHTPG2NR9nBAhO0II4My9aF/2UaRwOguOLseYz/k64tuMRoCofyGzuS1zNTEOqKRYnSP1zUNtT5jsIGrfuJxKxrWioCuSjoDXdP/aZCOtfV2R1ToTaH1AdCOS4ymy+UjfUxibnY6BsEqzZpUiQDE7CgJdmgSQvU83KakHdXfi/n+Vf4D4RLwKYHPxx7SLMFD7Y9up5e/GnhfudbxFkgN6bncolpQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YxgoHSi4N2llWAaWiTnZlCk03yLex5JgcSTiU7i20+s=; b=L4bFsYzzrR54PsmXnUVzdenboDP8+1nALE//7kHhnaVVGMIqRTLvgS0JXpAhuS3vYAPFk72aWBws+Mcl6DeHzUKkKBEY1Q7uvtF/qJnkbmVWeVK6WtuS+5kbGf5vfcENKXm31tI/UfdFMBdR2E885AE/Ahg/Pg4NDGzFYCTOvwot2DABevakNrWqQ9+aYlgDHDtF18KCf4bH+FwTkXs9IDkU3wicfcBe6JrSl46UkJ5HcBuiksnRZP8Ff282GiABCx8ockJqU8vRvPW3GBbAX9gCf4+FJpXRqom2RsDaRrKWtsLSus/wORkGLdHSCY5356QH3gh194qCoiFE04KwFg== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DU2P250MB0014.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:2b7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.15; Thu, 15 Sep 2022 19:28:35 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::51a4:ed23:ea45:dfeb]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::51a4:ed23:ea45:dfeb%8]) with mapi id 15.20.5612.022; Thu, 15 Sep 2022 19:28:35 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 15 Sep 2022 21:28:09 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220915192809.2761301-1-andreas.rheinhardt@outlook.com> References: <20220915192809.2761301-1-andreas.rheinhardt@outlook.com> X-TMN: [Cd0wuwTpQku3YEc7NEIwEdNxXne5FCL4mzq/dqo0tJs=] X-ClientProxiedBy: ZR0P278CA0117.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:20::14) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20220915192809.2761301-8-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DU2P250MB0014:EE_ X-MS-Office365-Filtering-Correlation-Id: 378623f7-0615-4104-54cd-08da97507b6d X-MS-Exchange-SLBlob-MailProps: feAVlmA1hHXuRrZwjAG4DhtEfL4RdXaCzSFFQJ4YFpPbjk2dUDjwkpGSXBVkmPKTLP61JQH7agSbKnma1IUV49Ye1YQUf/FLT8aOSdpEPKRpC2mEjSMKfy8TbNJIk3Gz7j05gHkyVsMhVKA2b4JirNCOxZI+22SoKd7aq4j/KwS7QZ4ldm6UPVN3yn+N6XsenLAGA333iph6BdB8F16iH1LFlXWDi/L/SFd4CUhJvxn/F/ClzA5HopdTvxT45rqO0Akpuvpj+WM68e4PI/lZtnG7WdNQzychETz4uJ/r3mB5F3KvPisaokDiYLSVYJObie6w8Rs73R4Z/sFUmhFoD48cTzv5T7rQeRUSDpDn7/Ukxv9VPS0cJNx7AezhzyYbkB0gMFWmyXLv3odRdoQiYupfid+mF2hW9P9yOdm/iRJt8OcwNs2BT3+p1C36Ee3aJ3uvNIHw2GeYjCn28GAdbsXcYlhn1AKTQqC+4jgpTq3DX/9Bxiry38LnxFSQO7kScpap/5B0ws3toWToK/PWcNMNULZCrRN8q/H0TPOSiU5VodMomvZqRYb+HWH6Om66FDLHCmLq35fIiPVSyBCPvsw6SDT68TKUb8xjpcGwv+SFNmdNeZQG25k/FIv5HyFNu/nncq7JYpMPfuAQ8aIsNLAEy9shzbmF1KZXUMGFE3knXL5Rs2k8x6SPdEBtOtk7yAWzcCbQaHmoTqR5jr3fnw== X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-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qlp+5ZmGFX4nSWKxk3P1bNiF6+BI/vEa6MCwKqN5sTzbbM5o1+y36sYRzTCRN+iVj3kF+SGcs03cNr1x+1WWFznIoI8nXtE4/csT/SN+0hYItlGfywRQTXSGD5lG3HzoYy7f7QLGCDgT56jmvtTSmKCk9+EcUQ//vHR49VZUNbRjhmuNhPIvFW73sUsGyHoqfRzXgw+Y36FKP/FvgxuAJ1w37OvAoKpkNrt47p1I6CdFVohQyki6NNVDjc4ijyxoUuZzUrcrPw0awKzyCSQL4D4SgyoA42kMZCUjMdrmx7RBXpf66h5yKUYHP5JTR3kap5PDeXgswb6yzs7P0txwlblE0TJLyWNINfBMuEsXhNrSTviOH5eWQ2vn/trEkZ1IS4XQX4AvYdXoqXfzZH2og8AruVIL2MyuOp1qhr1tl995fvMoS3UOhm8RkRsVeY6Fuv2yhwqbJSYdrcsZpDl6Fn6/T8iyADVMBHcprIOzpnBhKHoXc+bZJrt6xAEH2ucHOMiNUv4xlsGxDiLAafUFD7JK/ha8tbG46HTGdf2uFPey5e7s9xYh1wO7nst48CE/h9y06NnmwoqyUjGOL8VzgrpSGMmsrCHEQQsqhxbI5bszYRUF37biyWCcXcl5I/rQrDwu7xehX03oJKp8PJvyAhBj0M+XzPHqH/EZxjXqe8dUGhwpOCWIHHQ7TgdpBgRclUb9S95Lu1QMYBYeBcSJ0H975y9EmJpDc6MTGJydQEVK8DSxd7HdT73XmRebjvsgpCaN4AHP5XVLM8uNyTP6SvIcfZhN/yWknpECaSdlREKT3mOtKvS/Qx838CyFzeZnAgjV9MQVaHScX8WTF1USfFlipWfMcGmXVWlAESqxiW5mMfVv5FuuXLwsC4vM04ENs124dXsLGVwmMmVHtHbmKdF3YHSqmTyXeVyV0pE3A6P5yg+Jp2fF/nHyrufOpDT073cNmjH2oSSLxw= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 378623f7-0615-4104-54cd-08da97507b6d X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2022 19:28:35.2005 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2P250MB0014 Subject: [FFmpeg-devel] [PATCH 9/9] avcodec/aptxenc: Process data in complete blocks of four samples only 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: SblpFoN6NwmP Do this by setting AVCodecInternal.pad_samples. This prevents reading into the frame's padding and writing into the packet's padding. This actually happened in our FATE tests (where the number of samples is 2 mod 4), which therefore needed to be updated. Signed-off-by: Andreas Rheinhardt --- libavcodec/aptxenc.c | 6 ++++-- tests/ref/fate/aptx | 4 ++-- tests/ref/fate/aptx-hd | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libavcodec/aptxenc.c b/libavcodec/aptxenc.c index 434a9abf0f..114e286fe2 100644 --- a/libavcodec/aptxenc.c +++ b/libavcodec/aptxenc.c @@ -27,6 +27,7 @@ #include "audio_frame_queue.h" #include "codec_internal.h" #include "encode.h" +#include "internal.h" typedef struct AptXEncContext { AptXContext common; @@ -259,6 +260,7 @@ static av_cold int aptx_encode_init(AVCodecContext *avctx) if (!avctx->frame_size || avctx->frame_size % 4) avctx->frame_size = 1024; + avctx->internal->pad_samples = 4; return ff_aptx_init(avctx); } @@ -269,7 +271,7 @@ const FFCodec ff_aptx_encoder = { CODEC_LONG_NAME("aptX (Audio Processing Technology for Bluetooth)"), .p.type = AVMEDIA_TYPE_AUDIO, .p.id = AV_CODEC_ID_APTX, - .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SMALL_LAST_FRAME, + .p.capabilities = AV_CODEC_CAP_DR1, .priv_data_size = sizeof(AptXEncContext), .init = aptx_encode_init, FF_CODEC_ENCODE_CB(aptx_encode_frame), @@ -290,7 +292,7 @@ const FFCodec ff_aptx_hd_encoder = { CODEC_LONG_NAME("aptX HD (Audio Processing Technology for Bluetooth)"), .p.type = AVMEDIA_TYPE_AUDIO, .p.id = AV_CODEC_ID_APTX_HD, - .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SMALL_LAST_FRAME, + .p.capabilities = AV_CODEC_CAP_DR1, .priv_data_size = sizeof(AptXEncContext), .init = aptx_encode_init, FF_CODEC_ENCODE_CB(aptx_encode_frame), diff --git a/tests/ref/fate/aptx b/tests/ref/fate/aptx index 4d20b7df9a..7917399297 100644 --- a/tests/ref/fate/aptx +++ b/tests/ref/fate/aptx @@ -1,5 +1,5 @@ -b5d8a297c0e8d9854f19d9d3e8b82859 *tests/data/fate/aptx.aptx -418950 tests/data/fate/aptx.aptx +97dfd7f32d34fb74337c0f6c66e26e2d *tests/data/fate/aptx.aptx +418952 tests/data/fate/aptx.aptx #tb 0: 1/44100 #media_type 0: audio #codec_id 0: pcm_s16le diff --git a/tests/ref/fate/aptx-hd b/tests/ref/fate/aptx-hd index 498b9131a6..d74c1059c2 100644 --- a/tests/ref/fate/aptx-hd +++ b/tests/ref/fate/aptx-hd @@ -1,5 +1,5 @@ -48ecaa81ee5adaaa62ed3ff6574b6666 *tests/data/fate/aptx-hd.aptx_hd -628425 tests/data/fate/aptx-hd.aptx_hd +6126e414af1acb193e24fdf33c7cac2e *tests/data/fate/aptx-hd.aptx_hd +628428 tests/data/fate/aptx-hd.aptx_hd #tb 0: 1/44100 #media_type 0: audio #codec_id 0: pcm_s32le