[FFmpeg-cvslog] pngdec: Implement 2bpp

Michael Niedermayer git at videolan.org
Tue Sep 6 15:55:08 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Sep  6 15:48:01 2011 +0200| [2d4102fc13f7c754701156ef4403d02fa0a2cc82] | committer: Michael Niedermayer

pngdec: Implement 2bpp
Fixes Ticket433

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/pngdec.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 7ac20ae..4fe2884 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -579,6 +579,19 @@ static int decode_frame(AVCodecContext *avctx,
     }
  exit_loop:
 
+    if(s->bits_per_pixel == 2){
+        int i, j;
+        uint8_t *pd = s->current_picture->data[0];
+        for(j=0; j < s->height; j++) {
+            for(i=s->width/4-1; i>=0; i--) {
+                pd[4*i+3]=  pd[i]    &3;
+                pd[4*i+2]= (pd[i]>>2)&3;
+                pd[4*i+1]= (pd[i]>>4)&3;
+                pd[4*i+0]=  pd[i]>>6;
+            }
+            pd += s->image_linesize;
+        }
+    }
     if(s->bits_per_pixel == 4){
         int i, j;
         uint8_t *pd = s->current_picture->data[0];



More information about the ffmpeg-cvslog mailing list