[FFmpeg-devel] [PATCH] new function get_sbits_long()

Michael Niedermayer michaelni
Mon Mar 2 20:18:52 CET 2009


On Mon, Mar 02, 2009 at 08:03:29PM +0100, Michael Niedermayer wrote:
> On Mon, Mar 02, 2009 at 06:18:24PM +0000, M?ns Rullg?rd wrote:
> > Michael Niedermayer <michaelni at gmx.at> writes:
> > 
> > > On Mon, Mar 02, 2009 at 12:39:05PM -0500, Justin Ruggles wrote:
> > >> Hi,
> > >> 
> > >> I need a get_sbits_long() function to support FLAC files that are more
> > >> than 24-bit.  There might be a better way to do it, but this works.
> > >
> > > only where int is 32bit which isnt guranteed even if likely
> > 
> > I still think we should put a sign_extend() function in mathops.h or
> > similar.
> 
> i agree

also it should be considered that if the amount of sign extension is
known at compile time then a + and xor is enough and no shifts are
needed which may be faster

4 ways to sign extend 8->16bit without shifts
(u + 0xFF80) ^ 0xFF80
(u - 0x0080) ^ 0xFF80
(u ^ 0xFF80) - 0xFF80
(u ^ 0xFF80) + 0x0080

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090302/9449a97f/attachment.pgp>



More information about the ffmpeg-devel mailing list