changeset 8426:898722eb4fd2 libavcodec

Calculate line size variable correctly for lower bitdepths and use it for raw data copying
author kostya
date Mon, 22 Dec 2008 06:39:31 +0000
parents b8d72c9851c7
children 2dfb0cc864b6
files tiff.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tiff.c	Mon Dec 22 06:36:10 2008 +0000
+++ b/tiff.c	Mon Dec 22 06:39:31 2008 +0000
@@ -74,7 +74,7 @@
 static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uint8_t *src, int size, int lines){
     int c, line, pixels, code;
     const uint8_t *ssrc = src;
-    int width = s->width * (s->bpp / 8);
+    int width = s->width * s->bpp >> 3;
 #ifdef CONFIG_ZLIB
     uint8_t *zbuf; unsigned long outlen;
 
@@ -109,8 +109,8 @@
         }
         switch(s->compr){
         case TIFF_RAW:
-            memcpy(dst, src, s->width * (s->bpp / 8));
-            src += s->width * (s->bpp / 8);
+            memcpy(dst, src, width);
+            src += width;
             break;
         case TIFF_PACKBITS:
             for(pixels = 0; pixels < width;){