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 DC78043332 for ; Fri, 1 Jul 2022 21:25:22 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4F40068B793; Sat, 2 Jul 2022 00:25:20 +0300 (EEST) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D3B3968B65E for ; Sat, 2 Jul 2022 00:25:13 +0300 (EEST) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id F229960005 for ; Fri, 1 Jul 2022 21:25:12 +0000 (UTC) Date: Fri, 1 Jul 2022 23:25:11 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20220701212511.GY396728@pb2> References: MIME-Version: 1.0 In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH 14/18] avcodec/hevcdec: Don't allocate redundant HEVCContexts 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="===============2356193670054441472==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============2356193670054441472== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="NorxubhVDU3UEqW5" Content-Disposition: inline --NorxubhVDU3UEqW5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 01, 2022 at 12:29:45AM +0200, Andreas Rheinhardt wrote: > The HEVC decoder has both HEVCContext and HEVCLocalContext > structures. The latter is supposed to be the structure > containing the per-slicethread state. >=20 > Yet up until now that is not how it is handled in practice: > Each HEVCLocalContext has a unique HEVCContext allocated for it > and each of these coincides except in exactly one field: The > corresponding HEVCLocalContext. This makes it possible to pass > the HEVCContext everywhere where logically a HEVCLocalContext > should be used. And up until recently, this is how it has been done. >=20 > Yet the preceding patches changed this, making it possible > to avoid allocating redundant HEVCContexts. >=20 > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/hevcdec.c | 40 ++++++++++++++++------------------------ > libavcodec/hevcdec.h | 2 -- > 2 files changed, 16 insertions(+), 26 deletions(-) >=20 > diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c > index 9d1241f293..048fcc76b4 100644 > --- a/libavcodec/hevcdec.c > +++ b/libavcodec/hevcdec.c > @@ -2548,13 +2548,12 @@ static int hls_decode_entry_wpp(AVCodecContext *a= vctxt, void *hevc_lclist, > { > HEVCLocalContext *lc =3D ((HEVCLocalContext**)hevc_lclist)[self_id]; > const HEVCContext *const s =3D lc->parent; > - HEVCContext *s1 =3D avctxt->priv_data; > - int ctb_size =3D 1<< s1->ps.sps->log2_ctb_size; > + int ctb_size =3D 1 << s->ps.sps->log2_ctb_size; > int more_data =3D 1; > int ctb_row =3D job; > - int ctb_addr_rs =3D s1->sh.slice_ctb_addr_rs + ctb_row * ((s1->ps.sp= s->width + ctb_size - 1) >> s1->ps.sps->log2_ctb_size); > - int ctb_addr_ts =3D s1->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs]; > - int thread =3D ctb_row % s1->threads_number; > + int ctb_addr_rs =3D s->sh.slice_ctb_addr_rs + ctb_row * ((s->ps.sps-= >width + ctb_size - 1) >> s->ps.sps->log2_ctb_size); > + int ctb_addr_ts =3D s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs]; > + int thread =3D ctb_row % s->threads_number; > int ret; > =20 > if(ctb_row) { > @@ -2572,7 +2571,7 @@ static int hls_decode_entry_wpp(AVCodecContext *avc= txt, void *hevc_lclist, > =20 > ff_thread_await_progress2(s->avctx, ctb_row, thread, SHIFT_CTB_W= PP); > =20 > - if (atomic_load(&s1->wpp_err)) { > + if (atomic_load(&s->wpp_err)) { > ff_thread_report_progress2(s->avctx, ctb_row , thread, SHIFT= _CTB_WPP); the consts in "const HEVCContext *const " make clang version 6.0.0-1ubuntu2= unhappy (this was building shared libs) CC libavcodec/hevcdec.o src/libavcodec/hevcdec.c:2574:13: error: address argument to atomic operati= on must be a pointer to non-const _Atomic type ('const atomic_int *' (aka '= const _Atomic(int) *') invalid) if (atomic_load(&s->wpp_err)) { ^ ~~~~~~~~~~~ /usr/lib/llvm-6.0/lib/clang/6.0.0/include/stdatomic.h:134:29: note: expande= d from macro 'atomic_load' #define atomic_load(object) __c11_atomic_load(object, __ATOMIC_SEQ_CST) ^ ~~~~~~ 1 error generated. src/ffbuild/common.mak:81: recipe for target 'libavcodec/hevcdec.o' failed make: *** [libavcodec/hevcdec.o] Error 1 thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 2 "100% positive feedback" - "All either got their money back or didnt compla= in" "Best seller ever, very honest" - "Seller refunded buyer after failed scam" --NorxubhVDU3UEqW5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCYr9mNAAKCRBhHseHBAsP q2CxAJ9N0rDCNbY9m2P7l5ZU9nfB9Yp8dACfaZz/F1bZO+YByafYbCAkf4HNOW4= =/TvV -----END PGP SIGNATURE----- --NorxubhVDU3UEqW5-- --===============2356193670054441472== 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". --===============2356193670054441472==--