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

Reimar Döffinger Reimar.Doeffinger
Tue Sep 8 19:47:51 CEST 2009


On Tue, Sep 08, 2009 at 03:30:26PM +0200, Jimmy Christensen wrote:
> +    switch (s->bits_per_color_id) {
> +    // 32-bit
> +    case 2:
> +        avctx->pix_fmt = PIX_FMT_RGB48LE;
> +        break;
> +    // 16-bit
> +    case 1:
> +        avctx->pix_fmt = PIX_FMT_RGB48LE;
> +        break;

I missed that, this obviously can't be right, you write the uint16_t
values directly, thus in native format - not little-endian.

> +                    for (x = 0; x < xdelta; x++) {
> +                        *ptr_x++ = exr_flt2uint(bytestream_get_le32(&red_channel_buffer));
> +                        *ptr_x++ = exr_flt2uint(bytestream_get_le32(&green_channel_buffer));
> +                        *ptr_x++ = exr_flt2uint(bytestream_get_le32(&blue_channel_buffer));
> +                    }

Not that this must used code suitable for unaligned access, thus e.g. on
Sparc
*ptr_x++ = exr_flt2uint(le2me_32(*(uint32_t *)red_channel_buffer));
will be faster.



More information about the ffmpeg-devel mailing list