From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v4] avutil/csp: create avpriv API for colorspace structs
Date: Fri, 20 May 2022 15:11:43 +0200
Message-ID: <20220520131143.GU396728@pb2> (raw)
In-Reply-To: <CAEEMt2=-HJ5n4aXWXyS9s5fz3V4SyNhp=DPBBfG_K2WsM2Fgzw@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 3438 bytes --]
Hi Ronald
On Fri, May 20, 2022 at 07:26:56AM -0400, Ronald S. Bultje wrote:
> Hi Michael,
>
> On Fri, May 20, 2022 at 6:28 AM Michael Niedermayer <michael@niedermayer.cc>
> wrote:
>
> > 1. exactly representing values
> >
>
> This isn't actually what I meant when I made the argument. If the spec says
> "0.137", I'd expect to be able to git grep the source code for "0.137" and
> find where it's defined. This is lost with AVRational, where it becomes {
> 137, 1000 }. This may sound silly, but I find this helpful.
>
> One way to address this is to add the exact value in a comment, like
> "(AVRational) { 137, 1000 }, // 0.137". This isn't pretty but retains
> grep-discoverability.
We use fixed point numbers in multiple places without
loosing grep-discoverability
for example
libavcodec/mpegaudiotab.h: FIX(0.54119610014619701222),
libavcodec/mpegaudiotab.h: FIX(1.3065629648763763537),
libavcodec/mpegaudiotab.h: FIX(0.50979557910415917998),
libavcodec/mpegaudiotab.h: FIX(2.5629154477415054814),
libavcodec/mpegaudiotab.h: FIX(0.89997622313641556513),
libavcodec/mpegaudiotab.h: FIX(0.60134488693504528634),
libavcodec/mpegaudiotab.h: FIX(0.5024192861881556782),
libavcodec/jfdctint_template.c:#define FIX_0_765366865 FIX(0.765366865)
libavcodec/jfdctint_template.c:#define FIX_0_899976223 FIX(0.899976223)
libavcodec/jfdctint_template.c:#define FIX_1_175875602 FIX(1.175875602)
libavcodec/jfdctint_template.c:#define FIX_1_501321110 FIX(1.501321110)
libavcodec/jfdctint_template.c:#define FIX_1_847759065 FIX(1.847759065)
libavcodec/jfdctint_template.c:#define FIX_1_961570560 FIX(1.961570560)
libavcodec/dcadata.c: SCALE(0.01112466771), SCALE(0.43016362190), SCALE(0.53190881014), SCALE(0.02678431384),
libavcodec/dcadata.c: SCALE(0.01170534454), SCALE(0.43572667241), SCALE(0.52686679363), SCALE(0.02568206564),
libavcodec/dcadata.c: SCALE(0.01230939943), SCALE(0.44127810001), SCALE(0.52177828550), SCALE(0.02461459488),
libavcodec/dcadata.c: SCALE(0.01293735672), SCALE(0.44681602716), SCALE(0.51664537191), SCALE(0.02358125709),
libavcodec/dcadata.c: SCALE(0.01358995494), SCALE(0.45233830810), SCALE(0.51147013903), SCALE(0.02258131653),
libavcodec/dcadata.c: SCALE(0.01426773332), SCALE(0.45784294605), SCALE(0.50625455379), SCALE(0.02161412500),
tests/utils.c: lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g +
tests/utils.c: FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
tests/utils.c: lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g +
tests/utils.c: FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
tests/utils.c: lum[0] = (FIX(0.29900) * r + FIX(0.58700) * g +
tests/utils.c: FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
tests/utils.c: lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g +
tests/utils.c: FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
such a macro could produce a AVRational too easily (if wanted)
the advantage over a comment is that a comment can be forgotten
the argument for a macro cannot be forgotten and still succeed build
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
next prev parent reply other threads:[~2022-05-20 13:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-18 15:18 Leo Izen
2022-05-18 18:23 ` Michael Niedermayer
2022-05-18 18:27 ` Michael Niedermayer
2022-05-20 10:28 ` Michael Niedermayer
2022-05-20 11:26 ` Ronald S. Bultje
2022-05-20 13:11 ` Michael Niedermayer [this message]
2022-05-20 13:39 ` Ronald S. Bultje
2022-05-20 11:53 ` James Almer
2022-05-20 13:23 ` Michael Niedermayer
2022-05-20 15:50 ` Anton Khirnov
2022-05-20 16:02 ` Leo Izen
2022-05-20 16:33 ` Niklas Haas
2022-05-20 12:08 ` Leo Izen
2022-05-20 17:20 ` Niklas Haas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220520131143.GU396728@pb2 \
--to=michael@niedermayer.cc \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git