[FFmpeg-devel] [PATCH] lavc/ccaption_dec: simplify parity check
Clément Bœsch
u at pkh.me
Sun Jan 3 19:05:13 CET 2016
On Sun, Jan 03, 2016 at 06:53:34PM +0100, Clément Bœsch wrote:
> On Sun, Jan 03, 2016 at 05:43:26PM +0000, Derek Buitenhuis wrote:
> > On 1/3/2016 5:33 PM, Clément Bœsch wrote:
> > > + return (0x6996966996696996ULL >> (x & 63) ^ (x>>7) ^ (x>>6)) & 1;
> >
> > I mean, I see how it works, but it's incredibly non-obvious without the
> > patch context (table removal).
> >
>
> Any suggestion? Maybe a comment? Or you prefer the 32 lines table of 256
> bytes to store 256 redundant bits of information?
>
> The name of the function gives the context here, if you look up the web
> for "bit parity" you'll get what you are looking for. I'm not sure the
> table is much more obvious about what's this parity is all about.
>
Now that I think a bit about, I could just do return av_popcount(x) & 1...
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160103/cb5af5a5/attachment.sig>
More information about the ffmpeg-devel
mailing list