[FFmpeg-devel] [PATCH] remove useless extern keywords
Måns Rullgård
mans
Tue Dec 2 02:32:36 CET 2008
Diego Biurrun <diego at biurrun.de> writes:
> In the nvidia patch review there were complaints about unnecessary
> extern keywords being added to the code. Since this was apparently a
> copy and paste issue from the xvmc code, I wondered why they were there
> in the first place.
>
> Here is a patch to get rid of them so no bad examples remain.
I'll comment on the files I maintain.
> Index: libavcodec/alpha/simple_idct_alpha.c
> ===================================================================
> --- libavcodec/alpha/simple_idct_alpha.c (revision 15974)
> +++ libavcodec/alpha/simple_idct_alpha.c (working copy)
> @@ -29,10 +29,10 @@
> #include "libavcodec/dsputil.h"
> #include "asm.h"
>
> -extern void (*put_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels,
> - int line_size);
> -extern void (*add_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels,
> - int line_size);
> +void (*put_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels,
> + int line_size);
> +void (*add_pixels_clamped_axp_p)(const DCTELEM *block, uint8_t *pixels,
> + int line_size);
Wrong. Those are function pointers.
> // cos(i * M_PI / 16) * sqrt(2) * (1 << 14)
> // W4 is actually exactly 16384, but using 16383 works around
> Index: libavcodec/alpha/dsputil_alpha.c
> ===================================================================
> --- libavcodec/alpha/dsputil_alpha.c (revision 15974)
> +++ libavcodec/alpha/dsputil_alpha.c (working copy)
> @@ -22,9 +22,9 @@
> #include "libavcodec/dsputil.h"
> #include "asm.h"
>
> -extern void simple_idct_axp(DCTELEM *block);
> -extern void simple_idct_put_axp(uint8_t *dest, int line_size, DCTELEM *block);
> -extern void simple_idct_add_axp(uint8_t *dest, int line_size, DCTELEM *block);
> +void simple_idct_axp(DCTELEM *block);
> +void simple_idct_put_axp(uint8_t *dest, int line_size, DCTELEM *block);
> +void simple_idct_add_axp(uint8_t *dest, int line_size, DCTELEM *block);
OK
> void put_pixels_axp_asm(uint8_t *block, const uint8_t *pixels,
> int line_size, int h);
> Index: libavcodec/sh4/dsputil_sh4.c
> ===================================================================
> --- libavcodec/sh4/dsputil_sh4.c (revision 15974)
> +++ libavcodec/sh4/dsputil_sh4.c (working copy)
> @@ -51,7 +51,7 @@
> memzero_align8(blocks,sizeof(DCTELEM)*6*64);
> }
>
> -extern void idct_sh4(DCTELEM *block);
> +void idct_sh4(DCTELEM *block);
> static void idct_put(uint8_t *dest, int line_size, DCTELEM *block)
> {
> int i;
> @@ -89,7 +89,7 @@
> }
> }
>
> -extern void dsputil_init_align(DSPContext* c, AVCodecContext *avctx);
> +void dsputil_init_align(DSPContext* c, AVCodecContext *avctx);
>
> void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx)
> {
OK. No maintainer, but I seem to be the only one around here who
knows SH4. (Yes, those should have an ff_ prefix.)
> Index: libavcodec/armv4l/mpegvideo_arm.c
> ===================================================================
> --- libavcodec/armv4l/mpegvideo_arm.c (revision 15974)
> +++ libavcodec/armv4l/mpegvideo_arm.c (working copy)
> @@ -22,8 +22,8 @@
> #include "libavcodec/dsputil.h"
> #include "libavcodec/mpegvideo.h"
>
> -extern void MPV_common_init_iwmmxt(MpegEncContext *s);
> -extern void MPV_common_init_armv5te(MpegEncContext *s);
> +void MPV_common_init_iwmmxt(MpegEncContext *s);
> +void MPV_common_init_armv5te(MpegEncContext *s);
>
> void MPV_common_init_armv4l(MpegEncContext *s)
> {
OK
> Index: libavcodec/armv4l/float_arm_vfp.c
> ===================================================================
> --- libavcodec/armv4l/float_arm_vfp.c (revision 15974)
> +++ libavcodec/armv4l/float_arm_vfp.c (working copy)
> @@ -20,10 +20,10 @@
>
> #include "libavcodec/dsputil.h"
>
> -extern void ff_vector_fmul_vfp(float *dst, const float *src, int len);
> -extern void ff_vector_fmul_reverse_vfp(float *dst, const float *src0,
> - const float *src1, int len);
> -extern void ff_float_to_int16_vfp(int16_t *dst, const float *src, long len);
> +void ff_vector_fmul_vfp(float *dst, const float *src, int len);
> +void ff_vector_fmul_reverse_vfp(float *dst, const float *src0,
> + const float *src1, int len);
> +void ff_float_to_int16_vfp(int16_t *dst, const float *src, long len);
>
> void ff_float_init_arm_vfp(DSPContext* c, AVCodecContext *avctx)
> {
OK
> Index: libavcodec/armv4l/mpegvideo_armv5te.c
> ===================================================================
> --- libavcodec/armv4l/mpegvideo_armv5te.c (revision 15974)
> +++ libavcodec/armv4l/mpegvideo_armv5te.c (working copy)
> @@ -23,8 +23,7 @@
> #include "libavcodec/dsputil.h"
> #include "libavcodec/mpegvideo.h"
>
> -extern void ff_dct_unquantize_h263_armv5te(DCTELEM *block, int qmul, int qadd,
> - int count);
> +void ff_dct_unquantize_h263_armv5te(DCTELEM *block, int qmul, int qadd, int count);
>
> #ifdef ENABLE_ARM_TESTS
> /**
OK
> Index: libavcodec/armv4l/dsputil_arm.c
> ===================================================================
> --- libavcodec/armv4l/dsputil_arm.c (revision 15974)
> +++ libavcodec/armv4l/dsputil_arm.c (working copy)
> @@ -24,23 +24,19 @@
> #include <ipp.h>
> #endif
>
> -extern void dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx);
> -extern void ff_float_init_arm_vfp(DSPContext* c, AVCodecContext *avctx);
> +void dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx);
> +void ff_float_init_arm_vfp(DSPContext* c, AVCodecContext *avctx);
>
> -extern void j_rev_dct_ARM(DCTELEM *data);
> -extern void simple_idct_ARM(DCTELEM *data);
> +void j_rev_dct_ARM(DCTELEM *data);
> +void simple_idct_ARM(DCTELEM *data);
>
> -extern void simple_idct_armv5te(DCTELEM *data);
> -extern void simple_idct_put_armv5te(uint8_t *dest, int line_size,
> - DCTELEM *data);
> -extern void simple_idct_add_armv5te(uint8_t *dest, int line_size,
> - DCTELEM *data);
> +void simple_idct_armv5te(DCTELEM *data);
> +void simple_idct_put_armv5te(uint8_t *dest, int line_size, DCTELEM *data);
> +void simple_idct_add_armv5te(uint8_t *dest, int line_size, DCTELEM *data);
>
> -extern void ff_simple_idct_armv6(DCTELEM *data);
> -extern void ff_simple_idct_put_armv6(uint8_t *dest, int line_size,
> - DCTELEM *data);
> -extern void ff_simple_idct_add_armv6(uint8_t *dest, int line_size,
> - DCTELEM *data);
> +void ff_simple_idct_armv6(DCTELEM *data);
> +void ff_simple_idct_put_armv6(uint8_t *dest, int line_size, DCTELEM *data);
> +void ff_simple_idct_add_armv6(uint8_t *dest, int line_size, DCTELEM *data);
>
> /* XXX: local hack */
> static void (*ff_put_pixels_clamped)(const DCTELEM *block, uint8_t *pixels, int line_size);
> @@ -57,7 +53,7 @@
>
> void put_pixels16_arm(uint8_t *block, const uint8_t *pixels, int line_size, int h);
>
> -extern void ff_prefetch_arm(void *mem, int stride, int h);
> +void ff_prefetch_arm(void *mem, int stride, int h);
>
> CALL_2X_PIXELS(put_pixels16_x2_arm , put_pixels8_x2_arm , 8)
> CALL_2X_PIXELS(put_pixels16_y2_arm , put_pixels8_y2_arm , 8)
> @@ -66,7 +62,7 @@
> CALL_2X_PIXELS(put_no_rnd_pixels16_y2_arm , put_no_rnd_pixels8_y2_arm , 8)
> CALL_2X_PIXELS(put_no_rnd_pixels16_xy2_arm, put_no_rnd_pixels8_xy2_arm, 8)
>
> -extern void ff_add_pixels_clamped_ARM(short *block, unsigned char *dest,
> +void ff_add_pixels_clamped_ARM(short *block, unsigned char *dest,
> int line_size);
>
> /* XXX: those functions should be suppressed ASAP when all IDCTs are
OK
> Index: libavformat/oggparsevorbis.c
> ===================================================================
> --- libavformat/oggparsevorbis.c (revision 15974)
> +++ libavformat/oggparsevorbis.c (working copy)
> @@ -30,7 +30,7 @@
> #include "avformat.h"
> #include "oggdec.h"
>
> -extern int
> +int
> vorbis_comment(AVFormatContext * as, uint8_t *buf, int size)
> {
> const uint8_t *p = buf;
OK
> Index: libavformat/oggdec.h
> ===================================================================
> --- libavformat/oggdec.h (revision 15974)
> +++ libavformat/oggdec.h (working copy)
> @@ -85,6 +85,6 @@
> extern const struct ogg_codec ff_theora_codec;
> extern const struct ogg_codec ff_vorbis_codec;
>
> -extern int vorbis_comment(AVFormatContext *ms, uint8_t *buf, int size);
> +int vorbis_comment(AVFormatContext *ms, uint8_t *buf, int size);
>
> #endif /* AVFORMAT_OGGDEC_H */
OK
> Index: libavformat/mpegts.c
> ===================================================================
> --- libavformat/mpegts.c (revision 15974)
> +++ libavformat/mpegts.c (working copy)
> @@ -38,8 +38,8 @@
>
> static PESContext* add_pes_stream(MpegTSContext *ts, int pid, int pcr_pid, int stream_type);
> static AVStream* new_pes_av_stream(PESContext *pes, uint32_t code);
> -extern void av_set_program_name(AVProgram *program, char *provider_name, char *name);
> -extern void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx);
> +void av_set_program_name(AVProgram *program, char *provider_name, char *name);
> +void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx);
>
> enum MpegTSFilterType {
> MPEGTS_PES,
Those declarations don't belong there at all. The definitions are in
utils.c. I don't know what the proper place would be. Michael?
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list