[FFmpeg-devel] [PATCH] intmath.h: add an ff_log2_nz

Michael Niedermayer michael at niedermayer.cc
Thu Dec 17 22:17:26 CET 2015


On Thu, Dec 17, 2015 at 08:44:38PM +0000, Rostislav Pehlivanov wrote:
> On Thu, 2015-12-17 at 19:22 +0100, Michael Niedermayer wrote:
> > On Thu, Dec 17, 2015 at 05:29:58PM +0000, Rostislav Pehlivanov wrote:
> > > This commit adds a raw integer log2 function (which directly maps
> > > to a
> > > builtin). This was needed as the Daala entropy coding system
> > > requires a
> > > raw log2 and the existing ff_log2 OR'd the argument with 1.
> > 
> > __builtin_clz(0) is undefined as ganesh pointed out elsewhere
> > 
> > if i read the intend correctly though this function is added because
> > of different behavior for 0, but IIUC its not different in a good w
> 
> No, this function is added because the OR'd argument in the current
> ff_log2(x) completely breaks the entropy decoding system because for
> example, (32|1)!=32.

32 and (32|1) have the same count of leading zeros so both functions
would return the same value, what am i missing ?

[...]
-- 
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151217/749085bb/attachment.sig>


More information about the ffmpeg-devel mailing list