[FFmpeg-cvslog] libavcodec/psd : add support for psd bitmap mode

Martin Vignali git at videolan.org
Wed Jan 11 01:24:46 EET 2017


ffmpeg | branch: master | Martin Vignali <martin.vignali at gmail.com> | Wed Jan 11 00:18:29 2017 +0100| [658e626cc0d5de2d663f0e69c8836a87f51dd39f] | committer: Carl Eugen Hoyos

libavcodec/psd : add support for psd bitmap mode

Fixes ticket #6044

Based on patch by Carl Eugen Hoyos

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=658e626cc0d5de2d663f0e69c8836a87f51dd39f
---

 libavcodec/psd.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavcodec/psd.c b/libavcodec/psd.c
index a4830c6..e6ec896 100644
--- a/libavcodec/psd.c
+++ b/libavcodec/psd.c
@@ -316,9 +316,12 @@ static int decode_frame(AVCodecContext *avctx, void *data,
 
     s->pixel_size = s->channel_depth >> 3;/* in byte */
     s->line_size = s->width * s->pixel_size;
-    s->uncompressed_size = s->line_size * s->height * s->channel_count;
 
     switch (s->color_mode) {
+    case PSD_BITMAP:
+        s->line_size = s->width + 7 >> 3;
+        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,
@@ -383,6 +386,8 @@ static int decode_frame(AVCodecContext *avctx, void *data,
         return AVERROR_PATCHWELCOME;
     }
 
+    s->uncompressed_size = s->line_size * s->height * s->channel_count;
+
     if ((ret = ff_get_buffer(avctx, picture, 0)) < 0)
         return ret;
 
@@ -430,9 +435,9 @@ static int decode_frame(AVCodecContext *avctx, void *data,
             plane_number = eq_channel[c];
             ptr = picture->data[plane_number];/* get the right plane */
             for (y = 0; y < s->height; y++) {
-                memcpy(ptr, ptr_data, s->width * s->pixel_size);
+                memcpy(ptr, ptr_data, s->line_size);
                 ptr += picture->linesize[plane_number];
-                ptr_data += s->width * s->pixel_size;
+                ptr_data += s->line_size;
             }
         }
     }



More information about the ffmpeg-cvslog mailing list