diff options
author | Mans Rullgard <mans@mansr.com> | 2012-09-19 22:30:06 +0100 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2012-09-20 10:56:30 +0100 |
commit | a34a609fc1c21f6ab07ce0469e38c76a2ae077d1 (patch) | |
tree | 212a0c48ee7e6bf509cee2f0d4dac6f527daff71 /libavcodec/motion_est_template.c | |
parent | 50d1f4437be88a4b7e412e90d71153cae68017cc (diff) | |
download | ffmpeg-a34a609fc1c21f6ab07ce0469e38c76a2ae077d1.tar.gz |
motion_est: fix use of inline on extern functions
Inline functions declared without extern do not provide an external
definition in standard C99. This code only works because most
compilers do not implement the inline semantics correctly. With a
stricter compiler, linking fails with unresolved references to these
functions.
Declaring the functions extern inline works correctly with some
compilers while some others still fail to create external definitions.
For maximum portability, create a static inline version with an
externally visible wrapper for ff_get_mb_score. ff_epzs_motion_search
is so large that no sane compiler inlines it anyway, so there the
inline keyword can simply be dropped with no effect.
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavcodec/motion_est_template.c')
-rw-r--r-- | libavcodec/motion_est_template.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/libavcodec/motion_est_template.c b/libavcodec/motion_est_template.c index d0d4b4107a..136d8b8494 100644 --- a/libavcodec/motion_est_template.c +++ b/libavcodec/motion_est_template.c @@ -160,8 +160,9 @@ static int no_sub_motion_search(MpegEncContext * s, return dmin; } -inline int ff_get_mb_score(MpegEncContext * s, int mx, int my, int src_index, - int ref_index, int size, int h, int add_rate) +static inline int get_mb_score(MpegEncContext *s, int mx, int my, + int src_index, int ref_index, int size, + int h, int add_rate) { // const int check_luma= s->dsp.me_sub_cmp != s->dsp.mb_cmp; MotionEstContext * const c= &s->me; @@ -190,6 +191,12 @@ inline int ff_get_mb_score(MpegEncContext * s, int mx, int my, int src_index, return d; } +int ff_get_mb_score(MpegEncContext *s, int mx, int my, int src_index, + int ref_index, int size, int h, int add_rate) +{ + return get_mb_score(s, mx, my, src_index, ref_index, size, h, add_rate); +} + #define CHECK_QUARTER_MV(dx, dy, x, y)\ {\ const int hx= 4*(x)+(dx);\ @@ -972,9 +979,10 @@ static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int } //this function is dedicated to the braindamaged gcc -inline int ff_epzs_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr, - int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], - int ref_mv_scale, int size, int h) +int ff_epzs_motion_search(MpegEncContext *s, int *mx_ptr, int *my_ptr, + int P[10][2], int src_index, int ref_index, + int16_t (*last_mv)[2], int ref_mv_scale, + int size, int h) { MotionEstContext * const c= &s->me; //FIXME convert other functions in the same way if faster |