From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 955FD4DE1A for ; Wed, 4 Jun 2025 23:21:26 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 98AA368D579; Thu, 5 Jun 2025 02:21:21 +0300 (EEST) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 37CB268D579 for ; Thu, 5 Jun 2025 02:21:15 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 899AA43216 for ; Wed, 4 Jun 2025 23:21:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1749079274; 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=5qMpt1n3qQUEkA9kKUrnS9LcB5We5zEUEt30x5H2ZhM=; b=WwmGmOSR7i6ZJatEDlV11rG9x1C5590fgX4GEVPBSmCG4RmUuJJh3gwo1NcAN5T8gmzAxX k1iBkfDMt883474Tkl9zzfo+YfHV/mRqyEzAKJOTsrVBzkRtMufZWP/GwwWEkbDm2+nuR4 MM0NHPpzXK6hzlKVwIV5iw1sS2Xgh4NWIXB6mfzCOpdf4f7akPC1XAzNSJB0LJSMxLQMOM gFxR/oxuzPvNmOFTjoLS7AtiPtfd+KyBFJPEJdTxi//TZ5s2DLepdwQXdY5HdHJIOv1qJA l70OOx7eMvWIvvn3JNCm6ZElCld31ZO4RknlehzVf3kmD9zU/GVbEsM8AsPzoA== Date: Thu, 5 Jun 2025 01:21:13 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20250604232113.GV29660@pb2> References: <20250514013954.2987037-1-michael@niedermayer.cc> <20250514013954.2987037-2-michael@niedermayer.cc> <20250530195254.GN29660@pb2> <20250530225130.GQ29660@pb2> <20250604110041.GQ29660@pb2> MIME-Version: 1.0 In-Reply-To: X-GND-State: clean X-GND-Score: -70 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddugddvkeduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdeftddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttdejnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeelkeeggfffiedufeejueffjeduhedttdduledtheevveevtdeiueelhfdtuedtkeenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 2/2] avcodec/sanm: avoid using k in left pxoff check 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="===============1579342979674780561==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1579342979674780561== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="KD6qjLIMEiNaqKKP" Content-Disposition: inline --KD6qjLIMEiNaqKKP Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Servus Manuel On Wed, Jun 04, 2025 at 10:06:28PM +0200, Manuel Lauss wrote: > Servus Michael, >=20 > On Wed, Jun 4, 2025 at 1:00=E2=80=AFPM Michael Niedermayer > wrote: > > > > On Tue, Jun 03, 2025 at 12:30:40PM +0200, Manuel Lauss wrote: > > > Servus Michael, > > > > > > On Sat, May 31, 2025 at 12:51=E2=80=AFAM Michael Niedermayer > > > wrote: > > > > > > > > > > /* smooth top and left block borders with neighb= ours */ > > > > > > > - if (((pxoff - p + k) < 0) || ((pxoff - p + k) >= =3D maxpxo) > > > > > > > + if (((pxoff - p + 0) < 0) || ((pxoff - p + k) >= =3D maxpxo) > > > > > > > || ((pxoff + 3 * p) < 0) || ((pxoff + 3 * p)= >=3D maxpxo) > > > > > > > || (i =3D=3D 0) || (j =3D=3D 0)) > > > > > > > continue; > > > > > > > > > > Oops, yes, that change is correct. > > > > > > > > will apply > > > > > > > > > > > > > I think you should just rip the whole block-smoothing block out > > > > > entirely: it creates a "sawtooth" pattern > > > > > which is more annoying than the "blockiness" it tries to soften. > > > > > > > > probably, but i just wanted to fix the out of array access, > > > > ill leave improvment beyond that to others > > > > > > Is it OK if I just remove this block entirely? I'd commit that along > > > with the other 2 sanm patches I have. > > > > i think you dont understand the bug my change is fixing > > > > Its an out of array access in: > > for (k =3D 0; k < 4; k++) > > *(dst + pxoff + k) =3D ((*(dst + pxoff + k) + *(dst= + pxoff - p + k)) >> 1) & 0x7f; > > > > The hunk: > > /* smooth top and left block borders with neighbours */ > > if (((pxoff - p + k) < 0) || ((pxoff - p + k) >=3D maxpxo) > > || ((pxoff + 3 * p) < 0) || ((pxoff + 3 * p) >=3D maxpx= o) > > || (i =3D=3D 0) || (j =3D=3D 0)) > > continue; > > > > skips this code. If the hunk is removed and nothing else is changed > > its MORE buggy as there will be more out of array accesses >=20 > I was thinking about this: >=20 > diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c > index 00bfef00fe..5912a8c14b 100644 > --- a/libavcodec/sanm.c > +++ b/libavcodec/sanm.c > @@ -732,25 +732,6 @@ static int old_codec4(SANMVideoContext *ctx, > GetByteContext *gb, int top, int le > } > pxo2 =3D pxo2 - 4 + p; > } > - > - /* smooth top and left block borders with neighbours */ > - if (((pxoff - p + k) < 0) || ((pxoff - p + k) >=3D maxpxo) > - || ((pxoff + 3 * p) < 0) || ((pxoff + 3 * p) >=3D maxpxo) > - || (i =3D=3D 0) || (j =3D=3D 0)) > - continue; > - if (param & 0x80) { > - for (k =3D 0; k < 4; k++) > - *(dst + pxoff + k) =3D ((*(dst + pxoff + k) + *(dst > + pxoff - p + k)) >> 1) | 0x80; > - *(dst + pxoff + 1 * p) =3D (*(dst + pxoff + 1 * p) + > *(dst + pxoff + 1 * p - 1)) >> 1 | 0x80; > - *(dst + pxoff + 2 * p) =3D (*(dst + pxoff + 2 * p) + > *(dst + pxoff + 2 * p - 1)) >> 1 | 0x80; > - *(dst + pxoff + 3 * p) =3D (*(dst + pxoff + 3 * p) + > *(dst + pxoff + 3 * p - 1)) >> 1 | 0x80; > - } else { > - for (k =3D 0; k < 4; k++) > - *(dst + pxoff + k) =3D ((*(dst + pxoff + k) + *(dst > + pxoff - p + k)) >> 1) & 0x7f; > - *(dst + pxoff + 1 * p) =3D (*(dst + pxoff + 1 * p) + > *(dst + pxoff + 1 * p - 1)) >> 1; > - *(dst + pxoff + 2 * p) =3D (*(dst + pxoff + 2 * p) + > *(dst + pxoff + 2 * p - 1)) >> 1; > - *(dst + pxoff + 3 * p) =3D (*(dst + pxoff + 3 * p) + > *(dst + pxoff + 3 * p - 1)) >> 1; > - } > } ahh, yes thats fine thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Into a blind darkness they enter who follow after the Ignorance, they as if into a greater darkness enter who devote themselves to the Knowledge alone. -- Isha Upanishad --KD6qjLIMEiNaqKKP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCaEDU5QAKCRBhHseHBAsP q0QqAJ4rpCJIqrtFfDAMgaogF+JoNeUKNQCfdj+9rS2H/tv7nNE4rr5Yi83xi2M= =ImXO -----END PGP SIGNATURE----- --KD6qjLIMEiNaqKKP-- --===============1579342979674780561== 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". --===============1579342979674780561==--