[FFmpeg-devel] [PATCH] h264.c : fix svq3_* function declarations

Måns Rullgård mans
Wed Jan 27 13:33:03 CET 2010


Rafa?l Carr? <rafael.carre at gmail.com> writes:

> Hi,
>
> svq3_luma_dc_dequant_idct_c and svq3_add_idct_c are defined (extern) in
> svq3.c since r21157, but still static in h264.c
>
> Note: I found this issue because of:
> /usr/bin/ld: ..../lib/libavcodec.a(h264.o): relocation R_X86_64_PC32
> against symbol `svq3_add_idct_c' can not be used when making a shared
> object; recompile with -fPIC
>
> When building a shared object against a static libavcodec
>
> With the patch, a correct relocation is generated.
>
> Btw, why not moving the functions to h264.c if it's only used there:
> Is the file too big already, or should the functions be used one day in
> the svq3 decoder ?
>
> -- 
> Rafa?l Carr?
>
> diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> index e4a47cf..6440b0b 100644
> --- a/libavcodec/h264.c
> +++ b/libavcodec/h264.c
> @@ -43,8 +43,9 @@
>  //#undef NDEBUG
>  #include <assert.h>
>  
> -static void svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp);
> -static void svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc);
> +/* from svq3.c */
> +void svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp);
> +void svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc);

Prototypes for extern functions should be in some header file included
both by file(s) containing the definitions and those using the functions.

BTW, when building your shared lib, you might want to use the
-Wl,-Bsymbolic flag.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list