1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avcodec/vc1_mc: Don't check AVFrame INTERLACE flags

Instead cache these values in VC1Context to avoid the indirection
and AND.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2024-05-04 16:20:42 +02:00
parent 59422955cf
commit dac15a5b6e
3 changed files with 12 additions and 11 deletions

View File

@ -293,6 +293,7 @@ typedef struct VC1Context{
uint8_t next_luty[2][256], next_lutuv[2][256]; ///< lookup tables used for intensity compensation
uint8_t (*curr_luty)[256] ,(*curr_lutuv)[256];
int last_use_ic, *curr_use_ic, next_use_ic, aux_use_ic;
int last_interlaced, next_interlaced; ///< whether last_pic, next_pic is interlaced
int rnd; ///< rounding control
int cbptab;

View File

@ -233,7 +233,7 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir)
luty = v->last_luty;
lutuv = v->last_lutuv;
use_ic = v->last_use_ic;
interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED);
interlace = v->last_interlaced;
}
} else {
srcY = s->next_pic.data[0];
@ -242,7 +242,7 @@ void ff_vc1_mc_1mv(VC1Context *v, int dir)
luty = v->next_luty;
lutuv = v->next_lutuv;
use_ic = v->next_use_ic;
interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED);
interlace = v->next_interlaced;
}
if (!srcY || !srcU) {
@ -482,13 +482,13 @@ void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg)
srcY = s->last_pic.data[0];
luty = v->last_luty;
use_ic = v->last_use_ic;
interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED);
interlace = v->last_interlaced;
}
} else {
srcY = s->next_pic.data[0];
luty = v->next_luty;
use_ic = v->next_use_ic;
interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED);
interlace = v->next_interlaced;
}
if (!srcY) {
@ -708,14 +708,14 @@ void ff_vc1_mc_4mv_chroma(VC1Context *v, int dir)
srcV = s->last_pic.data[2];
lutuv = v->last_lutuv;
use_ic = v->last_use_ic;
interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED);
interlace = v->last_interlaced;
}
} else {
srcU = s->next_pic.data[1];
srcV = s->next_pic.data[2];
lutuv = v->next_lutuv;
use_ic = v->next_use_ic;
interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED);
interlace = v->next_interlaced;
}
if (!srcU) {
@ -884,13 +884,13 @@ void ff_vc1_mc_4mv_chroma4(VC1Context *v, int dir, int dir2, int avg)
srcV = s->next_pic.data[2];
lutuv = v->next_lutuv;
use_ic = v->next_use_ic;
interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED);
interlace = v->next_interlaced;
} else {
srcU = s->last_pic.data[1];
srcV = s->last_pic.data[2];
lutuv = v->last_lutuv;
use_ic = v->last_use_ic;
interlace = !!(s->last_pic.f->flags & AV_FRAME_FLAG_INTERLACED);
interlace = v->last_interlaced;
}
if (!srcU)
return;
@ -1009,7 +1009,7 @@ void ff_vc1_interp_mc(VC1Context *v)
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 use_ic = v->next_use_ic;
int interlace;
int interlace = v->next_interlaced;
int linesize, uvlinesize;
if (!v->field_mode && !v->s.next_pic.data[0])
@ -1034,8 +1034,6 @@ void ff_vc1_interp_mc(VC1Context *v)
srcU = s->next_pic.data[1];
srcV = s->next_pic.data[2];
interlace = !!(s->next_pic.f->flags & AV_FRAME_FLAG_INTERLACED);
src_x = s->mb_x * 16 + (mx >> 2);
src_y = s->mb_y * 16 + (my >> 2);
uvsrc_x = s->mb_x * 8 + (uvmx >> 2);

View File

@ -1064,6 +1064,8 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict,
v->s.cur_pic_ptr->field_picture = v->field_mode;
v->s.cur_pic_ptr->f->flags |= AV_FRAME_FLAG_INTERLACED * (v->fcm != PROGRESSIVE);
v->s.cur_pic_ptr->f->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * !!v->tff;
v->last_interlaced = v->s.last_pic_ptr ? v->s.last_pic_ptr->f->flags & AV_FRAME_FLAG_INTERLACED : 0;
v->next_interlaced = v->s.next_pic_ptr ? v->s.next_pic_ptr->f->flags & AV_FRAME_FLAG_INTERLACED : 0;
// process pulldown flags
s->cur_pic_ptr->f->repeat_pict = 0;