diff options
author | Mans Rullgard <mans@mansr.com> | 2012-08-04 02:30:02 +0100 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2012-08-09 01:31:37 +0100 |
commit | f69f4036f8cc3b673864dce01d2714fd5e49e8da (patch) | |
tree | c8198545eaebf8f7cb6ba5a995fa3da3675f3d38 /libavcodec | |
parent | 7a851153d3fe1a9e0d60bf11053870d1ea8241e6 (diff) | |
download | ffmpeg-f69f4036f8cc3b673864dce01d2714fd5e49e8da.tar.gz |
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>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/mpegvideo_motion.c | 67 |
1 files changed, 42 insertions, 25 deletions
diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c index ea0695323b..d4c4d6e640 100644 --- a/libavcodec/mpegvideo_motion.c +++ b/libavcodec/mpegvideo_motion.c @@ -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, - 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 motion_x, int motion_y, int h, int mb_y) +static void mpeg_motion(MpegEncContext *s, + uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, + 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,15 +799,15 @@ 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], - ref_picture, pix_op, - s->mv[dir][0][0], s->mv[dir][0][1], 8, mb_y); + 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], - ref_picture, pix_op, - s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y); + 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); } } else { if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field){ @@ -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); |