h264: mark some MC functions with av_always_inline instead of inline.

This actually causes them to be inlined, leading to a significant
speedup (1-1.5% in my measurements).
pull/2/head
Ronald S. Bultje 13 years ago
parent 05fb63f5a0
commit 27209bb108
  1. 60
      libavcodec/h264.c

@ -438,12 +438,13 @@ static void chroma_dc_dct_c(DCTELEM *block){
} }
#endif #endif
static inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square, static av_always_inline void
int height, int delta, int list, mc_dir_part(H264Context *h, Picture *pic, int n, int square,
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int height, int delta, int list,
int src_x_offset, int src_y_offset, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
qpel_mc_func *qpix_op, h264_chroma_mc_func chroma_op, int src_x_offset, int src_y_offset,
int pixel_shift, int chroma_idc) qpel_mc_func *qpix_op, h264_chroma_mc_func chroma_op,
int pixel_shift, int chroma_idc)
{ {
MpegEncContext * const s = &h->s; MpegEncContext * const s = &h->s;
const int mx= h->mv_cache[list][ scan8[n] ][0] + src_x_offset*8; const int mx= h->mv_cache[list][ scan8[n] ][0] + src_x_offset*8;
@ -535,12 +536,13 @@ static inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square,
mx&7, (my << (chroma_idc == 2 /* yuv422 */)) &7); mx&7, (my << (chroma_idc == 2 /* yuv422 */)) &7);
} }
static inline void mc_part_std(H264Context *h, int n, int square, int height, int delta, static av_always_inline void
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, mc_part_std(H264Context *h, int n, int square, int height, int delta,
int x_offset, int y_offset, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put, int x_offset, int y_offset,
qpel_mc_func *qpix_avg, h264_chroma_mc_func chroma_avg, qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put,
int list0, int list1, int pixel_shift, int chroma_idc) qpel_mc_func *qpix_avg, h264_chroma_mc_func chroma_avg,
int list0, int list1, int pixel_shift, int chroma_idc)
{ {
MpegEncContext * const s = &h->s; MpegEncContext * const s = &h->s;
qpel_mc_func *qpix_op= qpix_put; qpel_mc_func *qpix_op= qpix_put;
@ -578,13 +580,14 @@ static inline void mc_part_std(H264Context *h, int n, int square, int height, in
} }
} }
static inline void mc_part_weighted(H264Context *h, int n, int square, int height, int delta, static av_always_inline void
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, mc_part_weighted(H264Context *h, int n, int square, int height, int delta,
int x_offset, int y_offset, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put, int x_offset, int y_offset,
h264_weight_func luma_weight_op, h264_weight_func chroma_weight_op, qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put,
h264_biweight_func luma_weight_avg, h264_biweight_func chroma_weight_avg, h264_weight_func luma_weight_op, h264_weight_func chroma_weight_op,
int list0, int list1, int pixel_shift, int chroma_idc){ h264_biweight_func luma_weight_avg, h264_biweight_func chroma_weight_avg,
int list0, int list1, int pixel_shift, int chroma_idc){
MpegEncContext * const s = &h->s; MpegEncContext * const s = &h->s;
int chroma_height; int chroma_height;
@ -664,13 +667,14 @@ static inline void mc_part_weighted(H264Context *h, int n, int square, int heigh
} }
} }
static inline void mc_part(H264Context *h, int n, int square, int height, int delta, static av_always_inline void
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, mc_part(H264Context *h, int n, int square, int height, int delta,
int x_offset, int y_offset, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put, int x_offset, int y_offset,
qpel_mc_func *qpix_avg, h264_chroma_mc_func chroma_avg, qpel_mc_func *qpix_put, h264_chroma_mc_func chroma_put,
h264_weight_func *weight_op, h264_biweight_func *weight_avg, qpel_mc_func *qpix_avg, h264_chroma_mc_func chroma_avg,
int list0, int list1, int pixel_shift, int chroma_idc) h264_weight_func *weight_op, h264_biweight_func *weight_avg,
int list0, int list1, int pixel_shift, int chroma_idc)
{ {
if((h->use_weight==2 && list0 && list1 if((h->use_weight==2 && list0 && list1
&& (h->implicit_weight[ h->ref_cache[0][scan8[n]] ][ h->ref_cache[1][scan8[n]] ][h->s.mb_y&1] != 32)) && (h->implicit_weight[ h->ref_cache[0][scan8[n]] ][ h->ref_cache[1][scan8[n]] ][h->s.mb_y&1] != 32))
@ -685,7 +689,9 @@ static inline void mc_part(H264Context *h, int n, int square, int height, int de
chroma_avg, list0, list1, pixel_shift, chroma_idc); chroma_avg, list0, list1, pixel_shift, chroma_idc);
} }
static inline void prefetch_motion(H264Context *h, int list, int pixel_shift, int chroma_idc){ static av_always_inline void
prefetch_motion(H264Context *h, int list, int pixel_shift, int chroma_idc)
{
/* fetch pixels for estimated mv 4 macroblocks ahead /* fetch pixels for estimated mv 4 macroblocks ahead
* optimized for 64byte cache lines */ * optimized for 64byte cache lines */
MpegEncContext * const s = &h->s; MpegEncContext * const s = &h->s;

Loading…
Cancel
Save