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 DF1ED4C839 for ; Tue, 6 Aug 2024 22:24:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 81E0A68DADC; Wed, 7 Aug 2024 01:24:46 +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 910E168D980 for ; Wed, 7 Aug 2024 01:24:40 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id F00CA1BF206 for ; Tue, 6 Aug 2024 22:24:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1722983080; 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=0G26otkbx+QQ+w58+ER0EP3pZwwfiWv9nT9z9Wi1Se4=; b=Qwx0uhtQV01nFMONBQBW1RPddTFhx/hCsz9jCBaiCmXpxCeEqkerbIje9mUwb/Mrzc0uke ysd0XehvfRH327lB/RojpXu8GZ+Cd1fkzTbeONlPfl2U2OnlPB3A4au9ADUvfCS0mRDsw7 uPS5vt56aZHrEdNUZoFcu/OIEgcqdUEy2RBc7nBE1DHQtDhIvviDm93UadWDAmwjwT2wqa e3DPWwV8MQDdWI3cW/3+maCm+KKybjr6tZHtw1H3kNy0pFehLSKO9sM8/DvMeqL2QlP3Hm AcAYlFqv2SOHP3xv5u6Zcr6CmJuEeQn2C1NOAdqMheZCYv8cSkGg7/MFkCR9gA== Date: Wed, 7 Aug 2024 00:24:39 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240806222439.GP4991@pb2> References: <20240602121448.1069-1-kasper93@gmail.com> MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH] avcodec/vp9mvs: fix misaligned access when clearing VP9mv 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: multipart/mixed; boundary="===============7324027995557992865==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============7324027995557992865== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="2c0FR1slMgJLxfC0" Content-Disposition: inline --2c0FR1slMgJLxfC0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jun 02, 2024 at 07:05:37PM -0400, Ronald S. Bultje wrote: > Hi, >=20 > On Sun, Jun 2, 2024 at 6:43=E2=80=AFPM Kacper Michajlow wrote: >=20 > > On Sun, 2 Jun 2024 at 23:17, Ronald S. Bultje wrot= e: > > > > > > Hi, > > > > > > On Sun, Jun 2, 2024 at 9:12=E2=80=AFAM James Almer wrote: > > > > > > > On 6/2/2024 10:06 AM, James Almer wrote: > > > > > On 6/2/2024 9:14 AM, Kacper Michaj=C5=82ow wrote: > > > > >> Fixes runtime error: member access within misaligned address > > > > >> for type 'av_alias64', which requires 8 byte alignment. > > > > >> > > > > >> VP9mv is aligned to 4 bytes, so instead doing 8 bytes clear, let= 's > > do > > > > >> 2 times 4 bytes. > > > > >> > > > > >> Signed-off-by: Kacper Michaj=C5=82ow > > > > >> --- > > > > >> libavcodec/vp9mvs.c | 3 ++- > > > > >> 1 file changed, 2 insertions(+), 1 deletion(-) > > > > >> > > > > >> diff --git a/libavcodec/vp9mvs.c b/libavcodec/vp9mvs.c > > > > >> index b706d1660f..790cf629a6 100644 > > > > >> --- a/libavcodec/vp9mvs.c > > > > >> +++ b/libavcodec/vp9mvs.c > > > > >> @@ -294,7 +294,8 @@ void ff_vp9_fill_mv(VP9TileData *td, VP9mv *= mv, > > > > >> int mode, int sb) > > > > >> VP9Block *b =3D td->b; > > > > >> if (mode =3D=3D ZEROMV) { > > > > >> - AV_ZERO64(mv); > > > > >> + AV_ZERO32(&mv[0]); > > > > >> + AV_ZERO32(&mv[1]); > > > > >> } else { > > > > >> int hp; > > > > > > > > > > IMO just move mv in VP9Block to the top of the struct. That will = make > > > > > sure it's aligned to at the very least 16 byte (Since it's > > av_malloc'd). > > > > > > > > Actually nevermind, VP9mv has two int16_t and given what's passed to > > > > ff_vp9_fill_mv() it's not enough. > > > > > > > > > > Do compilers on relevant platforms convert this to a single 64bit > > > (unaligned) zero-move? Otherwise, we may want an unaligned AV_ZERO64(= ) so > > > as to not slow down platforms supporting unaligned writes. > > > > Yes, exactly, compilers do that. I've checked before sending this > > patch if it doesn't do something overly silly. > > > > You can play around here to see, I've extracted relevant part > > https://godbolt.org/z/K4d7Ejb1P > > >=20 > Thanks for checking, patch is fine with me. will apply thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you drop bombs on a foreign country and kill a hundred thousand innocent people, expect your government to call the consequence "unprovoked inhuman terrorist attacks" and use it to justify dropping more bombs and killing more people. The technology changed, the idea is old. --2c0FR1slMgJLxfC0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZrKioAAKCRBhHseHBAsP q3MLAJ4r42fqdurVt0oEOeJWXJlqSv1kYgCgkx4RUj7rCzgFdNtTdAqXvTcbcto= =XAR6 -----END PGP SIGNATURE----- --2c0FR1slMgJLxfC0-- --===============7324027995557992865== 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". --===============7324027995557992865==--