aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-24 20:27:34 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-04-24 21:08:17 +0200
commit100184ccffbf8a25098a943b71b1cd2e599de2ec (patch)
treecdfbc019237df2e7e08d8cf71ff217ca74315c52
parent84c0ec92ae793673b7584eaebc3cba09a2927dd5 (diff)
downloadffmpeg-100184ccffbf8a25098a943b71b1cd2e599de2ec.tar.gz
vc1: use use_ic instead of shuffling mv_mode around
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/vc1dec.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 048745d4e2..442a69b489 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -352,6 +352,7 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
int v_edge_pos = s->v_edge_pos >> v->field_mode;
int i;
const uint8_t *luty, *lutuv;
+ int use_ic;
if ((!v->field_mode ||
(v->ref_field_type[dir] == 1 && v->cur_field_type == 1)) &&
@@ -392,12 +393,14 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
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]];
+ 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]];
+ use_ic=v->last_use_ic;
}
} else {
srcY = s->next_picture.f.data[0];
@@ -405,6 +408,7 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
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]];
+ use_ic=v->next_use_ic;
}
if(!srcY)
@@ -443,7 +447,7 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
srcV = s->edge_emu_buffer + 18 * s->linesize;
}
- if (v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
+ if (v->rangeredfrm || use_ic
|| s->h_edge_pos < 22 || v_edge_pos < 22
|| (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 16 - s->mspel * 3
|| (unsigned)(src_y - 1) > v_edge_pos - (my&3) - 16 - 3) {
@@ -484,7 +488,7 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
}
}
/* if we deal with intensity compensation we need to scale source blocks */
- if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
+ if (use_ic) {
int i, j;
uint8_t *src, *src2;
@@ -560,6 +564,7 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg)
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;
+ int use_ic;
if ((!v->field_mode ||
(v->ref_field_type[dir] == 1 && v->cur_field_type == 1)) &&
@@ -573,13 +578,16 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg)
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]];
+ use_ic=v->curr_use_ic;
} else {
srcY = s->last_picture.f.data[0];
luty = v->last_luty[v->ref_field_type[dir]];
+ use_ic=v->last_use_ic;
}
} else {
srcY = s->next_picture.f.data[0];
luty = v->next_luty[v->ref_field_type[dir]];
+ use_ic=v->next_use_ic;
}
if(!srcY)
@@ -681,7 +689,7 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg)
v_edge_pos--;
if (fieldmv && (src_y & 1) && src_y < 4)
src_y--;
- if (v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
+ if (v->rangeredfrm || use_ic
|| s->h_edge_pos < 13 || v_edge_pos < 23
|| (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx & 3) - 8 - s->mspel * 2
|| (unsigned)(src_y - (s->mspel << fieldmv)) > v_edge_pos - (my & 3) - ((8 + s->mspel * 2) << fieldmv)) {
@@ -705,7 +713,7 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg)
}
}
/* if we deal with intensity compensation we need to scale source blocks */
- if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
+ if (use_ic) {
int i, j;
uint8_t *src;
@@ -801,6 +809,7 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir)
int chroma_ref_type = v->cur_field_type, off = 0;
int v_edge_pos = s->v_edge_pos >> v->field_mode;
const uint8_t *lutuv;
+ int use_ic;
if (!v->field_mode && !v->s.last_picture.f.data[0])
return;
@@ -867,15 +876,18 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir)
srcU = s->current_picture.f.data[1];
srcV = s->current_picture.f.data[2];
lutuv= v->curr_lutuv[chroma_ref_type];
+ 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];
+ 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];
+ use_ic=v->next_use_ic;
}
if(!srcU)
@@ -892,7 +904,7 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir)
off = 0;
}
- if (v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
+ if (v->rangeredfrm || use_ic
|| s->h_edge_pos < 18 || v_edge_pos < 18
|| (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9
|| (unsigned)uvsrc_y > (v_edge_pos >> 1) - 9) {
@@ -922,7 +934,7 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir)
}
}
/* if we deal with intensity compensation we need to scale source blocks */
- if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
+ if (use_ic) {
int i, j;
uint8_t *src, *src2;
@@ -965,6 +977,7 @@ static void vc1_mc_4mv_chroma4(VC1Context *v)
static const int s_rndtblfield[16] = { 0, 0, 1, 2, 4, 4, 5, 6, 2, 2, 3, 8, 6, 6, 7, 12 };
int v_dist = fieldmv ? 1 : 4; // vertical offset for lower sub-blocks
int v_edge_pos = s->v_edge_pos >> 1;
+ int use_ic = v->last_use_ic;
if (!v->s.last_picture.f.data[0])
return;
@@ -998,7 +1011,7 @@ static void vc1_mc_4mv_chroma4(VC1Context *v)
if (fieldmv && (uvsrc_y & 1) && uvsrc_y < 2)
uvsrc_y--;
- if ((v->mv_mode == MV_PMODE_INTENSITY_COMP)
+ if ((use_ic)
|| s->h_edge_pos < 10 || v_edge_pos < (5 << fieldmv)
|| (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 5
|| (unsigned)uvsrc_y > v_edge_pos - (5 << fieldmv)) {
@@ -1012,7 +1025,7 @@ static void vc1_mc_4mv_chroma4(VC1Context *v)
srcV = s->edge_emu_buffer + 16;
/* if we deal with intensity compensation we need to scale source blocks */
- if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
+ if (use_ic) {
int i, j;
uint8_t *src, *src2;
const uint8_t *lutuv = v->last_lutuv[v->ref_field_type[0]];
@@ -1864,6 +1877,7 @@ static void vc1_interp_mc(VC1Context *v)
int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y;
int off, off_uv;
int v_edge_pos = s->v_edge_pos >> v->field_mode;
+ int use_ic = v->next_use_ic;
if (!v->field_mode && !v->s.next_picture.f.data[0])
return;
@@ -1918,7 +1932,7 @@ static void vc1_interp_mc(VC1Context *v)
srcV = s->edge_emu_buffer + 18 * s->linesize;
}
- if (v->rangeredfrm || s->h_edge_pos < 22 || v_edge_pos < 22 || v->mv_mode == MV_PMODE_INTENSITY_COMP
+ if (v->rangeredfrm || s->h_edge_pos < 22 || v_edge_pos < 22 || use_ic
|| (unsigned)(src_x - 1) > s->h_edge_pos - (mx & 3) - 16 - 3
|| (unsigned)(src_y - 1) > v_edge_pos - (my & 3) - 16 - 3) {
uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize;
@@ -1958,7 +1972,7 @@ static void vc1_interp_mc(VC1Context *v)
}
}
- if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
+ 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]];
int i, j;