[Ffmpeg-devel] Re: [PATCH] portability fixes (ILP32 vs LP64)

Dieter freebsd
Tue Jan 24 17:53:30 CET 2006


>> Here are fixes for some of the compiler warnings I got
>> building the cvs version of ffmpeg on FreeBSD 6.0.
>> They should help with portability between ILP32 and LP64.

> Send a unified diff (diff -u), not a context diff.

Here they are with only -u rather than -u -c.


Diffs for file: libavcodec/i386/h264dsp_mmx.c

===================================================================
RCS file: RCS/h264dsp_mmx.c,v
retrieving revision 1.1
diff -u -r1.1 h264dsp_mmx.c
--- h264dsp_mmx.c	2006/01/18 01:15:54	1.1
+++ h264dsp_mmx.c	2006/01/18 17:06:06
@@ -65,6 +65,11 @@
     "packuswb  "#z",    "#p" \n\t"\
     "movd      "#p",    (%0) \n\t"
 
+
+/* prototypes */
+void ff_h264_idct_add_mmx2(uint8_t *, int16_t *, int);
+
+
 void ff_h264_idct_add_mmx2(uint8_t *dst, int16_t *block, int stride)
 {
     /* Load dct coeffs */



Diffs for file: libavcodec/i386/idct_mmx_xvid.c

===================================================================
RCS file: RCS/idct_mmx_xvid.c,v
retrieving revision 1.1
diff -u -r1.1 idct_mmx_xvid.c
--- idct_mmx_xvid.c	2006/01/18 01:20:25	1.1
+++ idct_mmx_xvid.c	2006/01/18 17:06:53
@@ -486,6 +486,12 @@
 // Code
 //=============================================================================
 
+
+/* prototypes */
+void ff_idct_xvid_mmx(short *);
+void ff_idct_xvid_mmx2(short *);
+
+
 //-----------------------------------------------------------------------------
 // void idct_mmx(uint16_t block[64]);
 //-----------------------------------------------------------------------------



Diffs for file: libavcodec/i386/vp3dsp_mmx.c

===================================================================
RCS file: RCS/vp3dsp_mmx.c,v
retrieving revision 1.1
diff -u -r1.1 vp3dsp_mmx.c
--- vp3dsp_mmx.c	2006/01/18 01:17:34	1.1
+++ vp3dsp_mmx.c	2006/01/18 17:07:32
@@ -257,6 +257,12 @@
     movq_r2m(r2, *I(2)); \
 }
 
+
+/* prototypes */
+void ff_vp3_dsp_init_mmx(void);
+void ff_vp3_idct_mmx(int16_t *);
+
+
 void ff_vp3_dsp_init_mmx(void)
 {
     int j = 16;



Diffs for file: libavcodec/i386/vp3dsp_sse2.c

===================================================================
RCS file: RCS/vp3dsp_sse2.c,v
retrieving revision 1.1
diff -u -r1.1 vp3dsp_sse2.c
--- vp3dsp_sse2.c	2006/01/18 01:19:25	1.1
+++ vp3dsp_sse2.c	2006/01/18 17:05:03
@@ -796,6 +796,10 @@
 } /* end of SSE2_Dequantize Macro */
 
 
+/* prototypes */
+void ff_vp3_idct_sse2(int16_t *);
+
+
 void ff_vp3_idct_sse2(int16_t *input_data)
 {
     unsigned char *input_bytes = (unsigned char *)input_data;



Diffs for file: libavcodec/liba52/crc.c

===================================================================
RCS file: RCS/crc.c,v
retrieving revision 1.1
diff -u -r1.1 crc.c
--- crc.c	2006/01/18 17:41:51	1.1
+++ crc.c	2006/01/18 17:42:38
@@ -61,6 +61,11 @@
 	0x8213,0x0216,0x021c,0x8219,0x0208,0x820d,0x8207,0x0202
 };
 
