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 3FFEA4AB6C for ; Wed, 12 Jun 2024 23:52:27 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 868FC68D9EA; Thu, 13 Jun 2024 02:52:25 +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 1F8BE68D923 for ; Thu, 13 Jun 2024 02:52:19 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 6274F1BF206 for ; Wed, 12 Jun 2024 23:52:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1718236338; 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=CCrph3QeMYAumJ+v1gr7fcLCWKlAqG4kc7Oof0/nYL0=; b=luRAeHfqPn9kouvuUVg7l3kTgvmM8FuIdzeRd/BSpUaeyLYUm+9dAJfY4HISppo/Dp4da0 zT0kEYpxoTaNcHYYxZDbbnNzyg2Uco2g/u5A3PNu95s5MrsezhgPJuqX0wXybgM1sNgs1u E9i3sSDML6+PaesG9uKqAH7uIqT7sfn4RiYK/Zjr+zL14D9HLTLryoKmUnki4jkszi3fPU X9gRvdHep42Trakg1dEMFVTxjp01Qzt35WtrHmnGf2o4dYCTucHakaZYs5nMP96VigbdUP GlH0EKEpf20Nk9/T3k5ZmMvnbfZb/jq1ie9Y+Ww3FBf4/TGk5Da87xgckmsJ7A== Date: Thu, 13 Jun 2024 01:52:17 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240612235217.GX2821752@pb2> References: <000c01daa54d$8a0eedf0$9e2cc9d0$@gmail.com> <20240530213132.GE2821752@pb2> <008e01dab529$e5510630$aff31290$@gmail.com> <20240603224202.GD2821752@pb2> <001001dabbce$083f3c70$18bdb550$@gmail.com> <20240611171808.GP2821752@pb2> <005401dabd01$f66608f0$e3321ad0$@gmail.com> MIME-Version: 1.0 In-Reply-To: <005401dabd01$f66608f0$e3321ad0$@gmail.com> X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH v3] area changed: scdet filter 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="===============2456751908984302965==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============2456751908984302965== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="1usLSbZNs6YCgkvZ" Content-Disposition: inline --1usLSbZNs6YCgkvZ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 12, 2024 at 10:51:47PM +0300, radu.taraibuta@gmail.com wrote: > > -----Original Message----- > > From: ffmpeg-devel On Behalf Of > > Michael Niedermayer > > Sent: mar=C8=9Bi, 11 iunie 2024 20:18 > > To: FFmpeg development discussions and patches > > Subject: Re: [FFmpeg-devel] [PATCH v2] area changed: scdet filter > >=20 > > On Tue, Jun 11, 2024 at 10:07:32AM +0300, radu.taraibuta@gmail.com wrot= e: > > > > > > > -----Original Message----- > > > > From: ffmpeg-devel On Behalf Of > > > > Michael Niedermayer > > > > Sent: mar=C8=9Bi, 4 iunie 2024 01:42 > > > > To: FFmpeg development discussions and patches > > > > > > > > Subject: Re: [FFmpeg-devel] [PATCH] area changed: scdet filter > > > > > > > > On Sun, Jun 02, 2024 at 11:17:29PM +0300, radu.taraibuta@gmail.com > > wrote: > > > > > > > > > > > > > > > > -----Original Message----- > > > > > > From: ffmpeg-devel On Behalf > > > > > > Of Michael Niedermayer > > > > > > Sent: vineri, 31 mai 2024 00:32 > > > > > > To: FFmpeg development discussions and patches > > > > > > > > > > > > Subject: Re: [FFmpeg-devel] [PATCH] area changed: scdet filter > > > > > > > > > > > > On Mon, May 13, 2024 at 06:52:19PM +0300, > > > > > > radu.taraibuta@gmail.com > > > > > > wrote: > > > > > > > Previous observations: > > > > > > > > > > > > > > - Inconsistent code style with other filters. (Mostly using > > > > > > > AVFilterLink* link instead of AVFilterLink *link). > > > > > > > I hope it's fine now. > > > > > > > > > > > > > > - Unrelated changes, please split trivial unrelated changes > > > > > > > into separate patches. > > > > > > > Removed trivial changes from this patch. > > > > > > > > > > > > > > - Can't tables be generated at .init/.config_props time? No > > > > > > > point in storing them into binary. > > > > > > > Done. > > > > > > > > > > > > > > - Adding extra delay is not backward compatible change, it > > > > > > > should be implemented properly by adding option for users to = select > > mode: > > > > > > > next & prev frame or just next or prev frame. > > > > > > > Added legacy option to the mode parameter. > > > > > > > > > > > > > > - Could split frame clone change into earlier separate patch. > > > > > > > Cannot be done. It's either frame clone or 1 frame delay. > > > > > > > > > > > > > > - Where are results of improvements with accuracy so it can > > > > > > > be > > > > > confirmed? > > > > > > > Here are my test results with manual labeling of scene change= s: > > > > > > > 2379 Full length movie > > > > > > > > > > > > > > Method Threshold TP FP FN > > Precision > > > > > > > Recall F > > > > > > > Cubic 7 2357 423 22 0.847841727 > > > > > 0.990752417 > > > > > > > 0.913742973 > > > > > > > Cubic 10 2297 200 82 0.919903885 > > > > > 0.965531736 > > > > > > > 0.94216571 > > > > > > > Cubic 12 2217 146 162 0.938214135 > > > > > 0.931904161 > > > > > > > 0.935048503 > > > > > > > Cubic 15 2049 101 330 0.953023256 > > > > > 0.861286255 > > > > > > > 0.904835505 > > > > > > > Linear 2.8 2357 1060 22 0.689786362 > > > > > 0.990752417 > > > > > > > 0.813319531 > > > > > > > Linear 8 2099 236 280 0.898929336 > > > > > 0.882303489 > > > > > > > 0.890538821 > > > > > > > Linear 10 1886 173 493 0.91597863 > > > > > 0.792770071 > > > > > > > 0.849932402 > > > > > > > Legacy 5 2235 1260 144 0.639484979 > > > > > > 0.939470366 > > > > > > > 0.760980592 > > > > > > > Legacy 8 1998 414 381 0.828358209 > > > > > > 0.839848676 > > > > > > > 0.83406387 > > > > > > > Legacy 10 1743 193 636 0.900309917 > > > > > > 0.732660782 > > > > > > > 0.80787949 > > > > > > > > > > > > > > 15 HDR10Plus_PB_EAC3JOC > > > > > > > https://mega.nz/file/nehDka6Z#C5_OPbSZkONdOp1jRmc09C9- > > > > > > viDc3zMj8ZHruHcW > > > > > > > KyA > > > > > > > > > > > > > > Method Threshold TP FP FN > > Precision > > > > > > > Recall F > > > > > > > Cubic 10 15 0 0 1 1 1 > > > > > > > Linear 5 13 1 2 0.928571429 > > > > > 0.866666667 > > > > > > > 0.896551724 > > > > > > > Legacy 5 12 2 3 0.857142857 0.8 > > > > > > > 0.827586207 > > > > > > > > > > > > > > 21 (HDR HEVC 10-bit BT.2020 24fps) Exodus Sample > > > > > > > > > > > > > > > > > > > https://mega.nz/file/Sfw1hDpK#ErxCOpQDVjcI1gq6ZbX3vIfdtXZompkFe0jq47 > > > > > > E > > > > > > h > > > > > > > R2o > > > > > > > > > > > > > > Method Threshold TP FP FN > > Precision > > > > > > > Recall F > > > > > > > Cubic 10 21 0 0 1 1 1 > > > > > > > Linear 4 20 0 1 1 0.952380952 > > > > > > > 0.975609756 > > > > > > > Legacy 4 19 0 2 1 0.904761905 > > > > > > 0.95 > > > > > > > > > > > > > > 94 Bieber Grammys > > > > > > > https://mega.nz/#!c9dhAaKA!MG5Yi- > > > > > > MJNATE2_KqcnNJZCRKtTWvdjJP1NwG8Ggdw3E > > > > > > > > > > > > > > Method Threshold TP FP FN > > Precision > > > > > > > Recall F > > > > > > > Cubic 15 91 23 3 0.798245614 > > > > > 0.968085106 > > > > > > > 0.875 > > > > > > > Cubic 18 85 9 9 0.904255319 > > > > > 0.904255319 > > > > > > > 0.904255319 > > > > > > > Linear 7 79 49 15 0.6171875 > > > > > 0.840425532 > > > > > > > 0.711711712 > > > > > > > Linear 8 74 28 20 0.725490196 > > > > > 0.787234043 > > > > > > > 0.755102041 > > > > > > > Legacy 7 74 40 20 0.649122807 > > > > > > 0.787234043 > > > > > > > 0.711538462 > > > > > > > Legacy 8 71 26 23 0.731958763 > > > > > > 0.755319149 > > > > > > > 0.743455497 > > > > > > > > > > > > > > > > > > > > > Improve scene detection accuracy by comparing frame with both > > > > > > > previous and next frame (creates one frame delay). > > > > > > > Add new mode parameter and new method to compute the frame > > > > > > > difference using cubic square to increase the weight of small > > > > > > > changes and new mean > > > > > > formula. > > > > > > > This improves accuracy significantly. Slightly improve > > > > > > > performance by not using frame clone. > > > > > > > Add legacy mode for backward compatibility. > > > > > > > > > > > > > > Signed-off-by: raduct > > > > > > > --- > > > > > > > doc/filters.texi | 16 ++++ > > > > > > > libavfilter/scene_sad.c | 151 > > ++++++++++++++++++++++++++++++++++ > > > > > > > libavfilter/scene_sad.h | 6 ++ > > > > > > > libavfilter/vf_scdet.c | 156 +++++++++++++++++++++++++-= ---------- > > > > > > > tests/fate/filter-video.mak | 3 + > > > > > > > 5 files changed, 284 insertions(+), 48 deletions(-) > > > > > > > > > > > > > > diff --git a/doc/filters.texi b/doc/filters.texi index > > > > > > > bfa8ccec8b..53814e003b 100644 > > > > > > > --- a/doc/filters.texi > > > > > > > +++ b/doc/filters.texi > > > > > > > @@ -21797,6 +21797,22 @@ Default value is @code{10.}. > > > > > > > @item sc_pass, s > > > > > > > Set the flag to pass scene change frames to the next filter. > > > > > > > Default value is @code{0} > > > > > > > > > > > > The patch is corrupted by linebreaks: > > > > > > > > > > > > Applying: area changed: scdet filter > > > > > > error: corrupt patch at line 16 > > > > > > Patch failed at 0001 area changed: scdet filter > > > > > > > > > > > > please check the linebreak settings or attach the patch or use > > > > > > git > > > > > send-email > > > > > > > > > > > > thx > > > > > > > > > > > > [...] > > > > > > -- > > > > > > Michael GnuPG fingerprint: > > > > > > 9FF2128B147EF6730BADF133611EC787040B0FAB > > > > > > > > > > > > Homeopathy is like voting while filling the ballot out with > > > > > > transparent > > > > > ink. > > > > > > Sometimes the outcome one wanted occurs. Rarely its worse than > > > > > > filling out > > > > > a > > > > > > ballot properly. > > > > > > > > > > Please find attached the patch. > > > > > > > > > > > > > > doc/filters.texi | 16 ++++ > > > > > libavfilter/scene_sad.c | 151 > > > > ++++++++++++++++++++++++++++++++++++++++++ > > > > > libavfilter/scene_sad.h | 6 + > > > > > libavfilter/vf_scdet.c | 156 +++++++++++++++++++++++++++++= +--------- > > ----- > > > > > tests/fate/filter-video.mak | 3 > > > > > 5 files changed, 284 insertions(+), 48 deletions(-) > > > > > 8f29f2e1c202ab283a9ca0f5d9599de6ab534d7a > > > > > 0001-area-changed-scdet-filter.patch > > > > > From 6d55c65d92376b0ab6e3bb2439af30fbcc430d0b Mon Sep 17 > > 00:00:00 > > > > 2001 > > > > > From: raduct > > > > > Date: Wed, 8 May 2024 08:24:46 +0300 > > > > > Subject: [PATCH] area changed: scdet filter > > > > > > > > > > Improve scene detection accuracy by comparing frame with both > > > > > previous > > > > and next frame (creates one frame delay). > > > > > Add new mode parameter and new method to compute the frame > > > > > difference > > > > using cubic square to increase the weight of small changes and new > > > > mean formula. This improves accuracy significantly. Slightly improve > > > > performance by not using frame clone. > > > > > Add legacy mode for backward compatibility. > > > > > > > > > > Signed-off-by: raduct > > > > > --- > > > > > doc/filters.texi | 16 ++++ > > > > > libavfilter/scene_sad.c | 151 ++++++++++++++++++++++++++++++= ++++ > > > > > libavfilter/scene_sad.h | 6 ++ > > > > > libavfilter/vf_scdet.c | 156 +++++++++++++++++++++++++-----= ------ > > > > > tests/fate/filter-video.mak | 3 + > > > > > 5 files changed, 284 insertions(+), 48 deletions(-) > > > > > > > > fails to build > > > > > > > > libavfilter/scene_sad.c: In function =E2=80=98ff_init_cbrt=E2=80=99: > > > > libavfilter/scene_sad.c:86:5: warning: ISO C90 forbids mixed > > > > declarations and code [-Wdeclaration-after-statement] > > > > 86 | uint8_t *table =3D cbrt_table[bitdepth]; > > > > | ^~~~~~~ > > > > libavfilter/scene_sad.c:92:13: error: implicit declaration of > > > > function =E2=80=98av_malloc=E2=80=99; did you mean =E2=80=98malloc= =E2=80=99? [-Werror=3Dimplicit-function- > > declaration] > > > > 92 | table =3D av_malloc((1 << bitdepth) * (bitdepth > 8 ? 2= : 1)); > > > > | ^~~~~~~~~ > > > > | malloc > > > > libavfilter/scene_sad.c:92:11: warning: assignment to =E2=80=98uint= 8_t *=E2=80=99 > > > > {aka =E2=80=98unsigned char *=E2=80=99} from =E2=80=98int=E2=80=99 = makes pointer from integer without a cast > > [-Wint-conversion] > > > > 92 | table =3D av_malloc((1 << bitdepth) * (bitdepth > 8 ? 2= : 1)); > > > > | ^ > > > > libavfilter/scene_sad.c:98:5: warning: ISO C90 forbids mixed > > > > declarations and code [-Wdeclaration-after-statement] > > > > 98 | int size =3D 1 << bitdepth; > > > > | ^~~ > > > > libavfilter/scene_sad.c: In function =E2=80=98ff_uninit_cbrt=E2=80= =99: > > > > libavfilter/scene_sad.c:120:9: error: implicit declaration of > > > > function =E2=80=98av_free=E2=80=99; did you mean =E2=80=98free=E2= =80=99? [-Werror=3Dimplicit-function- > > declaration] > > > > 120 | av_free(cbrt_table[bitdepth]); > > > > | ^~~~~~~ > > > > | free > > > > libavfilter/scene_sad.c: At top level: > > > > libavfilter/scene_sad.c:126:6: error: no previous prototype for > > > > =E2=80=98ff_scene_scrd_c=E2=80=99 [-Werror=3Dmissing-prototypes] > > > > 126 | void ff_scene_scrd_c(SCENE_SAD_PARAMS) > > > > | ^~~~~~~~~~~~~~~ > > > > libavfilter/scene_sad.c: In function =E2=80=98ff_scene_scrd_c=E2=80= =99: > > > > libavfilter/scene_sad.c:148:5: warning: ISO C90 forbids mixed > > > > declarations and code [-Wdeclaration-after-statement] > > > > 148 | double mean =3D (sqrt(scrdPlus) + sqrt(scrdMinus)) / 2.= 0; > > > > | ^~~~~~ > > > > libavfilter/scene_sad.c: At top level: > > > > libavfilter/scene_sad.c:152:6: error: no previous prototype for > > > > =E2=80=98ff_scene_scrd2B_c=E2=80=99 [-Werror=3Dmissing-prototypes] > > > > 152 | void ff_scene_scrd2B_c(SCENE_SAD_PARAMS, int bitdepth) > > > > | ^~~~~~~~~~~~~~~~~ > > > > libavfilter/scene_sad.c: In function =E2=80=98ff_scene_scrd2B_c=E2= =80=99: > > > > libavfilter/scene_sad.c:179:5: warning: ISO C90 forbids mixed > > > > declarations and code [-Wdeclaration-after-statement] > > > > 179 | double mean =3D (sqrt(scrdPlus) + sqrt(scrdMinus)) / 2.= 0; > > > > | ^~~~~~ > > > > libavfilter/scene_sad.c: At top level: > > > > libavfilter/scene_sad.c:183:6: error: no previous prototype for > > > > =E2=80=98ff_scene_scrd9_c=E2=80=99 [-Werror=3Dmissing-prototypes] > > > > 183 | void ff_scene_scrd9_c(SCENE_SAD_PARAMS) > > > > | ^~~~~~~~~~~~~~~~ > > > > libavfilter/scene_sad.c:188:6: error: no previous prototype for > > > > =E2=80=98ff_scene_scrd10_c=E2=80=99 [-Werror=3Dmissing-prototypes] > > > > 188 | void ff_scene_scrd10_c(SCENE_SAD_PARAMS) > > > > | ^~~~~~~~~~~~~~~~~ > > > > libavfilter/scene_sad.c:193:6: error: no previous prototype for > > > > =E2=80=98ff_scene_scrd12_c=E2=80=99 [-Werror=3Dmissing-prototypes] > > > > 193 | void ff_scene_scrd12_c(SCENE_SAD_PARAMS) > > > > | ^~~~~~~~~~~~~~~~~ > > > > libavfilter/scene_sad.c:198:6: error: no previous prototype for > > > > =E2=80=98ff_scene_scrd14_c=E2=80=99 [-Werror=3Dmissing-prototypes] > > > > 198 | void ff_scene_scrd14_c(SCENE_SAD_PARAMS) > > > > | ^~~~~~~~~~~~~~~~~ > > > > libavfilter/scene_sad.c:203:6: error: no previous prototype for > > > > =E2=80=98ff_scene_scrd16_c=E2=80=99 [-Werror=3Dmissing-prototypes] > > > > 203 | void ff_scene_scrd16_c(SCENE_SAD_PARAMS) > > > > | ^~~~~~~~~~~~~~~~~ > > > > cc1: some warnings being treated as errors > > > > make: *** [ffbuild/common.mak:81: libavfilter/scene_sad.o] Error 1 > > > > make: *** Waiting for unfinished jobs.... > > > > > > > > > > > > [...] > > > > > > > > -- > > > > Michael GnuPG fingerprint: > > > > 9FF2128B147EF6730BADF133611EC787040B0FAB > > > > > > > > Frequently ignored answer#1 FFmpeg bugs should be sent to our > > bugtracker. > > > > User questions about the command line tools should be sent to the > > > > ffmpeg- user ML. > > > > And questions about how to use libav* should be sent to the libav-u= ser ML. > > > > > > Please find attached a new version of the patch. > > > I'm building using msvc and I don't get these warnings. > >=20 > > > doc/filters.texi | 16 ++++ > > > libavfilter/scene_sad.c | 157 > > ++++++++++++++++++++++++++++++++++++++++++ > > > libavfilter/scene_sad.h | 20 +++++ > > > libavfilter/vf_scdet.c | 161 ++++++++++++++++++++++++++++++---= ----------- > > > tests/fate/filter-video.mak | 3 > > > 5 files changed, 309 insertions(+), 48 deletions(-) > > > 20737181fba9670a258cd6345edf36eae954bfa2 > > > 0001-area-changed-scdet-filter.patch > > > From 0a6963360076213d30b70f8297eae3d44a638dab Mon Sep 17 00:00:00 > > 2001 > > > From: raduct > > > Date: Wed, 8 May 2024 08:24:46 +0300 > > > Subject: [PATCH] area changed: scdet filter > >=20 > > breaks fate (infinite loops here on ubuntu) > > TEST filter-metadata-scdet > > ^Cmake: *** [tests/Makefile:311: fate-filter-metadata-scdet] Interrupt > >=20 > > it seems to never exit avformat_find_stream_info() > >=20 > > thx > >=20 > > [...] > >=20 > > -- > > Michael GnuPG fingerprint: > > 9FF2128B147EF6730BADF133611EC787040B0FAB > >=20 > > He who knows, does not speak. He who speaks, does not know. -- Lao Tsu >=20 > V3 - fate should work now. yes [...] > @@ -71,3 +73,158 @@ ff_scene_sad_fn ff_scene_sad_get_fn(int depth) > return sad; > } > =20 > +static AVMutex cbrt_mutex =3D AV_MUTEX_INITIALIZER; > +static uint8_t *cbrt_table[16] =3D { NULL }; > +static int cbrt_table_ref[16] =3D { 0 }; > + > +int ff_init_cbrt(int bitdepth) > +{ > + uint8_t *table; > + int size; > + > + if (bitdepth < 4 || bitdepth > 16) > + return AVERROR(EINVAL); > + > + ff_mutex_lock(&cbrt_mutex); > + > + table =3D cbrt_table[bitdepth]; > + if (table) { > + cbrt_table_ref[bitdepth]++; > + goto end; > + } > + > + table =3D av_malloc((1 << bitdepth) * (bitdepth > 8 ? 2 : 1)); > + if (!table) > + goto end; > + cbrt_table[bitdepth] =3D table; > + cbrt_table_ref[bitdepth] =3D 1; > + > + size =3D 1 << bitdepth; > + double factor =3D pow(size - 1, 2. / 3.); > + if (bitdepth <=3D 8) { > + for (int i =3D 0; i < size; i++) > + table[i] =3D round(factor * pow(i, 1. / 3.)); > + } else { > + uint16_t *tablew =3D (uint16_t*)table; > + for (int i =3D 0; i < size; i++) > + tablew[i] =3D round(factor * pow(i, 1. / 3.)); > + } > + > +end: > + ff_mutex_unlock(&cbrt_mutex); > + return table !=3D NULL; > +} > + > +void ff_uninit_cbrt(int bitdepth) > +{ > + if (bitdepth < 4 || bitdepth > 16) > + return; > + ff_mutex_lock(&cbrt_mutex); > + if (!--cbrt_table_ref[bitdepth]) { > + av_free(cbrt_table[bitdepth]); > + cbrt_table[bitdepth] =3D NULL; > + } > + ff_mutex_unlock(&cbrt_mutex); > +} I honestly dont see the value of refcounting the global cbrt tables either they can be static and initialized by a single AV_ONCE_INIT or just allocate and reinint for each filter. > + > +void ff_scene_scrd_c(SCENE_SAD_PARAMS) > +{ > + uint64_t scrdPlus =3D 0; > + uint64_t scrdMinus =3D 0; > + int x, y; > + double mean; > + uint8_t *table =3D cbrt_table[8]; > + > + if (!table) { > + *sum =3D 0; > + return; > + } > + > + for (y =3D 0; y < height; y++) { > + for (x =3D 0; x < width; x++) > + if (src1[x] > src2[x]) > + scrdMinus +=3D table[src1[x] - src2[x]]; > + else > + scrdPlus +=3D table[src2[x] - src1[x]]; > + src1 +=3D stride1; > + src2 +=3D stride2; > + } > + > + mean =3D (sqrt(scrdPlus) + sqrt(scrdMinus)) / 2.0; > + *sum =3D 2.0 * mean * mean; one sqrt less: 0.5*(scrdPlus + scrdMinus) + sqrt(scrdPlus * (double)scrdMinus) > +} > + > +void ff_scene_scrd2B_c(SCENE_SAD_PARAMS, int bitdepth) > +{ > + uint64_t scrdPlus =3D 0; > + uint64_t scrdMinus =3D 0; > + const uint16_t *src1w =3D (const uint16_t*)src1; > + const uint16_t *src2w =3D (const uint16_t*)src2; > + int x, y; > + double mean; > + uint16_t *table =3D (uint16_t*)cbrt_table[bitdepth]; > + > + if (!table) { > + *sum =3D 0; > + return; > + } > + > + stride1 /=3D 2; > + stride2 /=3D 2; > + > + for (y =3D 0; y < height; y++) { > + for (x =3D 0; x < width; x++) > + if (src1w[x] > src2w[x]) > + scrdMinus +=3D table[src1w[x] - src2w[x]]; > + else > + scrdPlus +=3D table[src2w[x] - src1w[x]]; > + src1w +=3D stride1; > + src2w +=3D stride2; > + } > + > + mean =3D (sqrt(scrdPlus) + sqrt(scrdMinus)) / 2.0; > + *sum =3D 2.0 * mean * mean; > +} > + > +void ff_scene_scrd9_c(SCENE_SAD_PARAMS) > +{ > + ff_scene_scrd2B_c(src1, stride1, src2, stride2, width, height, sum, = 9); > +} > + > +void ff_scene_scrd10_c(SCENE_SAD_PARAMS) > +{ > + ff_scene_scrd2B_c(src1, stride1, src2, stride2, width, height, sum, = 10); > +} > + > +void ff_scene_scrd12_c(SCENE_SAD_PARAMS) > +{ > + ff_scene_scrd2B_c(src1, stride1, src2, stride2, width, height, sum, = 12); > +} > + > +void ff_scene_scrd14_c(SCENE_SAD_PARAMS) > +{ > + ff_scene_scrd2B_c(src1, stride1, src2, stride2, width, height, sum, = 14); > +} > + > +void ff_scene_scrd16_c(SCENE_SAD_PARAMS) > +{ > + ff_scene_scrd2B_c(src1, stride1, src2, stride2, width, height, sum, = 16); > +} duplicating this 5 times just for a different LUT pointer is ugly thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Nations do behave wisely once they have exhausted all other alternatives.= =20 -- Abba Eban --1usLSbZNs6YCgkvZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZmo0qgAKCRBhHseHBAsP q0mGAJ49IEzHwi67Hes+9o31R+qHbvmedgCfUS3oFyukGxfm7MITKO1kMRKGJFE= =xDuz -----END PGP SIGNATURE----- --1usLSbZNs6YCgkvZ-- --===============2456751908984302965== 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". --===============2456751908984302965==--