[FFmpeg-devel] [PATCH] ff_shift (left shift with allowed negative offset) implementation
Michael Niedermayer
michaelni
Sat May 10 12:26:19 CEST 2008
On Sat, May 10, 2008 at 01:48:28PM +0700, Vladimir Voroshilov wrote:
> Hi, All
>
> Code in attached patch is used in several places of G.729 code.
> Michael asked me to make implement it as separate routine.
> So here is it.
> Is patch (routine/file name) ok ?
[...]
> diff --git a/libavcodec/acelp_math.c b/libavcodec/acelp_math.c
> index 6c8a017..b992c11 100644
> --- a/libavcodec/acelp_math.c
> +++ b/libavcodec/acelp_math.c
> @@ -195,3 +195,11 @@ int ff_log2(uint32_t value)
>
> return (power_int << 15) + value;
> }
> +
> +int ff_shift(int value, int offset)
static inline would be better
and the name is not good, it should give some hint that offset is meant
leftward and that value is signed.
> +{
> + if(offset < 0)
> + return value >> -offset;
> + else
> + return value << offset;
if(offset < 0) return value >> -offset;
else return value << offset;
looks nicer IMHO
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- 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/20080510/a56fc57f/attachment.pgp>
More information about the ffmpeg-devel
mailing list