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 28D6F45D48 for ; Thu, 6 Apr 2023 19:18:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D3C2E68B43E; Thu, 6 Apr 2023 22:18:36 +0300 (EEST) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3D2986898AA for ; Thu, 6 Apr 2023 22:18:30 +0300 (EEST) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 54993FF808 for ; Thu, 6 Apr 2023 19:18:29 +0000 (UTC) Date: Thu, 6 Apr 2023 21:18:28 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230406191828.GC1164690@pb2> References: <20230330231441.8868-1-michael@niedermayer.cc> <20230330231441.8868-2-michael@niedermayer.cc> <20230402213429.GO1164690@pb2> MIME-Version: 1.0 In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 2/3] avcodec/j2kenc: Add alpha support 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="===============7128349514017399840==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============7128349514017399840== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="a9msq94+WlNd0NRk" Content-Disposition: inline --a9msq94+WlNd0NRk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 06, 2023 at 10:15:48AM -0400, Leo Izen wrote: >=20 >=20 > On 4/2/23 17:34, Michael Niedermayer wrote: > > On Fri, Mar 31, 2023 at 01:14:40AM +0200, Michael Niedermayer wrote: > > > Signed-off-by: Michael Niedermayer > > > --- > > > libavcodec/j2kenc.c | 28 ++++++++++++++++++---------- > > > 1 file changed, 18 insertions(+), 10 deletions(-) > > >=20 > > > diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c > > > index 97b0da1c976..b23fb73770a 100644 > > > --- a/libavcodec/j2kenc.c > > > +++ b/libavcodec/j2kenc.c > > > @@ -320,8 +320,8 @@ static int put_siz(Jpeg2000EncoderContext *s) > > > for (i =3D 0; i < s->ncomponents; i++){ // Ssiz_i XRsiz_i, YRsi= z_i > > > bytestream_put_byte(&s->buf, s->cbps[i] - 1); > > > - bytestream_put_byte(&s->buf, i?1<chroma_shift[0]:1); > > > - bytestream_put_byte(&s->buf, i?1<chroma_shift[1]:1); > > > + bytestream_put_byte(&s->buf, (i%3)?1<chroma_shift[0]:1); > > > + bytestream_put_byte(&s->buf, (i%3)?1<chroma_shift[1]:1); > >=20 > > i will replace the %3 by +1&2 to avoid slow modulo before applying > >=20 > >=20 >=20 > (i % 3) and (i + 1) & 2 aren't the same tho, and won't be nonzero at the > same time. `(i + 1) & 2` is equivalent to `(i + 1) % 4`. they are non zero in the same cases for the first 4 planes and we support just 4. So its the same for us. Its a good argument though why gcc may have difficulty doing this substitution on its own thx [...] --=20 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. --a9msq94+WlNd0NRk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iFwEABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZC8a9AAKCRBhHseHBAsP q4L9AJiLu18fLq11RHynC0S15aKYuCrIAJ4tbQabMPzTPcIHTDrIRcCUG+kVlQ== =uNwa -----END PGP SIGNATURE----- --a9msq94+WlNd0NRk-- --===============7128349514017399840== 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". --===============7128349514017399840==--