[FFmpeg-cvslog] lavc/tiff: move unpack_yuv() above the deflate functions

James Almer git at videolan.org
Tue Aug 19 23:52:16 CEST 2014


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Aug 19 17:04:01 2014 -0300| [b4231b4fedc2250d6489f42dd79264c5aaa892f2] | committer: James Almer

lavc/tiff: move unpack_yuv() above the deflate functions

Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavcodec/tiff.c |   57 ++++++++++++++++++++++++++---------------------------
 1 file changed, 28 insertions(+), 29 deletions(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index d5c03e8..980aaf1 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -283,6 +283,34 @@ static int deinvert_buffer(TiffContext *s, const uint8_t *src, int size)
     return 0;
 }
 
+static void unpack_yuv(TiffContext *s, AVFrame *p,
+                       const uint8_t *src, int lnum)
+{
+    int i, j, k;
+    int w       = (s->width - 1) / s->subsampling[0] + 1;
+    uint8_t *pu = &p->data[1][lnum / s->subsampling[1] * p->linesize[1]];
+    uint8_t *pv = &p->data[2][lnum / s->subsampling[1] * p->linesize[2]];
+    if (s->width % s->subsampling[0] || s->height % s->subsampling[1]) {
+        for (i = 0; i < w; i++) {
+            for (j = 0; j < s->subsampling[1]; j++)
+                for (k = 0; k < s->subsampling[0]; k++)
+                    p->data[0][FFMIN(lnum + j, s->height-1) * p->linesize[0] +
+                               FFMIN(i * s->subsampling[0] + k, s->width-1)] = *src++;
+            *pu++ = *src++;
+            *pv++ = *src++;
+        }
+    }else{
+        for (i = 0; i < w; i++) {
+            for (j = 0; j < s->subsampling[1]; j++)
+                for (k = 0; k < s->subsampling[0]; k++)
+                    p->data[0][(lnum + j) * p->linesize[0] +
+                               i * s->subsampling[0] + k] = *src++;
+            *pu++ = *src++;
+            *pv++ = *src++;
+        }
+    }
+}
+
 #if CONFIG_ZLIB
 static int tiff_uncompress(uint8_t *dst, unsigned long *len, const uint8_t *src,
                            int size)
@@ -383,35 +411,6 @@ static int tiff_unpack_fax(TiffContext *s, uint8_t *dst, int stride,
     return ret;
 }
 
-static void unpack_yuv(TiffContext *s, AVFrame *p,
-                       const uint8_t *src, int lnum)
-{
-    int i, j, k;
-    int w       = (s->width - 1) / s->subsampling[0] + 1;
-    uint8_t *pu = &p->data[1][lnum / s->subsampling[1] * p->linesize[1]];
-    uint8_t *pv = &p->data[2][lnum / s->subsampling[1] * p->linesize[2]];
-    if (s->width % s->subsampling[0] || s->height % s->subsampling[1]) {
-        for (i = 0; i < w; i++) {
-            for (j = 0; j < s->subsampling[1]; j++)
-                for (k = 0; k < s->subsampling[0]; k++)
-                    p->data[0][FFMIN(lnum + j, s->height-1) * p->linesize[0] +
-                               FFMIN(i * s->subsampling[0] + k, s->width-1)] = *src++;
-            *pu++ = *src++;
-            *pv++ = *src++;
-        }
-    }else{
-        for (i = 0; i < w; i++) {
-            for (j = 0; j < s->subsampling[1]; j++)
-                for (k = 0; k < s->subsampling[0]; k++)
-                    p->data[0][(lnum + j) * p->linesize[0] +
-                               i * s->subsampling[0] + k] = *src++;
-            *pu++ = *src++;
-            *pv++ = *src++;
-        }
-    }
-}
-
-
 static int tiff_unpack_strip(TiffContext *s, AVFrame *p, uint8_t *dst, int stride,
                              const uint8_t *src, int size, int strip_start, int lines)
 {



More information about the ffmpeg-cvslog mailing list