[FFmpeg-devel] [PATCH] OpenEXR decoder rev-16

Reimar Döffinger Reimar.Doeffinger
Tue Sep 8 19:57:18 CEST 2009


On Tue, Sep 08, 2009 at 03:30:26PM +0200, Jimmy Christensen wrote:
> +static inline uint16_t exr_flt2uint(uint32_t v)
> +{
> +    int exp = v >> 23;
> +    if (v & 0x80000000)
> +        return 0;
> +    if (exp <= 127+7-24) // we would shift out all bits anyway
> +        return 0;
> +    if (exp >= 127)
> +        return 0xffff;
> +    v &= 0x007fffff;
> +        return (v+(1<<23)) >> (127+7-exp);

Indentation is off.
Also, if you use int32_t as type for v,
you can remove the (v & 0x80000000) case, since exp will then be < 0
for negative numbers (should be documented with a comment of course).



More information about the ffmpeg-devel mailing list