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 C761F43971 for ; Mon, 4 Jul 2022 02:14:36 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D61C568B8A8; Mon, 4 Jul 2022 05:14:32 +0300 (EEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E148368B8A8 for ; Mon, 4 Jul 2022 05:14:25 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656900871; x=1688436871; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=m36Z1dZeAmeU9LIyzJ6WM6h4wEAlRZcgJMO21GxzzRw=; b=f4THG2NsHYJD1GMCaMphLZ3wdhsx8iuOSrxB7xgBb9nxPbNaBH/Rex3N i/090P0VNWBR+Ia/cOvOBD6vRMEWFsP+Fo8dIW5jnEI8kBPzychG2A0Ws xN9XsnkBMCsCtmT5I578nihm2Pcnh36GiJz2GjkBfrYZa4klMTWyEGuKt jUHO7qmGRhI5JTReHWVkWCJJPF00B0qIlk6MnBr0dSpGp/9GcKOhqizpy a9oiJgshuWlRLg0ZPJ32ifbbRGFPWcuhuEsrmgHHP27cvvKFi6nnaY49s VxyEQTFZ2y9rYT3f0eK+6nJDOycy2/ghb969VI7MmR7D35Vlav0MSKd+6 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10397"; a="271782616" X-IronPort-AV: E=Sophos;i="5.92,243,1650956400"; d="scan'208";a="271782616" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2022 19:14:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,243,1650956400"; d="scan'208";a="734662684" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by fmsmga001.fm.intel.com with ESMTP; 03 Jul 2022 19:14:22 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Sun, 3 Jul 2022 19:14:22 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Sun, 3 Jul 2022 19:14:22 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Sun, 3 Jul 2022 19:14:22 -0700 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.44) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Sun, 3 Jul 2022 19:14:21 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iW8lxgnJKAP2DP87e7CKBc4pPFRD3URBsS3jRZTIhfSIFQdBx6PR5blJhIuD81sT3tNiGDAgWuyIZhhVc6geaWT7Az9k80JzkdGs7lCOl3ES0TxJ3Vpdr6AuXxZH+8mV0AxJ1NkcTIYfHZIhvMlEl4APt8hXsx+dfgnZzVynXrBlkgUdZDIuoWQ7JAbnQSHWXqx2WhzPphXOleBc1A95aAzv6w6RFdXFFhSW/BpRuFIHzK7dgBgncvtjfgug49luUeSQA7iHHp/wwIKuaD/kBqkJ22bRjavwKAdTG+odeI0AXRMcMWHfGkhl3U5fWzSvDp8sl5zCBIZxihsBMb6xmw== 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=hPUMySx/PKOE/88+HSqcYyp3TDXUw28qTeH7HdpnKLg=; b=gpnSqOsPhz6V5PNNZh0i+NlPVaMdPxZPtPb6pXZ7OLO4CIWNfSor/usWs/EG6+pKdlhb7HEWD3hfP1QRJNbRowdGIXabol1P+ZpvcTiGwjD1n5s3oEmGrBSnljV7KOqIIjLvUBOWulZeGuNz+3G+63zwfCYOn9SABC2a14Or296+GAfS5+XiruUnDLGUKhB63IXL+aCEsJriGLgraFmFVauDuo7S7GK0JnNGhqTBP8yyDuAcuNHHi4wMV6Mplk1uA4r2i/e3kX3PUSgZGwvjASJPqLvXA0n9AvkcQI9RYeAz8m0xBasuIv/CHbnmhJeoWXnZUPEic53P5pYKqJ59TQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from BY5PR11MB3879.namprd11.prod.outlook.com (2603:10b6:a03:18f::17) by MN2PR11MB4176.namprd11.prod.outlook.com (2603:10b6:208:13b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.14; Mon, 4 Jul 2022 02:14:19 +0000 Received: from BY5PR11MB3879.namprd11.prod.outlook.com ([fe80::b02e:fe48:73f6:f310]) by BY5PR11MB3879.namprd11.prod.outlook.com ([fe80::b02e:fe48:73f6:f310%6]) with mapi id 15.20.5395.020; Mon, 4 Jul 2022 02:14:19 +0000 From: "Chen, Wenbin" To: FFmpeg development discussions and patches Thread-Topic: [FFmpeg-devel] [PATCH] libavcodec/mpegvideo_enc: Fix a chroma mb size error in sse_mb() Thread-Index: AQHYjQzv7ygbdL1zI02qVOPrYp178a1p9HCAgAOHrhA= Date: Mon, 4 Jul 2022 02:14:19 +0000 Message-ID: References: <20220701053434.2137992-1-wenbin.chen@intel.com> <20220701201513.GW396728@pb2> In-Reply-To: <20220701201513.GW396728@pb2> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.6.500.17 dlp-reaction: no-action authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 51323a44-3baa-42e6-7848-08da5d62e76a x-ms-traffictypediagnostic: MN2PR11MB4176:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: o3RRaQ98aUn504v8/WPzqDHwa+KtvyisMh19KTZnN2C50YTnwgp1fyTZsRhb2miNxL962lsWCO1nQ/DqcQrMXrISxYXsXThwhMFwVVufNGxW4vJQ5VINRpTU7qvH4SiH0uSddA1epzxyuxhTii88MUjSzQVKR/z6uQKhhzkrEvV1/pJ+rmacHbOe4bCcrLxC+OTi61WtJCE/c8jodOkZg92EFfqArdIi+Moami6zG/ktve3xTtw73CcpsJhdWeDCDHkfclYaHKAoO0uE7+jfMK7KddCtxFBrZHYsaV8pPglReDQZA14XLC2bXsyLOEIqVzmtQAXf4gAjhtdjT/WJq30XkXuFU2G0c0K0SrfslG78/aRUwJq+S739vJb+k/SVB8XQHqkT7l7GEQr/t2CwS3G2Vd6BkrmIVBERyfmftdAmfXrF8YfSSeqaW5QwU5ND+Sz3WtYslx7aBJabh9MuxfYFWfZaEAopyKHG1AcpM9YJIMimm9SlW3Tl34KLjzVTPxbIj0jDmhjgv2gRkosaNIv10AdQN2V1Q259fecMRjcQwIKUypv8DsIGzavoGfze/yhjCkHR3b1eQxawub44p9SLZofoFRWZLFNJ4U2Dil3qX33D8LLijy/OUR/ZbE74MXpD6CQy4q9PmtBkKtzuQavusgngBZYccRYEedIOFEgXFNtYSWlm9Ql4HmVSgVN+moah+HQ0SOlpkqIwe8FBIZUXHjm3FS+Pmn3tgAGQcczoVPGP7JCu+lwoZeqFUkzPALAlEWytxxkUfu4JB7t4n2PT6rndbtTEmX33F+Arf6JQeJSqHN4K8b/wClIp/t82 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR11MB3879.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(346002)(366004)(396003)(39860400002)(376002)(136003)(6916009)(38100700002)(186003)(6506007)(83380400001)(7696005)(38070700005)(5660300002)(76116006)(82960400001)(478600001)(52536014)(316002)(122000001)(9686003)(55016003)(26005)(66556008)(66946007)(64756008)(8676002)(66476007)(71200400001)(66446008)(33656002)(86362001)(41300700001)(8936002)(2906002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?KSkcmnHnJmefpOUhySAloq69ZbWVNWgrtrpo1tAZk8sg9Y4F2cjB3V2Aiwpp?= =?us-ascii?Q?dqWVX3MNO7IDibfuyNpZI+Win5ByXADGYI0cgRTYzshh9ohn0zieDXe8JrA4?= =?us-ascii?Q?5KLIIpUo/MTozL1me9UCeO0ORhwoqn4MSWbdkTppdSt3bs9za3dpMree9jhF?= =?us-ascii?Q?OYMv1tnRs/Rlx+VupDMqoC616t8KIUSg0a3o7Hj2y6NGucuRQd7L9zi42/PI?= =?us-ascii?Q?5QyvTahnvvp5JyxT5tXO7fpiHpyXUb2PSKnHmP4s59uQhFtPQf2lvRe12qWD?= =?us-ascii?Q?7mkdcXYm9bb3fF688hx9iL6QQqt3sBrltopOJi3Q09We+5+NC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TH6P3RPuZbJfjKIUFstd7qfDklHbMBeOR6b+cxCzQ1CnV5WF9Bw?= =?us-ascii?Q?EKEvIy+FoM6YGZEPjc6zMP+yrYodmAoq4yQd6UvdhRsXHBclls/AkqHBMfZg?= =?us-ascii?Q?KUWI4H6i28nDbZfd/k9UzKka8OksUnz2CUh2o/aNWX0k0+cMcDDcvCd55t35?= =?us-ascii?Q?P2bWRX5rAG8Sl04wCDJw/Yo1szfBnMxDEbhKJJhwcLwEsqI2/f5E1akqN5tn?= =?us-ascii?Q?JJFbG5ytrjtO1WAE1+1JXSs6zE5stMf93AYAWqSVki334ByyelqWPOb+ErCo?= =?us-ascii?Q?9bWRKxD8siT262kFOmGkXyZ2vb3U7rXEvjFqs8mtD1rKP+VFIdS0UbSt6TH+?= =?us-ascii?Q?nwEYgkWHUc8hJBA9e6OOu9aA1vq4N64yC6u5W9XO?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR11MB3879.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51323a44-3baa-42e6-7848-08da5d62e76a X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jul 2022 02:14:19.6882 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: QmCxmO4MnxbRHghQzZ3v+s5kYBRA1g9dE9ZsePecyRNJMZU5QEmbKVNFdNrLXgVWPoLFhVLLvkM3VSdGUIeWuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4176 X-OriginatorOrg: intel.com Subject: Re: [FFmpeg-devel] [PATCH] libavcodec/mpegvideo_enc: Fix a chroma mb size error in sse_mb() 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 Fri, Jul 01, 2022 at 01:34:34PM +0800, Wenbin Chen wrote: > > For 422 frames we should not use hard coded 8 to calculate mb size for > > uv plane. Chroma shift should be taken into consideration to be > > compatiple with different sampling format. > > > > The error is reported by fate test when av_cpu_max_align() return 64 > > on the platform supporting AVX512. This is a hidden error and it is > > exposed after commit 17a59a634c39b00a680c6ebbaea58db95594d13d. > > > > mpeg2enc has a mechanism to reuse frames. When it computes SSE (sum > of > > squared error) on current mb, reconstructed mb will be wrote to the > > previous mb space, so that the memory can be saved. However if the align > > is 64, the frame is shared in somewhere else, so the frame cannot be > > reused and a new frame to store reconstrued data is created. Because the > > height of mb is wrong when compute sse on 422 frame, starting from the > > second line of macro block, changed data is read when frame is reused > > (we need to read row 16 rather than row 8 if frame is 422), and unchanged > > data is read when frame is not reused (a new frame is created so the > > original frame will not be changed). > > > > That is why commit 17a59a634c39b00a680c6ebbaea58db95594d13d > exposes this > > issue, because it add av_cpu_max_align() and this function return 64 on > > platform supporting AVX512 which lead to creating a frame in mpeg2enc, > > and this lead to the different outputs. > > > > Signed-off-by: Wenbin Chen > > --- > > libavcodec/mpegvideo_enc.c | 29 +++++++++++++------ > > tests/ref/seek/vsynth_lena-mpeg2-422 | 40 +++++++++++++------------- > > tests/ref/vsynth/vsynth1-mpeg2-422 | 8 +++--- > > tests/ref/vsynth/vsynth2-mpeg2-422 | 8 +++--- > > tests/ref/vsynth/vsynth3-mpeg2-422 | 8 +++--- > > tests/ref/vsynth/vsynth_lena-mpeg2-422 | 8 +++--- > > 6 files changed, 56 insertions(+), 45 deletions(-) > > > > diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c > > index d6a85a037a..c9d9e2a764 100644 > > --- a/libavcodec/mpegvideo_enc.c > > +++ b/libavcodec/mpegvideo_enc.c > > @@ -2558,24 +2558,35 @@ static int sse(MpegEncContext *s, uint8_t *src1, > uint8_t *src2, int w, int h, in > > static int sse_mb(MpegEncContext *s){ > > int w= 16; > > int h= 16; > > + int chroma_mb_w = w >> s->chroma_x_shift; > > + int chroma_mb_h = h >> s->chroma_y_shift; > > > > if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16; > > if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16; > > > > if(w==16 && h==16) > > if(s->avctx->mb_cmp == FF_CMP_NSSE){ > > > - return s->mecc.nsse[0](s, s->new_picture->data[0] + s->mb_x * 16 + s- > >mb_y * s->linesize * 16, s->dest[0], s->linesize, 16) + > > + return s->mecc.nsse[0](s, s->new_picture->data[0] + s->mb_x * 16 + > s->mb_y * s->linesize * 16, > > + s->dest[0], s->linesize, 16) + > > This doesnt belong in this patch, its not a functional change and makes it > harder to see what is changed > > please seperate this in a seperate patch if you want to suggest this > whitespace change > > thx Ok, I will separate it into two patches and resubmit them. Thanks > > > > - s->mecc.nsse[1](s, s->new_picture->data[1] + s->mb_x * 8 + s- > >mb_y * s->uvlinesize * 8, s->dest[1], s->uvlinesize, 8) + > > - s->mecc.nsse[1](s, s->new_picture->data[2] + s->mb_x * 8 + s- > >mb_y * s->uvlinesize * 8, s->dest[2], s->uvlinesize, 8); > > + s->mecc.nsse[1](s, s->new_picture->data[1] + s->mb_x * > chroma_mb_w + s->mb_y * s->uvlinesize * chroma_mb_h, > > + s->dest[1], s->uvlinesize, chroma_mb_h) + > > + s->mecc.nsse[1](s, s->new_picture->data[2] + s->mb_x * > chroma_mb_w + s->mb_y * s->uvlinesize * chroma_mb_h, > > + s->dest[2], s->uvlinesize, chroma_mb_h); > > [...] > -- > Michael GnuPG fingerprint: > 9FF2128B147EF6730BADF133611EC787040B0FAB > > If you fake or manipulate statistics in a paper in physics you will never > get a job again. > If you fake or manipulate statistics in a paper in medicin you will get > a job for life at the pharma industry. _______________________________________________ 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".