From patchwork Mon Apr 29 21:13:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 48375 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1509:b0:1a9:af23:56c1 with SMTP id nq9csp2270316pzb; Mon, 29 Apr 2024 14:15:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUidmi98frh6pwR2SU1ui0pUkc4MqJQqwnGKQK1BU6587zJ4Sd9xMDzkjwrlz6eOH7DkH5acNKfLMvo6AFpCIjmdXoo73udOU7n4g== X-Google-Smtp-Source: AGHT+IGe/4a27RKDF2fUyZfzYgG47N2jIljXsLSdmJgSYtnuDFyJJUkwXT7puY9/meZMzR/GXKiX X-Received: by 2002:a2e:b8c9:0:b0:2e0:c1b8:4917 with SMTP id s9-20020a2eb8c9000000b002e0c1b84917mr1604577ljp.12.1714425300606; Mon, 29 Apr 2024 14:15:00 -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 o19-20020a2e9b53000000b002dfd7e27315si1880976ljj.202.2024.04.29.14.15.00; Mon, 29 Apr 2024 14:15:00 -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=S+fGJwiZ; 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 3A3C668D526; Tue, 30 Apr 2024 00:14:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02olkn2056.outbound.protection.outlook.com [40.92.50.56]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C1BAF68D422 for ; Tue, 30 Apr 2024 00:14:48 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UTTtcCsIaN4oJmxv2Y915xksm1GdHEd7by7hxsNz9bi4bUv0snhsKB+iUNzCYxl4jwYndS7oXac0RlsyehxdQFvDn37gjozAGYomjN7bulZ0cuiQ0/8Kir36tHlBSqaS7cCL8Xb+2Kn0wWf+Xfv1bgEgbPq0FQ0JITeuIq29KNv6G/IHM7pGU4FEAt0TPmaTJKP77fzckA465Qjjf+ct6mKwNTpicyFWS4TqWetEuG1NZN3wGfhIzDuCBpSsYUxtZhNru8Htnm5mVXcEtXrKqPuQbSxCSHNb6ExHE4ut1ztJHh8K9f29kQeSwjX75c6oiKB6Px5+gPmNOUkOULNkHw== 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=D+UIDoJ9BvO2/c+o4pge01AbzxMKD78JlYu61qLtFKk=; b=AeY34x7fNc3SEoZ13ysNf4/mymO5Q5WzN8yNLXbNxpWCj6qUzGG1WYcnO7C0I5oVk5YDmLY6UduGl/ScFu/KAtXx/PcbJt1CjKFYnSETYLh94Cf5SB4nigVkzkQyrBUeJm4OuL/k1iFD9OXctzIfjAYpA7/SFOWd/79ZHuQjFIuY3h6Z/umt8BBmKQoFyT7RBZFKDHrx5DU6HL4gfa0p81UtIREqhs/ZyduSlh4mIv/HtnrJBreJFkMee3/O5EH+5IV88Yvu6Tj2m/Z23KFpASvYvCkBWQb1aAEp3E2ShlKPRv3L/jheeELEGj4TYwrH97Dr18vqU6CyelsEojOEjg== 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=D+UIDoJ9BvO2/c+o4pge01AbzxMKD78JlYu61qLtFKk=; b=S+fGJwiZUTIDS9UwSq5SEXakm1H7smHBw4/G6nGyuQXiVUtiC/cDq5qGRF606FxI9vgI8zodaA53y4V0bjpQnYAmK4S8vDKrTPCtIITdzNge697Q6p8dYBJPXuHl0/uYrIqxhkt0P3BfCJl6azYG6/ocdyEwZR329aZhf3ZYSTGJCIl5lqV8b0HwWxblOycTKNXJqalXmbzhE6gtoj9TTxSjHVvCmEB2B2Kr0rihVremd8iZpNaOB4WRU1cynsMoumuj2ltxCamC1rKpPz9zzUsCrsTCBZfLqx4J8xPe2g+vDT1DzZo3qSizRyHEugWgEXkQlNElF+ZLfgDjRJu+uQ== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PR3P250MB0372.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Mon, 29 Apr 2024 21:14:46 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::1f29:8206:b8c3:45bb]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::1f29:8206:b8c3:45bb%3]) with mapi id 15.20.7519.031; Mon, 29 Apr 2024 21:14:46 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Apr 2024 23:13:56 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [dTqSnHD+882DujZ3JmpaitjHsQVq3DelbQuM9ai0qvI=] X-ClientProxiedBy: ZR0P278CA0199.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:6a::21) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240429211438.3274834-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PR3P250MB0372:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e2be62c-995d-4c11-624b-08dc6891651f X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|440099019|3412199016|1710799017; X-Microsoft-Antispam-Message-Info: FZqKHegpKJJ/LPXX0fwo9vzQDzMjEJZnAlVRjgqsk+jn/T/ISzAsQoxO9lUdECPRf/HftkWCz6EwVEsQhw0R5zEL/5kBG+ivJrpd+bA5jEKk9vF2fP9RbJKNVx6ocNnBURMEbVbHkqxE0Cg1EoawIzdBMAcnsDjLZSY6JJwsszMxiy4kjMwyYyaDtrVSvv2P8H0GOgSaD24k9ju6v1KeziGqESeOULfYVuAqPV8JWgDItlteGcAaa6DD6/QJTLZuuiAgWp/XHIvEd/0nb46ciL4r7KOk2C9Svu2KEDu2dDT6EovLStUA98l03SbR/HP3sDEqYo9H0eyKFXrT8qrq0bCM7I5PnoPhkn1WmbtXIxRYZ5Jea6Po3tFP4ezk740axi59R8ZP/TZFGd0jyqtE/iKsXyAQQ28TWOuYupTVLM4i2QDB3chYphw8TPmbcFqOk0mTmFFEeu+JZJDkEjhLBMI3DFq0DVlQZqLZO3BqbkFW7dhCIGvxblnHHXZkSmMpXLXOO2HbRnXSzHewObCUAMROT5NFu+JCIKjpKhq3JZn/EMRnuuzMiZY0GoCjkGqDGLSFa7t6pvvc9SuA/CXlhyPyHgK7ZN5B9MG0pt5zTVL7t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th+Zq2J0BQCsi91G1IAq0tlYWeVgk0p2crreHDIyFhnmeJ3K3zypIydvoIhaxTbU6/YsHxr2Qa6Vq0s4acZFzz2zaMMqIelssYhdL31KddoP0J8TcfHdyfwZ2JXkkRCPgLPDIi5LSw8TXIucEHHiDjkxF/KbBrxSOY4r7dsQDnWWN03+rChrYZVDUMLTC8lnAXfaGPm6yq61NNvPl8ZLyk0ZTr7t6S2Md3p0u+yHJSdv+bAxRojXYbmof33BpRQ1xBEqy7g2ADPnBWoCg/Rw3sXfCiFCP3CWIJrhen/yrH9CFZVzjXbxz2cBgPQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e2be62c-995d-4c11-624b-08dc6891651f X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2024 21:14:46.0614 (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: PR3P250MB0372 Subject: [FFmpeg-devel] [PATCH 15/57] avcodec/mpegpicture: Always reset motion val buffer 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: /DpAW3dcLSDP Codecs call ff_find_unused_picture() to get the index of an unused picture; said picture may have buffers left from using it previously (these buffers are intentionally not unreferenced so that it might be possible to reuse them; this is mpegvideo's version of a bufferpool). They should not make any assumptions about which picture they get. Yet somehow this is not true when decoding OBMC: Returning random empty pictures (instead of the first one) leads to nondeterministic results; similarly, explicitly rezeroing the buffer before handing it over to the codec changes the outcome of the h263-obmc tests, but it makes it independent of the returned pictures. Therefore this commit does so. Signed-off-by: Andreas Rheinhardt --- libavcodec/mpegpicture.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index 88b4d5dec1..06c82880a8 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -245,6 +245,10 @@ int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, for (i = 0; i < 2; i++) { pic->motion_val[i] = (int16_t (*)[2])pic->motion_val_buf[i]->data + 4; pic->ref_index[i] = pic->ref_index_buf[i]->data; + /* FIXME: The output of H.263 with OBMC depends upon + * the earlier content of the buffer; therefore we + * reset it here. */ + memset(pic->motion_val_buf[i]->data, 0, pic->motion_val_buf[i]->size); } }