changeset 7957:fbe8fabdbc63 libavcodec

Move iv_decode_frame function to remove a forward declaration.
author benoit
date Tue, 30 Sep 2008 14:43:55 +0000
parents eb16a37644a5
children 83b22813f23a
files indeo3.c
diffstat 1 files changed, 67 insertions(+), 72 deletions(-) [+]
line wrap: on
line diff
--- a/indeo3.c	Tue Sep 30 14:41:11 2008 +0000
+++ b/indeo3.c	Tue Sep 30 14:43:55 2008 +0000
@@ -96,11 +96,6 @@
   return 0;
 }
 
-static void iv_Decode_Chunk(Indeo3DecodeContext *s, uint8_t *cur,
-        uint8_t *ref, int width, int height, const uint8_t *buf1,
-        long fflags2, const uint8_t *hdr,
-        const uint8_t *buf2, int min_width_160);
-
 static av_cold int iv_alloc_frames(Indeo3DecodeContext *s)
 {
     int luma_width, luma_height, luma_pixels, chroma_width, chroma_height,
@@ -158,73 +153,6 @@
     av_free(s->corrector_type);
 }
 
-static unsigned long iv_decode_frame(Indeo3DecodeContext *s,
-                                     const uint8_t *buf, int buf_size)
-{
-    unsigned int hdr_width, hdr_height,
-                 chroma_width, chroma_height;
-    unsigned long fflags1, fflags2, fflags3, offs1, offs2, offs3, offs;
-    const uint8_t *hdr_pos, *buf_pos;
-
-    buf_pos = buf;
-    buf_pos += 18;
-
-    fflags1 = bytestream_get_le16(&buf_pos);
-    fflags3 = bytestream_get_le32(&buf_pos);
-    fflags2 = *buf_pos++;
-    buf_pos += 3;
-    hdr_height = bytestream_get_le16(&buf_pos);
-    hdr_width  = bytestream_get_le16(&buf_pos);
-
-    if(avcodec_check_dimensions(NULL, hdr_width, hdr_height))
-        return -1;
-
-    chroma_height = ((hdr_height >> 2) + 3) & 0x7ffc;
-    chroma_width = ((hdr_width >> 2) + 3) & 0x7ffc;
-    offs1 = bytestream_get_le32(&buf_pos);
-    offs2 = bytestream_get_le32(&buf_pos);
-    offs3 = bytestream_get_le32(&buf_pos);
-    buf_pos += 4;
-    hdr_pos = buf_pos;
-    if(fflags3 == 0x80) return 4;
-
-    if(fflags1 & 0x200) {
-        s->cur_frame = s->iv_frame + 1;
-        s->ref_frame = s->iv_frame;
-    } else {
-        s->cur_frame = s->iv_frame;
-        s->ref_frame = s->iv_frame + 1;
-    }
-
-    buf_pos = buf + 16 + offs1;
-    offs = bytestream_get_le32(&buf_pos);
-
-    iv_Decode_Chunk(s, s->cur_frame->Ybuf, s->ref_frame->Ybuf, hdr_width,
-                    hdr_height, buf_pos + offs * 2, fflags2, hdr_pos, buf_pos,
-                    FFMIN(hdr_width, 160));
-
-    if (!(s->avctx->flags & CODEC_FLAG_GRAY))
-    {
-
-        buf_pos = buf + 16 + offs2;
-        offs = bytestream_get_le32(&buf_pos);
-
-        iv_Decode_Chunk(s, s->cur_frame->Vbuf, s->ref_frame->Vbuf, chroma_width,
-                chroma_height, buf_pos + offs * 2, fflags2, hdr_pos, buf_pos,
-                FFMIN(chroma_width, 40));
-
-        buf_pos = buf + 16 + offs3;
-        offs = bytestream_get_le32(&buf_pos);
-
-        iv_Decode_Chunk(s, s->cur_frame->Ubuf, s->ref_frame->Ubuf, chroma_width,
-                chroma_height, buf_pos + offs * 2, fflags2, hdr_pos, buf_pos,
-                FFMIN(chroma_width, 40));
-
-    }
-
-    return 8;
-}
-
 typedef struct {
     long xpos;
     long ypos;
@@ -1048,6 +976,73 @@
     return ret;
 }
 
+static unsigned long iv_decode_frame(Indeo3DecodeContext *s,
+                                     const uint8_t *buf, int buf_size)
+{
+    unsigned int hdr_width, hdr_height,
+                 chroma_width, chroma_height;
+    unsigned long fflags1, fflags2, fflags3, offs1, offs2, offs3, offs;
+    const uint8_t *hdr_pos, *buf_pos;
+
+    buf_pos = buf;
+    buf_pos += 18;
+
+    fflags1 = bytestream_get_le16(&buf_pos);
+    fflags3 = bytestream_get_le32(&buf_pos);
+    fflags2 = *buf_pos++;
+    buf_pos += 3;
+    hdr_height = bytestream_get_le16(&buf_pos);
+    hdr_width  = bytestream_get_le16(&buf_pos);
+
+    if(avcodec_check_dimensions(NULL, hdr_width, hdr_height))
+        return -1;
+
+    chroma_height = ((hdr_height >> 2) + 3) & 0x7ffc;
+    chroma_width = ((hdr_width >> 2) + 3) & 0x7ffc;
+    offs1 = bytestream_get_le32(&buf_pos);
+    offs2 = bytestream_get_le32(&buf_pos);
+    offs3 = bytestream_get_le32(&buf_pos);
+    buf_pos += 4;
+    hdr_pos = buf_pos;
+    if(fflags3 == 0x80) return 4;
+
+    if(fflags1 & 0x200) {
+        s->cur_frame = s->iv_frame + 1;
+        s->ref_frame = s->iv_frame;
+    } else {
+        s->cur_frame = s->iv_frame;
+        s->ref_frame = s->iv_frame + 1;
+    }
+
+    buf_pos = buf + 16 + offs1;
+    offs = bytestream_get_le32(&buf_pos);
+
+    iv_Decode_Chunk(s, s->cur_frame->Ybuf, s->ref_frame->Ybuf, hdr_width,
+                    hdr_height, buf_pos + offs * 2, fflags2, hdr_pos, buf_pos,
+                    FFMIN(hdr_width, 160));
+
+    if (!(s->avctx->flags & CODEC_FLAG_GRAY))
+    {
+
+        buf_pos = buf + 16 + offs2;
+        offs = bytestream_get_le32(&buf_pos);
+
+        iv_Decode_Chunk(s, s->cur_frame->Vbuf, s->ref_frame->Vbuf, chroma_width,
+                chroma_height, buf_pos + offs * 2, fflags2, hdr_pos, buf_pos,
+                FFMIN(chroma_width, 40));
+
+        buf_pos = buf + 16 + offs3;
+        offs = bytestream_get_le32(&buf_pos);
+
+        iv_Decode_Chunk(s, s->cur_frame->Ubuf, s->ref_frame->Ubuf, chroma_width,
+                chroma_height, buf_pos + offs * 2, fflags2, hdr_pos, buf_pos,
+                FFMIN(chroma_width, 40));
+
+    }
+
+    return 8;
+}
+
 static int indeo3_decode_frame(AVCodecContext *avctx,
                                void *data, int *data_size,
                                const uint8_t *buf, int buf_size)