From patchwork Tue Jan 10 13:21:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 2170 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp257343vsb; Tue, 10 Jan 2017 05:22:17 -0800 (PST) X-Received: by 10.28.127.20 with SMTP id a20mr2081291wmd.15.1484054537571; Tue, 10 Jan 2017 05:22:17 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id bt18si1635453wjb.137.2017.01.10.05.22.16; Tue, 10 Jan 2017 05:22:17 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DF50C68A4C7; Tue, 10 Jan 2017 15:22:06 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe02-3.mx.upcmail.net (vie01a-dmta-pe02-3.mx.upcmail.net [62.179.121.159]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1574868A4C0 for ; Tue, 10 Jan 2017 15:22:00 +0200 (EET) Received: from [172.31.216.44] (helo=vie01a-pemc-psmtp-pe02) by vie01a-dmta-pe02.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1cQwNL-0003Rr-FE for ffmpeg-devel@ffmpeg.org; Tue, 10 Jan 2017 14:22:07 +0100 Received: from [192.168.1.3] ([80.110.105.32]) by vie01a-pemc-psmtp-pe02 with SMTP @ mailcloud.upcmail.net id WdMa1u0220hxW7C01dMczM; Tue, 10 Jan 2017 14:21:37 +0100 X-SourceIP: 80.110.105.32 From: Carl Eugen Hoyos To: FFmpeg development discussions and patches Date: Tue, 10 Jan 2017 14:21:34 +0100 User-Agent: KMail/1.9.10 MIME-Version: 1.0 Message-Id: <201701101421.34179.cehoyos@ag.or.at> Subject: [FFmpeg-devel] [PATCH]lavc/psd: Support 1bpp images X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Hi! Attached patch fixes ticket #6044 for me. Please comment, Carl Eugen From 13fd23ed9dcb5e3affbb3456c64c3bb821b80613 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos 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 */