[FFmpeg-devel] [PATCH]Abide sunrast specification regarding 32 bit

Michael Niedermayer michaelni at gmx.at
Fri Mar 9 07:24:45 CET 2012

On Tue, Mar 06, 2012 at 07:05:05PM +0100, Carl-Eugen Hoyos wrote:
> Hi!
> FFmpeg currently decodes the only 32bit sunrast sample visually
> correct that was user-provided.
> This sample is shown differently (=visually incorrect) by (at least)
> gimp, ImageMagick and xview, the sparse documentation I found also
> supports the view that the provided sample was not encoded
> correctly.
> Patch breaks the given sample, fixes behaviour with regard to
> specification, gimp, ImageMagick etc.
> Please comment, Carl Eugen

>  sunrast.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 2c0226160dad7012cee7beb90143d884098bfcdf  patchsun0bgr.diff
> diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c
> index 7137621..014c96d 100644
> --- a/libavcodec/sunrast.c
> +++ b/libavcodec/sunrast.c
> @@ -105,7 +105,7 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
>              avctx->pix_fmt = (type == RT_FORMAT_RGB) ? PIX_FMT_RGB24 : PIX_FMT_BGR24;
>              break;
>          case 32:
> -            avctx->pix_fmt = (type == RT_FORMAT_RGB) ? PIX_FMT_RGB0 : PIX_FMT_BGR0;
> +            avctx->pix_fmt = (type == RT_FORMAT_RGB) ? PIX_FMT_0RGB : PIX_FMT_0BGR;

its maybe overkill for this but one could check if either of the
channels is constant (0/ff) and consider that the 0 one. That way
both variants could be supported.

But iam happy to apply this as is if someone provides a commit
message or better yet something i can pipe to git am


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Incandescent light bulbs waste a lot of energy as heat so the EU forbids them.
Their replacement, compact fluorescent lamps, much more expensive, dont fit in
many old lamps, flicker, contain toxic mercury, produce a fraction of the light
that is claimed and in a unnatural spectrum rendering colors different than
in natural light. Ah and we now need to turn the heaters up more in winter to
compensate the lower wasted heat. Who wins? Not the environment, thats for sure
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120309/0cc81034/attachment.asc>

More information about the ffmpeg-devel mailing list