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 3849747E32 for ; Fri, 27 Oct 2023 19:45:14 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7E4A768CB87; Fri, 27 Oct 2023 22:45:12 +0300 (EEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E70A468C97F for ; Fri, 27 Oct 2023 22:45:05 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 44A1BC0004 for ; Fri, 27 Oct 2023 19:45:05 +0000 (UTC) Date: Fri, 27 Oct 2023 21:45:04 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20231027194504.GY3543730@pb2> References: <20231004225921.30287-1-michael@niedermayer.cc> <20231004225921.30287-3-michael@niedermayer.cc> <00e301da08ad$cbaf7910$630e6b30$@samsung.com> MIME-Version: 1.0 In-Reply-To: <00e301da08ad$cbaf7910$630e6b30$@samsung.com> X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 3/4] avcodec/evc_parse: remove pow() and log2() 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="===============8471289249396407460==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============8471289249396407460== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="15Iw3Lf/LpNeEr+p" Content-Disposition: inline --15Iw3Lf/LpNeEr+p Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 27, 2023 at 10:15:49AM +0200, Dawid Kozinski/Multimedia (PLT) /= SRPOL/Staff Engineer/Samsung Electronics wrote: >=20 >=20 >=20 >=20 > > -----Original Message----- > > From: ffmpeg-devel On Behalf Of > > Michael Niedermayer > > Sent: czwartek, 5 pa=C5=BAdziernika 2023 00:59 > > To: FFmpeg development discussions and patches > > Subject: [FFmpeg-devel] [PATCH 3/4] avcodec/evc_parse: remove pow() and > > log2() > >=20 > > The use of float based functions is both unneeded and wrong due to > > unpredictable rounding > >=20 > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/evc_parse.c | 10 ++++++---- > > 1 file changed, 6 insertions(+), 4 deletions(-) > >=20 > > diff --git a/libavcodec/evc_parse.c b/libavcodec/evc_parse.c index > > 5ab33166cf3..20b6849041a 100644 > > --- a/libavcodec/evc_parse.c > > +++ b/libavcodec/evc_parse.c > > @@ -176,7 +176,8 @@ int ff_evc_derive_poc(const EVCParamSets *ps, const > > EVCParserSliceHeader *sh, > > poc->PicOrderCntVal =3D 0; > > poc->DocOffset =3D -1; > > } else { > > - int SubGopLength =3D (int)pow(2.0, sps->log2_sub_gop_lengt= h); > > + int SubGopLength =3D 1 << sps->log2_sub_gop_length; > > + > > if (tid =3D=3D 0) { > > poc->PicOrderCntVal =3D poc->prevPicOrderCntVal + > SubGopLength; > > poc->DocOffset =3D 0; > > @@ -191,15 +192,16 @@ int ff_evc_derive_poc(const EVCParamSets *ps, con= st > > EVCParserSliceHeader *sh, > > poc->prevPicOrderCntVal +=3D SubGopLength; > > ExpectedTemporalId =3D 0; > > } else > > - ExpectedTemporalId =3D 1 + (int)log2(poc->DocOffse= t); > > + ExpectedTemporalId =3D 1 + av_log2(poc->DocOffset); > > + > > while (tid !=3D ExpectedTemporalId) { > > poc->DocOffset =3D (poc->DocOffset + 1) % SubGopLe= ngth; > > if (poc->DocOffset =3D=3D 0) > > ExpectedTemporalId =3D 0; > > else > > - ExpectedTemporalId =3D 1 + > (int)log2(poc->DocOffset); > > + ExpectedTemporalId =3D 1 + > > + av_log2(poc->DocOffset); > > } > > - PocOffset =3D (int)(SubGopLength * ((2.0 * poc->DocOff= set + > 1) / > > (int)pow(2.0, tid) - 2)); > > + PocOffset =3D (int)(SubGopLength * ((2.0 * poc->DocOff= set > > + + 1) / (1 << tid) - 2)); > > poc->PicOrderCntVal =3D poc->prevPicOrderCntVal + > PocOffset; > > } > > } > > -- > > 2.17.1 > >=20 > Reviewed. Looks good. It can be merged. will apply thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is what and why we do it that matters, not just one of them. --15Iw3Lf/LpNeEr+p Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZTwTQAAKCRBhHseHBAsP q68CAKCQGSjl7vY+OTo2W5AWtoW2wWq+7QCeKY+MJgacdZTHLCnhvcC0xUsdHoc= =3sUr -----END PGP SIGNATURE----- --15Iw3Lf/LpNeEr+p-- --===============8471289249396407460== 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". --===============8471289249396407460==--