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 77B0849ECD for ; Tue, 20 May 2025 04:19:08 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 9F8E168D3FF; Tue, 20 May 2025 07:19:02 +0300 (EEST) Received: from mx.sdf.org (mx.sdf.org [205.166.94.24]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 9DE3668CD18 for ; Tue, 20 May 2025 07:18:55 +0300 (EEST) Received: from 28828826f30850df2d2bb146bd869914 ([1.145.249.134]) (authenticated (0 bits)) by mx.sdf.org (8.18.1/8.14.3) with ESMTPSA id 54K4IjeX016822 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO) for ; Tue, 20 May 2025 04:18:51 GMT Date: Tue, 20 May 2025 14:18:43 +1000 From: Peter Ross To: FFmpeg development discussions and patches Message-ID: Mail-Followup-To: FFmpeg development discussions and patches References: MIME-Version: 1.0 In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] avcodec/rv60dec: Avoid branch when decoding cbp16 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="===============0552564229621759784==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============0552564229621759784== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="RfL6Tq9BiclEjzNv" Content-Disposition: inline --RfL6Tq9BiclEjzNv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 19, 2025 at 12:06:02AM +0200, Andreas Rheinhardt wrote: > Patch attached. >=20 > - Andreas > From 02724d5792348bea618c049034dc0febf24a46ac Mon Sep 17 00:00:00 2001 > From: Andreas Rheinhardt > Date: Sun, 18 May 2025 23:12:03 +0200 > Subject: [PATCH] avcodec/rv60dec: Avoid branch when decoding cbp16 >=20 > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/rv60dec.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) >=20 > diff --git a/libavcodec/rv60dec.c b/libavcodec/rv60dec.c > index d704ae512c..2bbcb1d620 100644 > --- a/libavcodec/rv60dec.c > +++ b/libavcodec/rv60dec.c > @@ -82,7 +82,7 @@ enum { > }; > =20 > static const VLCElem * cbp8_vlc[7][4]; > -static const VLCElem * cbp16_vlc[7][3][4]; > +static const VLCElem * cbp16_vlc[7][4][4]; > =20 > typedef struct { > const VLCElem * l0[2]; > @@ -137,12 +137,12 @@ static av_cold void rv60_init_static_data(void) > =20 > for (int i =3D 0; i < 7; i++) > for (int j =3D 0; j < 4; j++) > - cbp8_vlc[i][j] =3D gen_vlc(rv60_cbp8_lens[i][j], 64, &state); > + cbp16_vlc[i][0][j] =3D cbp8_vlc[i][j] =3D gen_vlc(rv60_cbp8_= lens[i][j], 64, &state); > =20 > for (int i =3D 0; i < 7; i++) > for (int j =3D 0; j < 3; j++) > for (int k =3D 0; k < 4; k++) > - cbp16_vlc[i][j][k] =3D gen_vlc(rv60_cbp16_lens[i][j][k],= 64, &state); > + cbp16_vlc[i][j + 1][k] =3D gen_vlc(rv60_cbp16_lens[i][j]= [k], 64, &state); > =20 > build_coeff_vlc(rv60_intra_lens, intra_coeff_vlc, 5, &state); > build_coeff_vlc(rv60_inter_lens, inter_coeff_vlc, 7, &state); > @@ -1650,10 +1650,7 @@ static int decode_super_cbp(GetBitContext * gb, co= nst VLCElem * vlc[4]) > static int decode_cbp16(GetBitContext * gb, int subset, int qp) > { > int cb_set =3D rv60_qp_to_idx[qp]; > - if (!subset) > - return decode_super_cbp(gb, cbp8_vlc[cb_set]); > - else > - return decode_super_cbp(gb, cbp16_vlc[cb_set][subset - 1]); > + return decode_super_cbp(gb, cbp16_vlc[cb_set][subset]); > } > =20 > static int decode_cu_r(RV60Context * s, AVFrame * frame, ThreadContext *= thread, GetBitContext * gb, int xpos, int ypos, int log_size, int qp, int = sel_qp) > --=20 > 2.45.2 Looks okay. What was the motivation for this change. Speed up; any numbers? -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B) --RfL6Tq9BiclEjzNv Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQSpB+AvpuUM0jTNINJnYHnFrEDdawUCaCwCoAAKCRBnYHnFrEDd a3MtAJ97s2uRiPmz0+p3xR8mEllWnqel9wCgpdnGx7NJeavKJzhjAhNHF00cud8= =oO2h -----END PGP SIGNATURE----- --RfL6Tq9BiclEjzNv-- --===============0552564229621759784== 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". --===============0552564229621759784==--