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 7E30B4AC7D for ; Wed, 17 Jul 2024 22:32:48 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2E33968DAEB; Thu, 18 Jul 2024 01:32:46 +0300 (EEST) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8503668DAA0 for ; Thu, 18 Jul 2024 01:32:39 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id D1B77240002 for ; Wed, 17 Jul 2024 22:32:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1721255559; 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=N8VA6Yhb8mGmB6oeZhJwX/34axJT4F9sIuWCrDIQ3KY=; b=LKEXKXmsI1v0JuJ+mIYbRounut4aBBVDkhd2IBN4mZs7+nO7EUKYMCEllQQAD+M2M3W6lC eUyGfj2u3JqnCUWkDDeiIQQBorfxTW6Y8o+M3AutJtCglDkGIC3cZvV5GkGkKL1fiHRlBT Wthwmbxe+Bb4UWj/L+OCn4pdK7hOgk2DckFLxmNTUbHx3MlVEHeaeTU12NLYNUkIvCbNl+ MVxKe7c6LceKr/kAZSOxrRHhxSmjytDzbdnvcUWAWLHN/NBrkeneeiRsEU9bR7yva24WEI dRhk0yjVpuMaPbfQ2WZxVrkJg+3oix/VBNfZsVaS5Nd7slLOGPT4fP9ezQhIng== Date: Thu, 18 Jul 2024 00:32:38 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240717223238.GW4991@pb2> References: <20240716171155.31838-1-anton@khirnov.net> <20240716171155.31838-13-anton@khirnov.net> MIME-Version: 1.0 In-Reply-To: <20240716171155.31838-13-anton@khirnov.net> X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 13/39] lavc/ffv1: drop redundant PlaneContext.quant_table 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="===============0901513825087965427==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============0901513825087965427== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="vJioXg+GvQhSmMus" Content-Disposition: inline --vJioXg+GvQhSmMus Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 16, 2024 at 07:11:28PM +0200, Anton Khirnov wrote: > It is a copy of FFV1Context.quant_tables[quant_table_index]. > --- > libavcodec/ffv1.h | 1 - > libavcodec/ffv1_template.c | 22 +++++++++++----------- > libavcodec/ffv1dec.c | 28 ++++++++++++---------------- > libavcodec/ffv1dec_template.c | 14 +++++++++----- > libavcodec/ffv1enc.c | 24 ++++++++++++------------ > libavcodec/ffv1enc_template.c | 13 ++++++++----- > 6 files changed, 52 insertions(+), 50 deletions(-) >=20 > diff --git a/libavcodec/ffv1.h b/libavcodec/ffv1.h > index 4d57172d5b..a87c2d2a36 100644 > --- a/libavcodec/ffv1.h > +++ b/libavcodec/ffv1.h > @@ -59,7 +59,6 @@ typedef struct VlcState { > } VlcState; > =20 > typedef struct PlaneContext { > - int16_t quant_table[MAX_CONTEXT_INPUTS][256]; > int quant_table_index; > int context_count; > uint8_t (*state)[CONTEXT_SIZE]; > diff --git a/libavcodec/ffv1_template.c b/libavcodec/ffv1_template.c > index c5f61b0182..d15ad11021 100644 > --- a/libavcodec/ffv1_template.c > +++ b/libavcodec/ffv1_template.c > @@ -29,25 +29,25 @@ static inline int RENAME(predict)(TYPE *src, TYPE *la= st) > return mid_pred(L, L + T - LT, T); > } > =20 > -static inline int RENAME(get_context)(PlaneContext *p, TYPE *src, > - TYPE *last, TYPE *last2) > +static inline int RENAME(get_context)(const int16_t quant_table[MAX_CONT= EXT_INPUTS][256], > + TYPE *src, TYPE *last, TYPE *last2) > { > const int LT =3D last[-1]; > const int T =3D last[0]; > const int RT =3D last[1]; > const int L =3D src[-1]; > =20 > - if (p->quant_table[3][127] || p->quant_table[4][127]) { > + if (quant_table[3][127] || quant_table[4][127]) { the data for each decoder task should be together and not scattered around more than needed, reducing cache efficiency [...] > diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c > index 66d9f63c1a..618020d10f 100644 > --- a/libavcodec/ffv1dec.c > +++ b/libavcodec/ffv1dec.c > @@ -117,7 +117,8 @@ static int is_input_end(FFV1Context *s, GetBitContext= *gb) > #define RENAME(name) name ## 32 > #include "ffv1dec_template.c" > =20 > -static int decode_plane(FFV1Context *s, FFV1SliceContext *sc, > +static int decode_plane(FFV1Context *f, > + FFV1Context *s, FFV1SliceContext *sc, [...] > static av_always_inline int > -RENAME(decode_line)(FFV1Context *s, FFV1SliceContext *sc, GetBitContext = *gb, > +RENAME(decode_line)(FFV1Context *f, > + FFV1Context *s, FFV1SliceContext *sc, > + GetBitContext *gb, > int w, TYPE *sample[2], int plane_index, int bits) > { > PlaneContext *const p =3D &s->plane[plane_index]; > @@ -57,7 +59,8 @@ RENAME(decode_line)(FFV1Context *s, FFV1SliceContext *s= c, GetBitContext *gb, > return AVERROR_INVALIDDATA; > } > =20 > - context =3D RENAME(get_context)(p, sample[1] + x, sample[0] + x,= sample[1] + x); > + context =3D RENAME(get_context)(f->quant_tables[p->quant_table_i= ndex], > + sample[1] + x, sample[0] + x, samp= le[1] + x); putting all this extra code in the inner per pixel loop is not ok especially not for the sake of avoiding a memcpy of a few hundread bytes mu= ltiple levels of loops outside [...] thx --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In a rich man's house there is no place to spit but his face. -- Diogenes of Sinope --vJioXg+GvQhSmMus Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZphGggAKCRBhHseHBAsP q9+wAJwIs0fBHwvjOVCkDAQpBEOGfxUgfwCePvU0tmQCZEIHGxJsVtxOWvtAF/U= =ruAJ -----END PGP SIGNATURE----- --vJioXg+GvQhSmMus-- --===============0901513825087965427== 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". --===============0901513825087965427==--