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 2976047614 for ; Thu, 14 Sep 2023 22:01:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1C8BD68C807; Fri, 15 Sep 2023 01:01:43 +0300 (EEST) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D0D1F68C579 for ; Fri, 15 Sep 2023 01:01:36 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 83C511BF203 for ; Thu, 14 Sep 2023 22:01:35 +0000 (UTC) Date: Fri, 15 Sep 2023 00:01:34 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230914220134.GT8640@pb2> References: MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH] MULTI VLC decoding boost 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="===============1970146272224135603==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1970146272224135603== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GXtmylMy6DdaH5oR" Content-Disposition: inline --GXtmylMy6DdaH5oR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 28, 2023 at 07:36:17PM +0200, Paul B Mahol wrote: > Patches attached. >=20 > Thanks for kurosu for pointing unmerged branches. >=20 > The UNCACHED_PATH for x86_32 is broken with this for 2 codecs it touches. > Fix is trivial, to be fixed later. [...] > +int ff_init_vlc_multi_from_lengths(VLC *vlc, VLC_MULTI *multi, int nb_bi= ts, int nb_elems, > + int nb_codes, const int8_t *lens, int lens_wrap, > + const void *symbols, int symbols_wrap= , int symbols_size, > + int offset, int flags, void *logctx) > +{ > + VLCcode localbuf[LOCALBUF_ELEMS], *buf =3D localbuf; > + uint64_t code; > + int ret, j, len_max =3D FFMIN(32, 3 * nb_bits); > + > + ret =3D vlc_common_init(vlc, nb_bits, nb_codes, &buf, flags); > + if (ret < 0) > + return ret; > + > + multi->table =3D av_malloc(sizeof(*multi->table) << nb_bits); > + if (!multi->table) > + return AVERROR(ENOMEM); > + > + j =3D code =3D 0; > + for (int i =3D 0; i < nb_codes; i++, lens +=3D lens_wrap) { > + int len =3D *lens; > + if (len > 0) { > + unsigned sym; > + > + buf[j].bits =3D len; > + if (symbols) > + GET_DATA(sym, symbols, i, symbols_wrap, symbols_size) > + else > + sym =3D i; > + buf[j].symbol =3D sym + offset; > + buf[j++].code =3D code; > + } else if (len < 0) { > + len =3D -len; > + } else > + continue; > + if (len > len_max || code & ((1U << (32 - len)) - 1)) { > + av_log(logctx, AV_LOG_ERROR, "Invalid VLC (length %u)\n", le= n); > + goto fail; > + } > + code +=3D 1U << (32 - len); > + if (code > UINT32_MAX + 1ULL) { > + av_log(logctx, AV_LOG_ERROR, "Overdetermined VLC tree\n"); > + goto fail; > + } > + } > + ret =3D vlc_common_end(vlc, nb_bits, j, buf, flags, localbuf); > + if (ret < 0) > + goto fail; > + return vlc_multi_gen(multi->table, vlc, nb_elems, j, nb_bits, buf, l= ogctx); > +fail: > + if (buf !=3D localbuf) > + av_free(buf); > + return AVERROR_INVALIDDATA; > +} this is copy and pasted from int ff_vlc_init_from_lengths(VLC *vlc, int nb_bits, int nb_codes, leading to code duplication, it would be better if you could factor the duplication out thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB "You are 36 times more likely to die in a bathtub than at the hands of a terrorist. Also, you are 2.5 times more likely to become a president and 2 times more likely to become an astronaut, than to die in a terrorist attack." -- Thoughty2 --GXtmylMy6DdaH5oR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZQOCuwAKCRBhHseHBAsP q+m6AKCWaSsuwENcuJKlEUDZSzNrPQP3kQCdFQhpPjGMUxTkkGOupRkw8UaZovY= =BrPA -----END PGP SIGNATURE----- --GXtmylMy6DdaH5oR-- --===============1970146272224135603== 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". --===============1970146272224135603==--