mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-16 04:15:05 +00:00
mpegvideo: reduce excessive inlining of mpeg_motion()
The main benefit of inlining this function is from constant propagation for the 'field_based' argument. Instead of inlining all calls, create two versions of the function for field_based values of 0 and 1. Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
parent
7a851153d3
commit
f69f4036f8
@ -339,21 +339,39 @@ if(s->quarter_sample)
|
||||
}
|
||||
}
|
||||
/* apply one mpeg motion vector to the three components */
|
||||
static av_always_inline
|
||||
void mpeg_motion(MpegEncContext *s,
|
||||
static void mpeg_motion(MpegEncContext *s,
|
||||
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
|
||||
int field_based, int bottom_field, int field_select,
|
||||
uint8_t **ref_picture, op_pixels_func (*pix_op)[4],
|
||||
int field_select, uint8_t **ref_picture,
|
||||
op_pixels_func (*pix_op)[4],
|
||||
int motion_x, int motion_y, int h, int mb_y)
|
||||
{
|
||||
#if !CONFIG_SMALL
|
||||
if(s->out_format == FMT_MPEG1)
|
||||
mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, field_based,
|
||||
mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, 0, 0,
|
||||
field_select, ref_picture, pix_op,
|
||||
motion_x, motion_y, h, 1, mb_y);
|
||||
else
|
||||
#endif
|
||||
mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, 0, 0,
|
||||
field_select, ref_picture, pix_op,
|
||||
motion_x, motion_y, h, 0, mb_y);
|
||||
}
|
||||
|
||||
static void mpeg_motion_field(MpegEncContext *s, uint8_t *dest_y,
|
||||
uint8_t *dest_cb, uint8_t *dest_cr,
|
||||
int bottom_field, int field_select,
|
||||
uint8_t **ref_picture,
|
||||
op_pixels_func (*pix_op)[4],
|
||||
int motion_x, int motion_y, int h, int mb_y)
|
||||
{
|
||||
#if !CONFIG_SMALL
|
||||
if(s->out_format == FMT_MPEG1)
|
||||
mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, 1,
|
||||
bottom_field, field_select, ref_picture, pix_op,
|
||||
motion_x, motion_y, h, 1, mb_y);
|
||||
else
|
||||
#endif
|
||||
mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, field_based,
|
||||
mpeg_motion_internal(s, dest_y, dest_cb, dest_cr, 1,
|
||||
bottom_field, field_select, ref_picture, pix_op,
|
||||
motion_x, motion_y, h, 0, mb_y);
|
||||
}
|
||||
@ -708,8 +726,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
|
||||
s->mv[dir][0][0], s->mv[dir][0][1], 16);
|
||||
}else
|
||||
{
|
||||
mpeg_motion(s, dest_y, dest_cb, dest_cr,
|
||||
0, 0, 0,
|
||||
mpeg_motion(s, dest_y, dest_cb, dest_cr, 0,
|
||||
ref_picture, pix_op,
|
||||
s->mv[dir][0][0], s->mv[dir][0][1], 16, mb_y);
|
||||
}
|
||||
@ -782,13 +799,13 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
|
||||
}
|
||||
}else{
|
||||
/* top field */
|
||||
mpeg_motion(s, dest_y, dest_cb, dest_cr,
|
||||
1, 0, s->field_select[dir][0],
|
||||
mpeg_motion_field(s, dest_y, dest_cb, dest_cr,
|
||||
0, s->field_select[dir][0],
|
||||
ref_picture, pix_op,
|
||||
s->mv[dir][0][0], s->mv[dir][0][1], 8, mb_y);
|
||||
/* bottom field */
|
||||
mpeg_motion(s, dest_y, dest_cb, dest_cr,
|
||||
1, 1, s->field_select[dir][1],
|
||||
mpeg_motion_field(s, dest_y, dest_cb, dest_cr,
|
||||
1, s->field_select[dir][1],
|
||||
ref_picture, pix_op,
|
||||
s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y);
|
||||
}
|
||||
@ -798,7 +815,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
|
||||
}
|
||||
|
||||
mpeg_motion(s, dest_y, dest_cb, dest_cr,
|
||||
0, 0, s->field_select[dir][0],
|
||||
s->field_select[dir][0],
|
||||
ref_picture, pix_op,
|
||||
s->mv[dir][0][0], s->mv[dir][0][1], 16, mb_y>>1);
|
||||
}
|
||||
@ -815,7 +832,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
|
||||
}
|
||||
|
||||
mpeg_motion(s, dest_y, dest_cb, dest_cr,
|
||||
0, 0, s->field_select[dir][i],
|
||||
s->field_select[dir][i],
|
||||
ref2picture, pix_op,
|
||||
s->mv[dir][i][0], s->mv[dir][i][1] + 16*i, 8, mb_y>>1);
|
||||
|
||||
@ -829,17 +846,17 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
|
||||
for(i=0; i<2; i++){
|
||||
int j;
|
||||
for(j=0; j<2; j++){
|
||||
mpeg_motion(s, dest_y, dest_cb, dest_cr,
|
||||
1, j, j^i,
|
||||
ref_picture, pix_op,
|
||||
s->mv[dir][2*i + j][0], s->mv[dir][2*i + j][1], 8, mb_y);
|
||||
mpeg_motion_field(s, dest_y, dest_cb, dest_cr,
|
||||
j, j^i, ref_picture, pix_op,
|
||||
s->mv[dir][2*i + j][0],
|
||||
s->mv[dir][2*i + j][1], 8, mb_y);
|
||||
}
|
||||
pix_op = s->dsp.avg_pixels_tab;
|
||||
}
|
||||
}else{
|
||||
for(i=0; i<2; i++){
|
||||
mpeg_motion(s, dest_y, dest_cb, dest_cr,
|
||||
0, 0, s->picture_structure != i+1,
|
||||
s->picture_structure != i+1,
|
||||
ref_picture, pix_op,
|
||||
s->mv[dir][2*i][0],s->mv[dir][2*i][1],16, mb_y>>1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user