[FFmpeg-devel] [PATCH]lavc/psd: Support 1bpp images
Carl Eugen Hoyos
cehoyos at ag.or.at
Tue Jan 10 15:21:34 EET 2017
Hi!
Attached patch fixes ticket #6044 for me.
Please comment, Carl Eugen
-------------- next part --------------
From 13fd23ed9dcb5e3affbb3456c64c3bb821b80613 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos at ag.or.at>
Date: Tue, 10 Jan 2017 14:19:31 +0100
Subject: [PATCH] lavc/psd: Support 1bpp images.
Fixes ticket #6044.
---
libavcodec/psd.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libavcodec/psd.c b/libavcodec/psd.c
index 7587ed9..82a2c6b 100644
--- a/libavcodec/psd.c
+++ b/libavcodec/psd.c
@@ -319,6 +319,9 @@ static int decode_frame(AVCodecContext *avctx, void *data,
s->uncompressed_size = s->line_size * s->height * s->channel_count;
switch (s->color_mode) {
+ case PSD_BITMAP:
+ avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
+ break;
case PSD_INDEXED:
if (s->channel_depth != 8 || s->channel_count != 1) {
av_log(s->avctx, AV_LOG_ERROR,
@@ -420,6 +423,13 @@ static int decode_frame(AVCodecContext *avctx, void *data,
}
}
}
+ } else if (avctx->pix_fmt == AV_PIX_FMT_MONOWHITE) {
+ ptr = picture->data[0];
+ for (y = 0; y < s->height; y++) {
+ memcpy(ptr, ptr_data, s->width + 7 >> 3);
+ ptr_data += s->width + 7 >> 3;
+ ptr += picture->linesize[0];
+ }
} else {/* Planar */
if (s->channel_count == 1)/* gray 8 or gray 16be */
eq_channel[0] = 0;/* assign first channel, to first plane */
--
1.7.10.4
More information about the ffmpeg-devel
mailing list