+
+/* prototypes */
+uint16_t a52_crc16_block(uint8_t *, uint32_t);
+
+
 uint16_t a52_crc16_block(uint8_t *data,uint32_t num_bytes)
 {
 	uint32_t i;



Diffs for file: libavcodec/liba52/resample.c

===================================================================
RCS file: RCS/resample.c,v
retrieving revision 1.1
diff -u -r1.1 resample.c
--- resample.c	2006/01/18 17:42:54	1.1
+++ resample.c	2006/01/18 17:43:45
@@ -17,6 +17,11 @@
 #include "resample_mmx.c"
 #endif
 
+
+/* prototypes */
+void* a52_resample_init(uint32_t, int, int);
+
+
 void* a52_resample_init(uint32_t mm_accel,int flags,int chans){
 void* tmp;
 



Diffs for file: libavcodec/alac.c

===================================================================
RCS file: RCS/alac.c,v
retrieving revision 1.1
diff -u -r1.1 alac.c
--- alac.c	2006/01/18 00:40:35	1.1
+++ alac.c	2006/01/18 17:07:58
@@ -84,6 +84,13 @@
     alac->outputsamples_buffer_b = av_malloc(alac->setinfo_max_samples_per_frame * 4);
 }
 
+
+/* prototypes */
+void alac_set_info(ALACContext *);
+void bastardized_rice_decompress(ALACContext *, int32_t *, int, int, int, int, int, int);
+void deinterlace_16(int32_t *, int32_t *, int16_t *, int, int, uint8_t, uint8_t);
+
+
 void alac_set_info(ALACContext *alac)
 {
     unsigned char *ptr = alac->avctx->extradata;



Diffs for file: libavcodec/dvdsub.c

===================================================================
RCS file: RCS/dvdsub.c,v
retrieving revision 1.1
diff -u -r1.1 dvdsub.c
--- dvdsub.c	2006/01/18 00:45:26	1.1
+++ dvdsub.c	2006/01/18 17:08:21
@@ -23,6 +23,12 @@
 typedef struct DVDSubContext {
 } DVDSubContext;
 
+
+/* prototypes */
+uint16_t getbe16(const uint8_t *);
+int get_nibble(const uint8_t *, int);
+
+
 static int dvdsub_init_decoder(AVCodecContext *avctx)
 {
     return 0;



Diffs for file: libavcodec/flicvideo.c

===================================================================
RCS file: RCS/flicvideo.c,v
retrieving revision 1.1
diff -u -r1.1 flicvideo.c
--- flicvideo.c	2006/01/18 00:47:36	1.1
+++ flicvideo.c	2006/01/18 17:08:40
@@ -76,6 +76,11 @@
     int fli_type;  /* either 0xAF11 or 0xAF12, affects palette resolution */
 } FlicDecodeContext;
 
+
+/* prototypes */
+int flic_decode_frame_15_16BPP(AVCodecContext *, void *, int *, uint8_t *, int);
+
+
 static int flic_decode_init(AVCodecContext *avctx)
 {
     FlicDecodeContext *s = (FlicDecodeContext *)avctx->priv_data;



Diffs for file: libavcodec/h261.c

===================================================================
RCS file: RCS/h261.c,v
retrieving revision 1.1
diff -u -r1.1 h261.c
--- h261.c	2006/01/18 00:50:21	1.1
+++ h261.c	2006/01/18 17:08:55
@@ -56,6 +56,11 @@
     int gob_start_code_skipped; // 1 if gob start code is already read before gob header is read
 }H261Context;
 
+
+/* prototypes */
+int h261_decode_picture_header(H261Context *);
+
+
 void ff_h261_loop_filter(MpegEncContext *s){
     H261Context * h= (H261Context*)s;
     const int linesize  = s->linesize;



Diffs for file: libavcodec/h264.c

===================================================================
RCS file: RCS/h264.c,v
retrieving revision 1.1
diff -u -r1.1 h264.c
--- h264.c	2006/01/18 03:58:51	1.1
+++ h264.c	2006/01/18 17:09:13
@@ -385,6 +385,11 @@
 #endif
 }
 
+
+/* prototypes */
+void inline compute_mb_neighboors(H264Context *);
+
+
 /**
  * fill a rectangle.
  * @param h height of the rectangle, should be a constant



Diffs for file: libavcodec/mem.c

===================================================================
RCS file: RCS/mem.c,v
retrieving revision 1.1
diff -u -r1.1 mem.c
--- mem.c	2006/01/18 00:27:51	1.1
+++ mem.c	2006/01/18 00:28:39
@@ -46,7 +46,7 @@
 {
     void *ptr;
 #ifdef MEMALIGN_HACK
-    int diff;
+    long diff;
 #endif
 
     /* lets disallow possible ambiguous cases */
@@ -55,7 +55,7 @@
 
 #ifdef MEMALIGN_HACK
     ptr = malloc(size+16+1);
-    diff= ((-(int)ptr - 1)&15) + 1;
+    diff= ((-(long)ptr - 1)&15) + 1;
     ptr += diff;
     ((char*)ptr)[-1]= diff;
 #elif defined (HAVE_MEMALIGN)



Diffs for file: libavcodec/qdm2.c

===================================================================
RCS file: RCS/qdm2.c,v
retrieving revision 1.1
diff -u -r1.1 qdm2.c
--- qdm2.c	2006/01/18 00:52:07	1.1
+++ qdm2.c	2006/01/18 17:10:04
@@ -230,7 +230,15 @@
 static MPA_INT mpa_window[512] __attribute__((aligned(16)));
 
 
-static void softclip_table_init() {
+/* prototypes */
+void fix_coding_method_array (int, int, sb_int8_array);
+void qdm2_init(QDM2Context *);
+static int qdm2_decode_init(AVCodecContext *);
+static void qdm2_decode_sub_packet_header (GetBitContext *, QDM2SubPacket *);
+void qdm2_decode (QDM2Context *, uint8_t *, int16_t *);
+
+
+static void softclip_table_init(void) {
     int i;
     double dfl = SOFTCLIP_THRESHOLD - 32767;
     float delta = 1.0 / -dfl;
@@ -240,7 +248,7 @@
 
 
 // random generated table
-static void rnd_table_init() {
+static void rnd_table_init(void) {
     int i,j;
     uint32_t ldw,hdw;
     uint64_t tmp64_1;
@@ -276,7 +284,7 @@
 }
 
 
-static void init_noise_samples() {
+static void init_noise_samples(void) {
     int i;
     int random_seed = 0;
     float delta = 1.0 / 16384.0;
@@ -287,7 +295,7 @@
 }
 
 
-static void qdm2_init_vlc()
+static void qdm2_init_vlc(void)
 {
     init_vlc (&vlc_tab_level, 8, 24,
         vlc_tab_level_huffbits, 1, 1,



Diffs for file: libavcodec/resample2.c

===================================================================
RCS file: RCS/resample2.c,v
retrieving revision 1.1
diff -u -r1.1 resample2.c
--- resample2.c	2006/01/18 00:37:34	1.1
+++ resample2.c	2006/01/18 16:46:12
@@ -28,22 +28,9 @@
 #include "common.h"
 #include "dsputil.h"
 
-#if 1
-#define FILTER_SHIFT 15
-
-#define FELEM int16_t
-#define FELEM2 int32_t
-#define FELEM_MAX INT16_MAX
-#define FELEM_MIN INT16_MIN
-#else
-#define FILTER_SHIFT 22
-
-#define FELEM int32_t
-#define FELEM2 int64_t
-#define FELEM_MAX INT32_MAX
-#define FELEM_MIN INT32_MIN
-#endif
-
+/* FELEM and FILTER_SHIFT defines previously here
+ * have been moved to libavutil/common.h
+ */
 
 typedef struct AVResampleContext{
     FELEM *filter_bank;



Diffs for file: libavcodec/snow.c

===================================================================
RCS file: RCS/snow.c,v
retrieving revision 1.1
diff -u -r1.1 snow.c
--- snow.c	2006/01/18 01:01:24	1.1
+++ snow.c	2006/01/18 16:48:35
@@ -492,6 +492,13 @@
 #define slice_buffer_get_line(slice_buf, line_num) ((slice_buf)->line[line_num] ? (slice_buf)->line[line_num] : slice_buffer_load_line((slice_buf), (line_num)))
 //#define slice_buffer_get_line(slice_buf, line_num) (slice_buffer_load_line((slice_buf), (line_num)))
 
+
+/* prototypes */
+void ff_spatial_idwt_buffered_init(dwt_compose_t *, slice_buffer *, int, int, int, int, int);
+void ff_spatial_idwt_init(dwt_compose_t *, DWTELEM *, int, int, int, int, int);
+void ff_spatial_idwt_slice(dwt_compose_t *, DWTELEM *, int, int, int, int, int, int);
+void ff_spatial_idwt_buffered_slice(dwt_compose_t *, slice_buffer *, int, int, int, int, int, int);
+void ff_spatial_idwt(DWTELEM *, int, int, int, int, int);
 static void iterative_me(SnowContext *s);
 
 static void slice_buffer_init(slice_buffer * buf, int line_count, int max_allocated_lines, int line_width, DWTELEM * base_buffer)
@@ -3625,7 +3632,7 @@
     return 0;
 }
 
-static void init_qexp(){
+static void init_qexp(void){
     int i;
     double v=128;
 



Diffs for file: libavcodec/utils.c

===================================================================
RCS file: RCS/utils.c,v
retrieving revision 1.1
diff -u -r1.1 utils.c
--- utils.c	2006/01/18 00:26:30	1.1
+++ utils.c	2006/01/18 00:27:05
@@ -149,9 +149,9 @@
  * Call av_free_static automatically before it's too late
  */
 
-static void do_free() __attribute__ ((destructor));
+static void do_free(void) __attribute__ ((destructor));
 
-static void do_free()
+static void do_free(void)
 {
     av_free_static();
 }



Diffs for file: libavcodec/vc9.c

===================================================================
RCS file: RCS/vc9.c,v
retrieving revision 1.1
diff -u -r1.1 vc9.c
--- vc9.c	2006/01/18 01:08:49	1.1
+++ vc9.c	2006/01/18 17:11:15
@@ -330,6 +330,16 @@
 #endif
 } VC9Context;
 
+
+/* prototypes */
+int alloc_bitplane(BitPlane *, int , int);
+void free_bitplane(BitPlane *);
+int vc9_decode_block(VC9Context *, DCTELEM [64], int, int, int);
+int vc9_decode_i_mb(VC9Context *, DCTELEM [6][64]);
+int vc9_decode_p_mb(VC9Context *, DCTELEM [6][64]);
+int vc9_decode_b_mb(VC9Context *, DCTELEM [6][64]);
+
+
 /**
  * Get unary code of limited length
  * @fixme FIXME Slow and ugly



Diffs for file: libavcodec/vorbis.c

===================================================================
RCS file: RCS/vorbis.c,v
retrieving revision 1.1
diff -u -r1.1 vorbis.c
--- vorbis.c	2006/01/18 01:13:19	1.1
+++ vorbis.c	2006/01/18 17:11:36
@@ -41,6 +41,11 @@
 #undef NDEBUG
 #include <assert.h>
 
+
+/* prototypes */
+unsigned int get_bits_long_le(GetBitContext *, int);
+
+
 /* Helper functions */
 
 /**



Diffs for file: libavformat/avienc.c

===================================================================
RCS file: RCS/avienc.c,v
retrieving revision 1.1
diff -u -r1.1 avienc.c
--- avienc.c	2006/01/18 01:58:27	1.1
+++ avienc.c	2006/01/18 17:11:54
@@ -48,6 +48,11 @@
     AVIIndex indexes[MAX_STREAMS];
 } AVIContext;
 
+
+/* prototypes */
+void ff_parse_specific_params(AVCodecContext *, int *, int *, int *);
+
+
 static inline AVIIentry* avi_get_ientry(AVIIndex* idx, int ent_id)
 {
     int cl = ent_id / AVI_INDEX_CLUSTER_SIZE;



Diffs for file: libavformat/gif.c

===================================================================
RCS file: RCS/gif.c,v
retrieving revision 1.1
diff -u -r1.1 gif.c
--- gif.c	2006/01/18 01:59:48	1.1
+++ gif.c	2006/01/18 17:12:11
@@ -99,6 +99,12 @@
     { 0xff, 0xff, 0x00 }, { 0xff, 0xff, 0x33 }, { 0xff, 0xff, 0x66 }, { 0xff, 0xff, 0x99 }, { 0xff, 0xff, 0xcc }, { 0xff, 0xff, 0xff },
 };
 
+
+/* prototypes */
+static int gif_write_header(AVFormatContext *);
+int gif_write(ByteIOContext *, AVImageInfo *);
+
+
 /* The GIF format uses reversed order for bitstreams... */
 /* at least they don't use PDP_ENDIAN :) */
 /* so we 'extend' PutBitContext. hmmm, OOP :) */



Diffs for file: libavformat/movenc.c

===================================================================
RCS file: RCS/movenc.c,v
retrieving revision 1.1
diff -u -r1.1 movenc.c
--- movenc.c	2006/01/18 02:01:31	1.1
+++ movenc.c	2006/01/18 16:51:43
@@ -71,6 +71,10 @@
     MOVTrack tracks[MAX_STREAMS];
 } MOVContext;
 
+
+/* prototypes */
+int mov_write_mdat_tag(ByteIOContext *, MOVContext*);
+int mov_write_ftyp_tag(ByteIOContext *, AVFormatContext *);
 static int mov_write_esds_tag(ByteIOContext *pb, MOVTrack* track);
 
 /* output language code from iso639 language name */



Diffs for file: libavformat/mpegts.c

===================================================================
RCS file: RCS/mpegts.c,v
retrieving revision 1.1
diff -u -r1.1 mpegts.c
--- mpegts.c	2006/01/18 01:47:39	1.1
+++ mpegts.c	2006/01/18 16:52:34
@@ -114,6 +114,17 @@
     MpegTSFilter *pids[NB_PID_MAX];
 };
 
+
+/* prototypes */
+MpegTSFilter *mpegts_open_section_filter(MpegTSContext *, unsigned int, SectionCallback *, void *, int);
+MpegTSFilter *mpegts_open_pes_filter(MpegTSContext *, unsigned int, PESCallback *, void *);
+void mpegts_close_filter(MpegTSContext *, MpegTSFilter *);
+void mpegts_set_service(MpegTSContext *, int, SetServiceCallback *, void *);
+void mpegts_scan_sdt(MpegTSContext *);
+void mpegts_scan_pat(MpegTSContext *);
+void set_service_cb(void *, int);
+
+
 static void write_section_data(AVFormatContext *s, MpegTSFilter *tss1,
                                const uint8_t *buf, int buf_size, int is_start)
 {



Diffs for file: libavformat/mpegtsenc.c

===================================================================
RCS file: RCS/mpegtsenc.c,v
retrieving revision 1.1
diff -u -r1.1 mpegtsenc.c
--- mpegtsenc.c	2006/01/18 01:54:59	1.1
+++ mpegtsenc.c	2006/01/18 16:53:00
@@ -89,6 +89,12 @@
     void *opaque;
 } MpegTSSection;
 
+
+/* prototypes */
+void mpegts_write_section(MpegTSSection *, uint8_t *, int);
+int mpegts_write_section1(MpegTSSection *, int, int, int, int, int, uint8_t *, int);
+
+
 /* NOTE: 4 bytes must be left at the end for the crc32 */
 void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len)
 {



Diffs for file: libavutil/common.h

===================================================================
RCS file: RCS/common.h,v
retrieving revision 1.1
diff -u -r1.1 common.h
--- common.h	2006/01/18 00:22:47	1.1
+++ common.h	2006/01/18 16:44:53
@@ -602,4 +602,35 @@
 
 #endif /* HAVE_AV_CONFIG_H */
 
+
+/* moved from libavcodec/resample2.c
+ * needed here for av_build_filter() prototype below
+ */
+#if 1
+#define FILTER_SHIFT 15
+
+#define FELEM int16_t
+#define FELEM2 int32_t
+#define FELEM_MAX INT16_MAX
+#define FELEM_MIN INT16_MIN
+#else
+#define FILTER_SHIFT 22
+
+#define FELEM int32_t
+#define FELEM2 int64_t
+#define FELEM_MAX INT32_MAX
+#define FELEM_MIN INT32_MIN
+#endif
+
+
+/* prototypes */
+double av_int2dbl(int64_t);
+float av_int2flt(int32_t);
+int64_t av_dbl2int(double);
+int32_t av_flt2int(float);
+double bessel(double);
+void av_build_filter(FELEM *, double, int, int, int, int);
+void ff_spatial_dwt(int *, int, int, int, int, int);
+void parse_arg_file(const char *);
+
 #endif /* COMMON_H */



Diffs for file: vhook/drawtext.c

===================================================================
RCS file: RCS/drawtext.c,v
retrieving revision 1.1
diff -u -r1.1 drawtext.c
--- drawtext.c	2006/01/18 02:17:30	1.1
+++ drawtext.c	2006/01/18 16:53:37
@@ -109,6 +109,12 @@
 } ContextInfo;
 
 
+/* prototypes */
+int ParseColor(char *, unsigned char [3]);
+inline void draw_glyph(AVPicture *, FT_Bitmap *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned char[3], unsigned char [3], int);
+inline void draw_box(AVPicture *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned char [3]);
+
+
 void Release(void *ctx)
 {
     if (ctx)



Diffs for file: vhook/ppm.c

===================================================================
RCS file: RCS/ppm.c,v
retrieving revision 1.1
diff -u -r1.1 ppm.c
--- ppm.c	2006/01/18 02:13:05	1.1
+++ ppm.c	2006/01/18 16:54:04
@@ -37,6 +37,16 @@
 }
 rwpipe;
 
+
+/* prototypes */
+rwpipe *rwpipe_open( int, char *[] );
+FILE *rwpipe_reader( rwpipe * );
+FILE *rwpipe_writer( rwpipe * );
+int rwpipe_read_number( rwpipe * );
+int rwpipe_read_ppm_header( rwpipe *, int *, int * );
+void rwpipe_close( rwpipe * );
+
+
 /** Create a bidirectional pipe for the given command.
 */
 



Diffs for file: ./ffmpeg.c

===================================================================
RCS file: RCS/ffmpeg.c,v
retrieving revision 1.1
diff -u -r1.1 ffmpeg.c
--- ffmpeg.c	2006/01/18 02:03:57	1.1
+++ ffmpeg.c	2006/01/18 16:55:04
@@ -313,6 +313,13 @@
 /* init terminal so that we can grab keys */
 static struct termios oldtty;
 
+
+/* prototypes */
+void parse_matrix_coeffs(uint16_t *, const char *);
+void opt_inter_matrix(const char *);
+void opt_intra_matrix(const char *);
+
+
 static void term_exit(void)
 {
     tcsetattr (0, TCSANOW, &oldtty);



Diffs for file: ./output_example.c

===================================================================
RCS file: RCS/output_example.c,v
retrieving revision 1.1
diff -u -r1.1 output_example.c
--- output_example.c	2006/01/18 02:07:14	1.1
+++ output_example.c	2006/01/18 16:57:27
@@ -48,6 +48,21 @@
 int audio_outbuf_size;
 int audio_input_frame_size;
 
+
+/* prototypes */
+AVStream *add_audio_stream(AVFormatContext *, int);
+void open_audio(AVFormatContext *, AVStream *);
+void get_audio_frame(int16_t *, int, int);
+void write_audio_frame(AVFormatContext *, AVStream *);
+void close_audio(AVFormatContext *, AVStream *);
+AVStream *add_video_stream(AVFormatContext *, int);
+AVFrame *alloc_picture(int, int, int);
+void open_video(AVFormatContext *, AVStream *);
+void fill_yuv_image(AVFrame *, int, int, int);
+void write_video_frame(AVFormatContext *, AVStream *);
+void close_video(AVFormatContext *, AVStream *);
+
+
 /*
  * add an audio output stream
  */







More information about the ffmpeg-devel mailing list