diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-03 17:44:30 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-05-28 13:56:24 +0300 |
commit | d8b9dbe7768c958dc40d65450f6cc5740f1b46a7 (patch) | |
tree | 8703353a53d8d88f9fec9b3b8ed0db4e3eaace12 /libavcodec/vc1dec.c | |
parent | 17410faa22a91cea82087395790faad745789fc8 (diff) | |
download | ffmpeg-d8b9dbe7768c958dc40d65450f6cc5740f1b46a7.tar.gz |
vc1dec: Fix mixed field/frame intensity compensation
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec/vc1dec.c')
-rw-r--r-- | libavcodec/vc1dec.c | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 2b3edc6725..42dc83f120 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -348,7 +348,7 @@ static void vc1_mc_1mv(VC1Context *v, int dir) int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; int v_edge_pos = s->v_edge_pos >> v->field_mode; int i; - const uint8_t *luty, *lutuv; + uint8_t (*luty)[256], (*lutuv)[256]; int use_ic; if ((!v->field_mode || @@ -388,23 +388,23 @@ static void vc1_mc_1mv(VC1Context *v, int dir) srcY = s->current_picture.f.data[0]; srcU = s->current_picture.f.data[1]; srcV = s->current_picture.f.data[2]; - luty = v->curr_luty [v->ref_field_type[dir]]; - lutuv = v->curr_lutuv[v->ref_field_type[dir]]; + luty = v->curr_luty; + lutuv = v->curr_lutuv; use_ic = v->curr_use_ic; } else { srcY = s->last_picture.f.data[0]; srcU = s->last_picture.f.data[1]; srcV = s->last_picture.f.data[2]; - luty = v->last_luty [v->ref_field_type[dir]]; - lutuv = v->last_lutuv[v->ref_field_type[dir]]; + luty = v->last_luty; + lutuv = v->last_lutuv; use_ic = v->last_use_ic; } } else { srcY = s->next_picture.f.data[0]; srcU = s->next_picture.f.data[1]; srcV = s->next_picture.f.data[2]; - luty = v->next_luty [v->ref_field_type[dir]]; - lutuv = v->next_lutuv[v->ref_field_type[dir]]; + luty = v->next_luty; + lutuv = v->next_lutuv; use_ic = v->next_use_ic; } @@ -488,16 +488,18 @@ static void vc1_mc_1mv(VC1Context *v, int dir) src = srcY; for (j = 0; j < 17 + s->mspel * 2; j++) { + int f = v->field_mode ? v->ref_field_type[dir] : ((j + src_y - s->mspel) & 1) ; for (i = 0; i < 17 + s->mspel * 2; i++) - src[i] = luty[src[i]]; + src[i] = luty[f][src[i]]; src += s->linesize; } src = srcU; src2 = srcV; for (j = 0; j < 9; j++) { + int f = v->field_mode ? v->ref_field_type[dir] : ((j + uvsrc_y) & 1); for (i = 0; i < 9; i++) { - src[i] = lutuv[src[i]]; - src2[i] = lutuv[src2[i]]; + src[i] = lutuv[f][src[i]]; + src2[i] = lutuv[f][src2[i]]; } src += s->uvlinesize; src2 += s->uvlinesize; @@ -555,7 +557,7 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) int off; int fieldmv = (v->fcm == ILACE_FRAME) ? v->blk_mv_type[s->block_index[n]] : 0; int v_edge_pos = s->v_edge_pos >> v->field_mode; - const uint8_t *luty; + uint8_t (*luty)[256]; int use_ic; if ((!v->field_mode || @@ -569,16 +571,16 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) if (!dir) { if (v->field_mode && (v->cur_field_type != v->ref_field_type[dir]) && v->second_field) { srcY = s->current_picture.f.data[0]; - luty = v->curr_luty[v->ref_field_type[dir]]; + luty = v->curr_luty; use_ic = v->curr_use_ic; } else { srcY = s->last_picture.f.data[0]; - luty = v->last_luty[v->ref_field_type[dir]]; + luty = v->last_luty; use_ic = v->last_use_ic; } } else { srcY = s->next_picture.f.data[0]; - luty = v->next_luty[v->ref_field_type[dir]]; + luty = v->next_luty; use_ic = v->next_use_ic; } @@ -706,8 +708,9 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) src = srcY; for (j = 0; j < 9 + s->mspel * 2; j++) { + int f = v->field_mode ? v->ref_field_type[dir] : (((j<<fieldmv)+src_y - (s->mspel << fieldmv)) & 1); for (i = 0; i < 9 + s->mspel * 2; i++) - src[i] = luty[src[i]]; + src[i] = luty[f][src[i]]; src += s->linesize << fieldmv; } } @@ -795,7 +798,7 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir) int valid_count; int chroma_ref_type = v->cur_field_type; int v_edge_pos = s->v_edge_pos >> v->field_mode; - const uint8_t *lutuv; + uint8_t (*lutuv)[256]; int use_ic; if (!v->field_mode && !v->s.last_picture.f.data[0]) @@ -862,18 +865,18 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir) if (v->field_mode && (v->cur_field_type != chroma_ref_type) && v->second_field) { srcU = s->current_picture.f.data[1]; srcV = s->current_picture.f.data[2]; - lutuv = v->curr_lutuv[chroma_ref_type]; + lutuv = v->curr_lutuv; use_ic = v->curr_use_ic; } else { srcU = s->last_picture.f.data[1]; srcV = s->last_picture.f.data[2]; - lutuv = v->last_lutuv[chroma_ref_type]; + lutuv = v->last_lutuv; use_ic = v->last_use_ic; } } else { srcU = s->next_picture.f.data[1]; srcV = s->next_picture.f.data[2]; - lutuv = v->next_lutuv[chroma_ref_type]; + lutuv = v->next_lutuv; use_ic = v->next_use_ic; } @@ -924,9 +927,10 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir) src = srcU; src2 = srcV; for (j = 0; j < 9; j++) { + int f = v->field_mode ? chroma_ref_type : ((j + uvsrc_y) & 1); for (i = 0; i < 9; i++) { - src[i] = lutuv[src[i]]; - src2[i] = lutuv[src2[i]]; + src[i] = lutuv[f][src[i]]; + src2[i] = lutuv[f][src2[i]]; } src += s->uvlinesize; src2 += s->uvlinesize; @@ -1972,23 +1976,25 @@ static void vc1_interp_mc(VC1Context *v) } if (use_ic) { - const uint8_t *luty = v->next_luty [v->ref_field_type[1]]; - const uint8_t *lutuv= v->next_lutuv[v->ref_field_type[1]]; + uint8_t (*luty )[256] = v->next_luty; + uint8_t (*lutuv)[256] = v->next_lutuv; int i, j; uint8_t *src, *src2; src = srcY; for (j = 0; j < 17 + s->mspel * 2; j++) { + int f = v->field_mode ? v->ref_field_type[1] : ((j+src_y - s->mspel) & 1); for (i = 0; i < 17 + s->mspel * 2; i++) - src[i] = luty[src[i]]; + src[i] = luty[f][src[i]]; src += s->linesize; } src = srcU; src2 = srcV; for (j = 0; j < 9; j++) { + int f = v->field_mode ? v->ref_field_type[1] : ((j+uvsrc_y) & 1); for (i = 0; i < 9; i++) { - src[i] = lutuv[src[i]]; - src2[i] = lutuv[src2[i]]; + src[i] = lutuv[f][src[i]]; + src2[i] = lutuv[f][src2[i]]; } src += s->uvlinesize; src2 += s->uvlinesize; |