From patchwork Sat Aug 13 15:03:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37252 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3d0d:b0:8d:a68e:8a0e with SMTP id y13csp390907pzi; Sat, 13 Aug 2022 08:03:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR6K10t84TzDXJEcQYDjMTx8xcKW4afeqConySl7p0PRHsvyf4WbTukh94HTbuixgiLSeIM5 X-Received: by 2002:a17:907:738a:b0:730:6d62:4ec8 with SMTP id er10-20020a170907738a00b007306d624ec8mr5780378ejc.590.1660403015938; Sat, 13 Aug 2022 08:03:35 -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 b6-20020a056402278600b0043e898f7840si5183045ede.449.2022.08.13.08.03.35; Sat, 13 Aug 2022 08:03:35 -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=ZyAF39fg; 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 B255F68B8FD; Sat, 13 Aug 2022 18:03:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-oln040092068024.outbound.protection.outlook.com [40.92.68.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EAE0568B8C5 for ; Sat, 13 Aug 2022 18:03:20 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JKPIvaotTrS/Lah1cd8eb5xf/tXvzHW2gAvAAHAzIS2Qw2FtB1eHAWniyyoDSPqlORTyzBBq/egJ7cTe45dAV+BKBRbsrUsjRDybZpWU6OLAZw1nEqAgo6vPr7Pof4VhqNlEhmF6EwUEpNsExxfzk4Qj1vDj6ma+RkSZdRS34wyXWEPcTaTaijCgPBX8X7rvUKftyXwxHloK5Uo0xTkJ2rvp4t0RD/Ib5ci4UJMeM0JA+9KxukYeS4gV+FpH9ZLvBd8x68VU0K2flfbXVyyyc9J9REmxhCMp9CgRlhPaJUwogHbhImxPtQeD/dbI+2t3kmT8DO6c3c+Nde4F4pRDzA== 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=17dcaTg82vjSoX9vum5yhEfLxWHIdyLxVnw3LCWzqOM=; b=Qhd+rnQP8GgLj2j7GQwEnQXP5ZJECqNK8+uuguI2Xb+uOkgD8S+Iwn9HqGSpfFhRBFwweeAXqJpWRdIFr/wnkeiAHro9ZSE6a1Y/7LG+6WNzcNQAMERIA1VPV3A25BdYFtFBrrUpo9Fyi3K2EcwjRjDyOdGofKppqzZQMjMHr9e5moxEUazo0E2WfBrbpDJtLcM5P5VVuWnZlkYRkKDKTfDF0VV05muBOvih5E7ccrL7PJ9Fm90ioqBdnTBmM1plr0kwnXkgDMis642UYe82mQtkQVQbngtXimZ3uNuWCDYirFTTjbarM9PQ6pR9xy1N+pEyjle/B3JKZ0L7oMJG2A== 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=17dcaTg82vjSoX9vum5yhEfLxWHIdyLxVnw3LCWzqOM=; b=ZyAF39fgsjCA6w89r+xVJ15cPLiQV5uRVZzH2gKbGHIXcx6j47Wiokde8r/H5bQKHqX3exRQ7Gb1EkHbm2Qd00R+mjBy1kX45tFuchW58DdWe8530+XAF2OvQmzzgiMHpoUZz2CkLHorYk6QWpyUglmSjhpUE57hHftU11nlfTwIJ3e3/5zp4qFY7TxRd3V7k7md/KnCf8I5G1HbQ0E/n2ERxgvxNX26+6pbjlWtHfs0N3o09bNZTmzcigsk8BdO38vCPw+j1huRXkugHTnMWEp+bRwF007QUGSXtbJftftndH0LmUaswOFN6SxPBFx+mY+uyC5MLTNSHIld7b0cjw== Received: from DB6PR0101MB2214.eurprd01.prod.exchangelabs.com (2603:10a6:4:42::27) by AS1PR01MB9370.eurprd01.prod.exchangelabs.com (2603:10a6:20b:4d4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.11; Sat, 13 Aug 2022 15:03:17 +0000 Received: from DB6PR0101MB2214.eurprd01.prod.exchangelabs.com ([fe80::210e:b627:bcc9:8c46]) by DB6PR0101MB2214.eurprd01.prod.exchangelabs.com ([fe80::210e:b627:bcc9:8c46%11]) with mapi id 15.20.5504.025; Sat, 13 Aug 2022 15:03:17 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 13 Aug 2022 17:03:03 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [Yt9IYSKOkE+heF+vJKzpcKhxcHTeMqcu] X-ClientProxiedBy: AS9PR0301CA0034.eurprd03.prod.outlook.com (2603:10a6:20b:469::23) To DB6PR0101MB2214.eurprd01.prod.exchangelabs.com (2603:10a6:4:42::27) X-Microsoft-Original-Message-ID: <20220813150306.1116206-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e0f75d64-2dfe-4249-c420-08da7d3cf3d8 X-MS-Exchange-SLBlob-MailProps: q+fD6XS3/UIgFldYn+1hidqnuJOerZ4lL8xu8pgkQ0eT4cEirPSCFFh8NbPYwvMLi7Rb3WsjhPb6U349zZ1EGCACpllacmt7ofpzJwz8tKiv4DL1NTumVKARNvVfCOXBwIj2BMOxHvrt3VQwFyHTxlIdIB61/eIFseohwz4QPXgaFgtwskcurmKCqYgAi+xBx3VbNUamdktfmGyheyVPkcAx2wLGVrMFify1fIYMyEEzcowc84NcgMeUn4UeJB7phbSPmlyT13gt8Xm2JYKG4D+jgZunTb6LbXFKz+WuFoitN08BPHRO/TyBYHJpzY96ywB0B8zIw5FrouSsQ9ICyvZdjUdRp6CQeZC/dbdqqkScLex0tMEgEApWdKTf6qbKeFetPuOfoEU3JY7wP/KzrRhFp2sMMwLAX2xUxfpOJRz6r6uIDkbAVo6CwbKyS0ygyfEPVd3mRhAoCMcfmUolN50sldn70mqwv3RHEloi5C+PUBWXwcW/6PU31KD+m2L4TITIuKS8ilOG4IipRcKZHkeBUQMrLfShG1OYBeqPLtXZOMKsiPNDQtufZnDy7bpjTGT+G2iVmG1WXFGtug78lVzdJS6M+kzr5pCr0df3wKlOV4rX7O9I5DYKop/RrPCSkWK+MH4n1+VP5bmMJn2fFrK8IgBIrapmCQt5IQUR1Bua3P3H3pah91J6ja63ADutAMADRtKfB9VrNecVEdM/sA== X-MS-TrafficTypeDiagnostic: AS1PR01MB9370:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GQVG9PY1+Cfn8oDHdQIEX+000Txhj/U22FRCGFQk4RIK0ocdVm1x7BWkq7GIOlr7mtOyzcJUGa1//ZZedbJx/vrO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AcQBE6LT1/MdumyBMHENwhRjuCNqipLbpu9OuNaIDboUCmQVm9MGzzHnhktFRPfSvOviErDxNeGl2LFwAaeftHL518ww2BR03RSOxYmlwe3CnPbujjTIvlMHQfQPp3VO+oXFYdm+CCOoUot3cg/1OAZ/ePOC1Dip9qBlrIiqCjyXbEeKTo4eDwPTfxvFQyE8mWM2pRR7WdStyQ2LTymy+61D1AT4rdqYS6loHNE8OcPNp7RphPnnna1tNHF5CW71mwv2V7adBp/WaCVGIhB/pzDMiqDyC2fw92BLztX6yGWkjLBfo4Z9Jh5N6XpZIRsDGnn/tNWfdpl6F4OPiegH+fuhhUPBbq2EcC9XFcf76vGzP0YYXRsighdty1oFlhEoglz07elt/SinBDQWlKTR5KJZu6rDA42fO/yA9U1wIOAX5ihJ8T2O6t+dGuEU+Bz3h+JexrWKzZD3W5+M0EUZp6tIHNxqZAfKibu2agQ2Uje/CBIdGFbp01eqZvihq037GK9yqM68pRvhixmv6VCXAAGtPPioeSJTEqIxRxLkCcopY3rcoIZ86zWtsZ0wysdk2xO6AOQncn65NmXBoM49SWf5pF653Jca+pXVLQZDuBfezxEugRioQnjSHJopI10M8afYbp40W+E5NVMWnZG39RKHeu6QlHGyJ7ThrZeaVcpNWWmbxvHqIYcUIcVTMMFEVrt2zom8OANAOCyJKgjZnBgf5/IZqSXCUMLGNGMfS/nvHE+NrsAS0NzJrUo9cZFZYAYEmKaGwuJDM2VnMCJdf5wghVI5TW8XY8To7yZdqZI2DK475fcn0ywyfalqngaErSzS8GR+ahUAQ6/yAtOSokvnTZrpV5XI1NqCJ+McIofYzVWbmsUils= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0f75d64-2dfe-4249-c420-08da7d3cf3d8 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0101MB2214.eurprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2022 15:03:17.2206 (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: AS1PR01MB9370 Subject: [FFmpeg-devel] [PATCH 3/6] 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: AwkITc4mRbAC 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. (No, this commit is not intended to be applied. I just hope to arouse the interest of people familiar with H.263 to look at this issue.) Signed-off-by: Andreas Rheinhardt --- I still don't intend to apply this. If no one looks into this, I will just add the necessary changes to the h263-obmc ref-files in the next commit and leave this one out. libavcodec/mpegpicture.c | 4 ++++ tests/ref/vsynth/vsynth1-h263-obmc | 4 ++-- tests/ref/vsynth/vsynth2-h263-obmc | 4 ++-- tests/ref/vsynth/vsynth_lena-h263-obmc | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c index c57f149752..2192f74cea 100644 --- a/libavcodec/mpegpicture.c +++ b/libavcodec/mpegpicture.c @@ -280,6 +280,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); } } diff --git a/tests/ref/vsynth/vsynth1-h263-obmc b/tests/ref/vsynth/vsynth1-h263-obmc index b7a267a8cb..aed283ed53 100644 --- a/tests/ref/vsynth/vsynth1-h263-obmc +++ b/tests/ref/vsynth/vsynth1-h263-obmc @@ -1,4 +1,4 @@ 7dec64380f375e5118b66f3baaaa1e24 *tests/data/fate/vsynth1-h263-obmc.avi 657320 tests/data/fate/vsynth1-h263-obmc.avi -844f7ee27fa122e199fe20987b41a15c *tests/data/fate/vsynth1-h263-obmc.out.rawvideo -stddev: 8.16 PSNR: 29.89 MAXDIFF: 113 bytes: 7603200/ 7603200 +2a69f6b37378aa34418dfd04ec98c1c8 *tests/data/fate/vsynth1-h263-obmc.out.rawvideo +stddev: 8.38 PSNR: 29.66 MAXDIFF: 116 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-h263-obmc b/tests/ref/vsynth/vsynth2-h263-obmc index 2cef7f551b..c0dcc3239e 100644 --- a/tests/ref/vsynth/vsynth2-h263-obmc +++ b/tests/ref/vsynth/vsynth2-h263-obmc @@ -1,4 +1,4 @@ 2d8a58b295e03f94e6a41468b2d3909e *tests/data/fate/vsynth2-h263-obmc.avi 208522 tests/data/fate/vsynth2-h263-obmc.avi -4a939ef99fc759293f2e609bfcacd2a4 *tests/data/fate/vsynth2-h263-obmc.out.rawvideo -stddev: 6.10 PSNR: 32.41 MAXDIFF: 90 bytes: 7603200/ 7603200 +3500b4227c1e6309ca5213414599266f *tests/data/fate/vsynth2-h263-obmc.out.rawvideo +stddev: 6.19 PSNR: 32.29 MAXDIFF: 111 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth_lena-h263-obmc b/tests/ref/vsynth/vsynth_lena-h263-obmc index 5b963107f6..78d7cc7277 100644 --- a/tests/ref/vsynth/vsynth_lena-h263-obmc +++ b/tests/ref/vsynth/vsynth_lena-h263-obmc @@ -1,4 +1,4 @@ 3c6946f808412ac320be9e0c36051ea2 *tests/data/fate/vsynth_lena-h263-obmc.avi 154730 tests/data/fate/vsynth_lena-h263-obmc.avi -588d992d9d8096da8bdc5027268da914 *tests/data/fate/vsynth_lena-h263-obmc.out.rawvideo -stddev: 5.39 PSNR: 33.49 MAXDIFF: 82 bytes: 7603200/ 7603200 +737af7fb166e2260ba049ae6bc30673d *tests/data/fate/vsynth_lena-h263-obmc.out.rawvideo +stddev: 5.42 PSNR: 33.44 MAXDIFF: 77 bytes: 7603200/ 7603200