From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <ffmpeg-devel-bounces@ffmpeg.org> Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 10D044CE70 for <ffmpegdev@gitmailbox.com>; Wed, 16 Apr 2025 00:24:53 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E0080687DBE; Wed, 16 Apr 2025 03:24:49 +0300 (EEST) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8FD19687D02 for <ffmpeg-devel@ffmpeg.org>; Wed, 16 Apr 2025 03:24:43 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id E435E43AFE for <ffmpeg-devel@ffmpeg.org>; Wed, 16 Apr 2025 00:24:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1744763083; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gFRtBKbuQ1EsuI1s7ysTAYL//3t2SAZgQmnM5Ys+ZSU=; b=mgAuTry156ERRKzryV6YFbu+meDfTU7aHxWVl8zqbR1GGAkHcB+kb5yoNiSJ1Tr+/rfYqU Z28P232ZPPxrZJaBYtNd6W1z50rEeX40Q14yufMQjKDuRhQTc2bpw7LGEGuydBji06X4ML bcPv3/5+UtRHEd9y/m3+wWaH03lKyyhObYxhJvK/88sR03+Cj3U7t6VpdoH9QcMMIhQXqv bYgPBpXsDt14zBGez/u8nljHOy9oxULNBcMw5n2AZ0OV1EZl7zMxLskcOhdDUsvQaIrWK6 AZG8QR9Y2v7axAaaun+DCfTOSARh0bg+GDJcmvTy5Q7Ft+ALKHQD+obf7VS3SA== Date: Wed, 16 Apr 2025 02:24:42 +0200 From: Michael Niedermayer <michael@niedermayer.cc> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Message-ID: <20250416002442.GB4991@pb2> References: <12e23f21-fbba-4b4f-8554-b043881dc332@visionular.com> MIME-Version: 1.0 In-Reply-To: <12e23f21-fbba-4b4f-8554-b043881dc332@visionular.com> X-GND-State: clean X-GND-Score: -90 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvvdegleefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculddutddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeffledtfeevfeffheeuuefhtdejieelueeftdeitdfgheetgefffeefteekffdthfenucffohhmrghinhepfhhfmhhpvghgrdhorhhgnecukfhppeeguddrieeirdeijedruddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeguddrieeirdeijedruddufedphhgvlhhopehlohgtrghlhhhoshhtpdhmrghilhhfrhhomhepmhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtpdhnsggprhgtphhtthhopedupdhrtghpthhtohepfhhfmhhpvghgqdguvghvvghlsehffhhmphgvghdrohhrgh X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH] avcodec/h264_mb: Fix buffer stride for arm X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org> List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe> List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel> List-Post: <mailto:ffmpeg-devel@ffmpeg.org> List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help> List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe> Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Content-Type: multipart/mixed; boundary="===============0594439780232718423==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org> Archived-At: <https://master.gitmailbox.com/ffmpegdev/20250416002442.GB4991@pb2/> List-Archive: <https://master.gitmailbox.com/ffmpegdev/> List-Post: <mailto:ffmpegdev@gitmailbox.com> --===============0594439780232718423== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="KrmBNr9zM1fZkpcF" Content-Disposition: inline --KrmBNr9zM1fZkpcF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 08, 2025 at 07:22:32PM +0800, Bin Peng wrote: > When decoding a bitstream with weighted-bipred enabled, > the results on ARM and x86 platforms may differ. >=20 > The reason for the inconsistency is that the value of > STRIDE_ALIGN differs between platforms. And STRIDE_ALIGN > is set to the buffer stride of temporary buffers for U > and V components in mc_part_weighted. >=20 > If the buffer stride is 32 or 64 (as on x86 platforms), > the U and V pixels can be interleaved row by row without > overlapping, resulting in correct output. > However, on ARM platforms where the stride is 16, > the V component will overwrite part of the U component's pixels, > leading to incorrect predicted pixels. >=20 > The bug can be reproduced by the following bitstream. >=20 > https://trac.ffmpeg.org/attachment/ticket/11357/inter_weighted_bipred2.264 >=20 > And the ref/fate file is also added in this patch. >=20 > Fixes: ticket 11357 > Signed-off-by: Bin Peng <pengbin@visionular.com> > --- > libavcodec/utils.c | 4 ++- > .../h264-conformance-weighted_bipred2.264 | 31 +++++++++++++++++++ is this supposed to be a fate test ? if so theres something missing also the file extension is a bit misleading and tests covering more cases is always welcome > 2 files changed, 34 insertions(+), 1 deletion(-) > create mode 100644 tests/ref/fate/h264-conformance-weighted_bipred2.264 >=20 > diff --git a/libavcodec/utils.c b/libavcodec/utils.c > index 90867ed6b1..5d15f5c8fa 100644 > --- a/libavcodec/utils.c > +++ b/libavcodec/utils.c > @@ -144,6 +144,7 @@ void avcodec_align_dimensions2(AVCodecContext *s, int= *width, int *height, > int i; > int w_align =3D 1; > int h_align =3D 1; > + int stride_align =3D STRIDE_ALIGN; > AVPixFmtDescriptor const *desc =3D av_pix_fmt_desc_get(s->pix_fmt); > =20 > if (desc) { > @@ -339,13 +340,14 @@ void avcodec_align_dimensions2(AVCodecContext *s, i= nt *width, int *height, > // increasing witdth ensure that the temporary area is large eno= ugh, > // the next rounded up width is 32 > *width =3D FFMAX(*width, 32); > + stride_align =3D FFMAX(stride_align, 32); does the following fix this too ? diff --git a/libavcodec/h264_mb.c b/libavcodec/h264_mb.c index 6083f7ad84f..0d6562b5830 100644 --- a/libavcodec/h264_mb.c +++ b/libavcodec/h264_mb.c @@ -407,7 +407,7 @@ static av_always_inline void mc_part_weighted(const H26= 4Context *h, H264SliceCon /* don't optimize for luma-only case, since B-frames usually * use implicit weights =3D> chroma too. */ uint8_t *tmp_cb =3D sl->bipred_scratchpad; - uint8_t *tmp_cr =3D sl->bipred_scratchpad + (16 << pixel_shift); + uint8_t *tmp_cr =3D sl->bipred_scratchpad + (8 << pixel_shift + (c= hroma_idc =3D=3D 3)); uint8_t *tmp_y =3D sl->bipred_scratchpad + 16 * sl->mb_uvlinesize; int refn0 =3D sl->ref_cache[0][scan8[n]]; int refn1 =3D sl->ref_cache[1][scan8[n]]; [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Never trust a computer, one day, it may think you are the virus. -- Compn --KrmBNr9zM1fZkpcF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZ/74wwAKCRBhHseHBAsP q8tCAJsHIFKHDJzF6VMZoyXLqkmekD+lTwCfQUTiRAQm8DDn/h5dwVG50NVVWLc= =Fx5N -----END PGP SIGNATURE----- --KrmBNr9zM1fZkpcF-- --===============0594439780232718423== 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". --===============0594439780232718423==--