Commit 21899717 authored by Benoit Fouet's avatar Benoit Fouet

Move iv_decode_frame function to remove a forward declaration.

Originally committed as revision 15488 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 950c0373
......@@ -96,11 +96,6 @@ static av_cold int build_modpred(Indeo3DecodeContext *s)
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 @@ static av_cold void iv_free_func(Indeo3DecodeContext *s)
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 @@ static av_cold int indeo3_decode_init(AVCodecContext *avctx)
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment