Commit cf11e055 authored by benoit's avatar benoit

Rename some variables and add some comments to try to be a bit more clear.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@15510 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 1c282c81
...@@ -202,7 +202,7 @@ typedef struct { ...@@ -202,7 +202,7 @@ typedef struct {
static void iv_Decode_Chunk(Indeo3DecodeContext *s, static void iv_Decode_Chunk(Indeo3DecodeContext *s,
uint8_t *cur, uint8_t *ref, int width, int height, uint8_t *cur, uint8_t *ref, int width, int height,
const uint8_t *buf1, long fflags2, const uint8_t *hdr, const uint8_t *buf1, long cb_offset, const uint8_t *hdr,
const uint8_t *buf2, int min_width_160) const uint8_t *buf2, int min_width_160)
{ {
uint8_t bit_buf; uint8_t bit_buf;
...@@ -314,7 +314,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s, ...@@ -314,7 +314,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
k = *buf1 >> 4; k = *buf1 >> 4;
j = *buf1 & 0x0f; j = *buf1 & 0x0f;
buf1++; buf1++;
lv = j + fflags2; lv = j + cb_offset;
if((lv - 8) <= 7 && (k == 0 || k == 3 || k == 10)) { if((lv - 8) <= 7 && (k == 0 || k == 3 || k == 10)) {
cp2 = s->ModPred + ((lv - 8) << 7); cp2 = s->ModPred + ((lv - 8) << 7);
...@@ -326,10 +326,10 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s, ...@@ -326,10 +326,10 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
} }
if(k == 1 || k == 4) { if(k == 1 || k == 4) {
lv = (hdr[j] & 0xf) + fflags2; lv = (hdr[j] & 0xf) + cb_offset;
correction_type_sp[0] = s->corrector_type + (lv << 8); correction_type_sp[0] = s->corrector_type + (lv << 8);
correction_lp[0] = correction + (lv << 8); correction_lp[0] = correction + (lv << 8);
lv = (hdr[j] >> 4) + fflags2; lv = (hdr[j] >> 4) + cb_offset;
correction_lp[1] = correction + (lv << 8); correction_lp[1] = correction + (lv << 8);
correction_type_sp[1] = s->corrector_type + (lv << 8); correction_type_sp[1] = s->corrector_type + (lv << 8);
} else { } else {
...@@ -973,34 +973,35 @@ static av_cold int indeo3_decode_init(AVCodecContext *avctx) ...@@ -973,34 +973,35 @@ static av_cold int indeo3_decode_init(AVCodecContext *avctx)
static unsigned long iv_decode_frame(Indeo3DecodeContext *s, static unsigned long iv_decode_frame(Indeo3DecodeContext *s,
const uint8_t *buf, int buf_size) const uint8_t *buf, int buf_size)
{ {
unsigned int hdr_width, hdr_height, unsigned int image_width, image_height,
chroma_width, chroma_height; chroma_width, chroma_height;
unsigned long fflags1, fflags2, fflags3, offs1, offs2, offs3, offs; unsigned long flags, cb_offset, data_size,
y_offset, v_offset, u_offset, mc_vector_count;
const uint8_t *hdr_pos, *buf_pos; const uint8_t *hdr_pos, *buf_pos;
buf_pos = buf; buf_pos = buf;
buf_pos += 18; buf_pos += 18; /* skip OS header (16 bytes) and version number */
fflags1 = bytestream_get_le16(&buf_pos); flags = bytestream_get_le16(&buf_pos);
fflags3 = bytestream_get_le32(&buf_pos); data_size = bytestream_get_le32(&buf_pos);
fflags2 = *buf_pos++; cb_offset = *buf_pos++;
buf_pos += 3; buf_pos += 3; /* skip reserved byte and checksum */
hdr_height = bytestream_get_le16(&buf_pos); image_height = bytestream_get_le16(&buf_pos);
hdr_width = bytestream_get_le16(&buf_pos); image_width = bytestream_get_le16(&buf_pos);
if(avcodec_check_dimensions(NULL, hdr_width, hdr_height)) if(avcodec_check_dimensions(NULL, image_width, image_height))
return -1; return -1;
chroma_height = ((hdr_height >> 2) + 3) & 0x7ffc; chroma_height = ((image_height >> 2) + 3) & 0x7ffc;
chroma_width = ((hdr_width >> 2) + 3) & 0x7ffc; chroma_width = ((image_width >> 2) + 3) & 0x7ffc;
offs1 = bytestream_get_le32(&buf_pos); y_offset = bytestream_get_le32(&buf_pos);
offs2 = bytestream_get_le32(&buf_pos); v_offset = bytestream_get_le32(&buf_pos);
offs3 = bytestream_get_le32(&buf_pos); u_offset = bytestream_get_le32(&buf_pos);
buf_pos += 4; buf_pos += 4; /* reserved */
hdr_pos = buf_pos; hdr_pos = buf_pos;
if(fflags3 == 0x80) return 4; if(data_size == 0x80) return 4;
if(fflags1 & 0x200) { if(flags & 0x200) {
s->cur_frame = s->iv_frame + 1; s->cur_frame = s->iv_frame + 1;
s->ref_frame = s->iv_frame; s->ref_frame = s->iv_frame;
} else { } else {
...@@ -1008,28 +1009,28 @@ static unsigned long iv_decode_frame(Indeo3DecodeContext *s, ...@@ -1008,28 +1009,28 @@ static unsigned long iv_decode_frame(Indeo3DecodeContext *s,
s->ref_frame = s->iv_frame + 1; s->ref_frame = s->iv_frame + 1;
} }
buf_pos = buf + 16 + offs1; buf_pos = buf + 16 + y_offset;
offs = bytestream_get_le32(&buf_pos); mc_vector_count = bytestream_get_le32(&buf_pos);
iv_Decode_Chunk(s, s->cur_frame->Ybuf, s->ref_frame->Ybuf, hdr_width, iv_Decode_Chunk(s, s->cur_frame->Ybuf, s->ref_frame->Ybuf, image_width,
hdr_height, buf_pos + offs * 2, fflags2, hdr_pos, buf_pos, image_height, buf_pos + mc_vector_count * 2, cb_offset, hdr_pos, buf_pos,
FFMIN(hdr_width, 160)); FFMIN(image_width, 160));
if (!(s->avctx->flags & CODEC_FLAG_GRAY)) if (!(s->avctx->flags & CODEC_FLAG_GRAY))
{ {
buf_pos = buf + 16 + offs2; buf_pos = buf + 16 + v_offset;
offs = bytestream_get_le32(&buf_pos); mc_vector_count = bytestream_get_le32(&buf_pos);
iv_Decode_Chunk(s, s->cur_frame->Vbuf, s->ref_frame->Vbuf, chroma_width, 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, chroma_height, buf_pos + mc_vector_count * 2, cb_offset, hdr_pos, buf_pos,
FFMIN(chroma_width, 40)); FFMIN(chroma_width, 40));
buf_pos = buf + 16 + offs3; buf_pos = buf + 16 + u_offset;
offs = bytestream_get_le32(&buf_pos); mc_vector_count = bytestream_get_le32(&buf_pos);
iv_Decode_Chunk(s, s->cur_frame->Ubuf, s->ref_frame->Ubuf, chroma_width, 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, chroma_height, buf_pos + mc_vector_count * 2, cb_offset, hdr_pos, buf_pos,
FFMIN(chroma_width, 40)); FFMIN(chroma_width, 40));
} }
......
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