[FFmpeg-devel] [PATCH]lavc/psd: Support CMYK images

Peter Ross pross at xvid.org
Fri Jan 11 08:17:33 EET 2019


On Fri, Jan 11, 2019 at 03:23:49AM +0100, Carl Eugen Hoyos wrote:
> 2019-01-11 2:55 GMT+01:00, Carl Eugen Hoyos <ceffmpeg at gmail.com>:
> > Hi!
> >
> > Attached patch fixes ticket #6797, please comment.
> 
> New patch with 16bit support attached.
> 
> Please comment, Carl Eugen

> From 5f879539ee7fecd57bd3de9f7c6363d9b7779b5b Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <ceffmpeg at gmail.com>
> Date: Fri, 11 Jan 2019 03:20:38 +0100
> Subject: [PATCH] lavc/psd: Support CMYK images.
> 
> Based on a05635e by Michael Niedermayer.
> 
> Fixes ticket #6797.
> ---
>  libavcodec/psd.c |   84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 84 insertions(+)
> 
> diff --git a/libavcodec/psd.c b/libavcodec/psd.c

> +        if (s->channel_depth == 8) {
> +            for (y = 0; y < s->height; y++) {
> +                for (x = 0; x < s->width; x++) {
> +                    int k = src[3][x];
> +                    int r = src[0][x] * k;
> +                    int g = src[1][x] * k;
> +                    int b = src[2][x] * k;
> +                    dst[0][x] = g * 257 >> 16;
> +                    dst[1][x] = b * 257 >> 16;
> +                    dst[2][x] = r * 257 >> 16;
> +                }

the same algorithm exists in libavcodec/mjpegdec.c, with alpha channel support.
i guess it is trivial enough to be duplicated here.

otherwise looks good.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190111/02b84ba1/attachment.sig>


More information about the ffmpeg-devel mailing list