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

Dieter freebsd
Thu Jan 26 23:58:30 CET 2006


Prototypes either moved to .h file or changed to static.



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/26 21:41:09	1.1
+++ crc.c	2006/01/26 21:43:42
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <inttypes.h>
+#include "common.h"
 
 static const uint16_t crc_lut[256] =
 {



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/26 21:20:29	1.1
+++ alac.c	2006/01/26 21:21:18
@@ -84,7 +84,7 @@
     alac->outputsamples_buffer_b = av_malloc(alac->setinfo_max_samples_per_frame * 4);
 }
 
-void alac_set_info(ALACContext *alac)
+static void alac_set_info(ALACContext *alac)
 {
     unsigned char *ptr = alac->avctx->extradata;
 
@@ -125,7 +125,7 @@
     return i;
 }
 
-void bastardized_rice_decompress(ALACContext *alac,
+static void bastardized_rice_decompress(ALACContext *alac,
                                  int32_t *output_buffer,
                                  int output_size,
                                  int readsamplesize, /* arg_10 */



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/26 21:24:20	1.1
+++ flicvideo.c	2006/01/26 21:24:39
@@ -415,7 +415,7 @@
     return buf_size;
 }
 
-int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
+static int flic_decode_frame_15_16BPP(AVCodecContext *avctx,
                                       void *data, int *data_size,
                                       uint8_t *buf, int buf_size)
 {



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/26 21:26:09	1.1
+++ h261.c	2006/01/26 21:26:25
@@ -762,7 +762,7 @@
  * decodes the H261 picture header.
  * @return <0 if no startcode found
  */
-int h261_decode_picture_header(H261Context *h){
+static int h261_decode_picture_header(H261Context *h){
     MpegEncContext * const s = &h->s;
     int format, i;
     uint32_t startcode= 0;



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/26 21:27:25	1.1
+++ h264.c	2006/01/26 21:27:43
@@ -5741,7 +5741,7 @@
     return 0;
 }
 
-void inline compute_mb_neighboors(H264Context *h)
+static void inline compute_mb_neighboors(H264Context *h)
 {
     MpegEncContext * const s = &h->s;
     const int mb_xy  = s->mb_x + s->mb_y*s->mb_stride;



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/26 20:57:04	1.1
+++ mem.c	2006/01/26 20:57:57
@@ -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/26 20:59:38	1.1
+++ qdm2.c	2006/01/26 21:29:25
@@ -230,7 +230,7 @@
 static MPA_INT mpa_window[512] __attribute__((aligned(16)));
 
 
-static void softclip_table_init() {
+static void softclip_table_init(void) {
     int i;
     double dfl = SOFTCLIP_THRESHOLD - 32767;
     float delta = 1.0 / -dfl;
@@ -240,7 +240,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 +276,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 +287,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,
@@ -525,7 +525,7 @@
  * @param channels         number of channels
  * @param coding_method    q->coding_method[0][0][0]
  */
- void fix_coding_method_array (int sb, int channels, sb_int8_array coding_method)
+static void fix_coding_method_array (int sb, int channels, sb_int8_array coding_method)
 {
     int j,k;
     int ch;
@@ -1690,7 +1690,7 @@
  *
  * @param q    context
  */
-void qdm2_init(QDM2Context *q) {
+static void qdm2_init(QDM2Context *q) {
     static int inited = 0;
 
     if (inited != 0)
@@ -1942,7 +1942,7 @@
 }
 
 
-void qdm2_decode (QDM2Context *q, uint8_t *in, int16_t *out)
+static void qdm2_decode (QDM2Context *q, uint8_t *in, int16_t *out)
 {
     int ch, i;
     const int frame_size = (q->frame_size * q->channels);



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/26 21:02:11	1.1
+++ resample2.c	2006/01/26 21:02:50
@@ -28,22 +28,6 @@
 #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
-
 
 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/26 21:03:39	1.1
+++ snow.c	2006/01/26 21:32:47
@@ -1576,7 +1576,7 @@
         spatial_compose97i_dy(&cs, buffer, width, height, stride);
 }
 
-void ff_spatial_idwt_buffered_init(dwt_compose_t *cs, slice_buffer * sb, int width, int height, int stride_line, int type, int decomposition_count){
+static void ff_spatial_idwt_buffered_init(dwt_compose_t *cs, slice_buffer * sb, int width, int height, int stride_line, int type, int decomposition_count){
     int level;
     for(level=decomposition_count-1; level>=0; level--){
         switch(type){
@@ -1589,7 +1589,7 @@
     }
 }
 
-void ff_spatial_idwt_init(dwt_compose_t *cs, DWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count){
+static void ff_spatial_idwt_init(dwt_compose_t *cs, DWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count){
     int level;
     for(level=decomposition_count-1; level>=0; level--){
         switch(type){
@@ -1601,7 +1601,7 @@
     }
 }
 
-void ff_spatial_idwt_slice(dwt_compose_t *cs, DWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count, int y){
+static void ff_spatial_idwt_slice(dwt_compose_t *cs, DWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count, int y){
     const int support = type==1 ? 3 : 5;
     int level;
     if(type==2) return;
@@ -1619,7 +1619,7 @@
     }
 }
 
-void ff_spatial_idwt_buffered_slice(dwt_compose_t *cs, slice_buffer * slice_buf, int width, int height, int stride_line, int type, int decomposition_count, int y){
+static void ff_spatial_idwt_buffered_slice(dwt_compose_t *cs, slice_buffer * slice_buf, int width, int height, int stride_line, int type, int decomposition_count, int y){
     const int support = type==1 ? 3 : 5;
     int level;
     if(type==2) return;
@@ -1637,7 +1637,7 @@
     }
 }
 
-void ff_spatial_idwt(DWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count){
+static void ff_spatial_idwt(DWTELEM *buffer, int width, int height, int stride, int type, int decomposition_count){
     if(type==2){
         int level;
         for(level=decomposition_count-1; level>=0; level--)
@@ -3776,7 +3776,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/26 21:04:22	1.1
+++ utils.c	2006/01/26 21:04:46
@@ -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/26 21:34:40	1.1
+++ vc9.c	2006/01/26 23:13:08
@@ -929,7 +929,7 @@
  * @todo TODO: Take into account stride
  * @todo TODO: Allow use of external buffers ?
  */
-int alloc_bitplane(BitPlane *bp, int width, int height)
+static int alloc_bitplane(BitPlane *bp, int width, int height)
 {
     if (!bp || bp->width<0 || bp->height<0) return -1;
     bp->data = (uint8_t*)av_malloc(width*height);
@@ -942,7 +942,7 @@
 /** Free the bitplane's buffer
  * @param bp Bitplane which buffer is to free
  */
-void free_bitplane(BitPlane *bp)
+static void free_bitplane(BitPlane *bp)
 {
     bp->width = bp->stride = bp->height = 0;
     if (bp->data) av_freep(&bp->data);
@@ -1832,7 +1832,7 @@
  * @todo TODO: Process the blocks
  * @todo TODO: Use M$ MPEG-4 cbp prediction
  */
-int vc9_decode_block(VC9Context *v, DCTELEM block[64], int n, int coded, int mquant)
+static int vc9_decode_block(VC9Context *v, DCTELEM block[64], int n, int coded, int mquant)
 {
     GetBitContext *gb = &v->s.gb;
     MpegEncContext *s = &v->s;
@@ -1979,7 +1979,7 @@
 /** Decode one I-frame MB (in Simple/Main profile)
  * @todo TODO: Extend to AP
  */
-int vc9_decode_i_mb(VC9Context *v, DCTELEM block[6][64])
+static int vc9_decode_i_mb(VC9Context *v, DCTELEM block[6][64])
 {
     int i, cbp, val;
     uint8_t *coded_val;
@@ -2013,7 +2013,7 @@
  * @todo TODO: Extend to AP
  * @fixme FIXME: DC value for inter blocks not set
  */
-int vc9_decode_p_mb(VC9Context *v, DCTELEM block[6][64])
+static int vc9_decode_p_mb(VC9Context *v, DCTELEM block[6][64])
 {
     MpegEncContext *s = &v->s;
     GetBitContext *gb = &s->gb;
@@ -2160,7 +2160,7 @@
  * @warning XXX: Used for decoding BI MBs
  * @fixme FIXME: DC value for inter blocks not set
  */
-int vc9_decode_b_mb(VC9Context *v, DCTELEM block[6][64])
+static int vc9_decode_b_mb(VC9Context *v, DCTELEM block[6][64])
 {
     MpegEncContext *s = &v->s;
     GetBitContext *gb = &v->s.gb;



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/26 21:40:00	1.1
+++ vorbis.c	2006/01/26 21:40:12
@@ -46,7 +46,7 @@
 /**
  *  reads 0-32 bits when using the ALT_BITSTREAM_READER_LE bitstream reader
  */
-unsigned int get_bits_long_le(GetBitContext *s, int n){
+static unsigned int get_bits_long_le(GetBitContext *s, int n){
     if(n<=17) return get_bits(s, n);
     else{
         int ret= get_bits(s, 16);



Diffs for file: libavformat/avformat.h

===================================================================
RCS file: RCS/avformat.h,v
retrieving revision 1.1
diff -u -r1.1 avformat.h
--- avformat.h	2006/01/26 22:44:56	1.1
+++ avformat.h	2006/01/26 22:45:46
@@ -713,5 +713,7 @@
 }
 #endif
 
+int gif_write(ByteIOContext *, AVImageInfo *);
+
 #endif /* AVFORMAT_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/26 22:16:09	1.1
+++ drawtext.c	2006/01/26 22:16:35
@@ -300,7 +300,7 @@
 
 
 
-inline void draw_glyph(AVPicture *picture, FT_Bitmap *bitmap, unsigned int x, unsigned int y, unsigned int width, unsigned int height, unsigned char yuv_fgcolor[3], unsigned char yuv_bgcolor[3], int outline)
+static inline void draw_glyph(AVPicture *picture, FT_Bitmap *bitmap, unsigned int x, unsigned int y, unsigned int width, unsigned int height, unsigned char yuv_fgcolor[3], unsigned char yuv_bgcolor[3], int outline)
 {
   int r, c;
   int spixel, dpixel[3], in_glyph=0;
@@ -363,7 +363,7 @@
 }
 
 
-inline void draw_box(AVPicture *picture, unsigned int x, unsigned int y, unsigned int width, unsigned int height, unsigned char yuv_color[3])
+static inline void draw_box(AVPicture *picture, unsigned int x, unsigned int y, unsigned int width, unsigned int height, unsigned char yuv_color[3])
 {
   int i, j;
 



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/26 22:14:17	1.1
+++ ppm.c	2006/01/26 22:15:26
@@ -40,7 +40,7 @@
 /** Create a bidirectional pipe for the given command.
 */
 
-rwpipe *rwpipe_open( int argc, char *argv[] )
+static rwpipe *rwpipe_open( int argc, char *argv[] )
 {
     rwpipe *this = av_mallocz( sizeof( rwpipe ) );
 
@@ -94,7 +94,7 @@
 /** Read data from the pipe.
 */
 
-FILE *rwpipe_reader( rwpipe *this )
+static FILE *rwpipe_reader( rwpipe *this )
 {
     if ( this != NULL )
         return this->reader;
@@ -105,7 +105,7 @@
 /** Write data to the pipe.
 */
 
-FILE *rwpipe_writer( rwpipe *this )
+static FILE *rwpipe_writer( rwpipe *this )
 {
     if ( this != NULL )
         return this->writer;
@@ -116,7 +116,7 @@
 /* Read a number from the pipe - assumes PNM style headers.
 */
 
-int rwpipe_read_number( rwpipe *rw )
+static int rwpipe_read_number( rwpipe *rw )
 {
     int value = 0;
     int c = 0;
@@ -147,7 +147,7 @@
 /** Read a PPM P6 header.
 */
 
-int rwpipe_read_ppm_header( rwpipe *rw, int *width, int *height )
+static int rwpipe_read_ppm_header( rwpipe *rw, int *width, int *height )
 {
     char line[ 3 ];
     FILE *in = rwpipe_reader( rw );
@@ -167,7 +167,7 @@
 /** Close the pipe and process.
 */
 
-void rwpipe_close( rwpipe *this )
+static void rwpipe_close( rwpipe *this )
 {
     if ( this != NULL )
     {



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/26 20:50:28	1.1
+++ common.h	2006/01/26 22:51:23
@@ -610,4 +610,52 @@
 
 #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 *);
+uint16_t a52_crc16_block(uint8_t *, uint32_t);
+void ff_h264_idct_add_mmx2(uint8_t *, int16_t *, int);
+void ff_idct_xvid_mmx(short *);
+void ff_idct_xvid_mmx2(short *);
+void ff_vp3_dsp_init_mmx(void);
+void ff_vp3_idct_mmx(int16_t *);
+void ff_vp3_idct_sse2(int16_t *);
+uint16_t a52_crc16_block(uint8_t *, uint32_t);
+void* a52_resample_init(uint32_t, int, int);
+void deinterlace_16(int32_t *, int32_t *, int16_t *, int, int, uint8_t, uint8_t);
+uint16_t getbe16(const uint8_t *);
+int get_nibble(const uint8_t *, int);
+void set_service_cb(void *, int);
+int ParseColor(char *, unsigned char [3]);
+void parse_matrix_coeffs(uint16_t *, const char *);
+void opt_inter_matrix(const char *);
+void opt_intra_matrix(const char *);
+void get_audio_frame(int16_t *, int, int);
+
 #endif /* COMMON_H */



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/26 22:11:23	1.1
+++ output_example.c	2006/01/26 22:13:15
@@ -51,7 +51,7 @@
 /*
  * add an audio output stream
  */
-AVStream *add_audio_stream(AVFormatContext *oc, int codec_id)
+static AVStream *add_audio_stream(AVFormatContext *oc, int codec_id)
 {
     AVCodecContext *c;
     AVStream *st;
@@ -73,7 +73,7 @@
     return st;
 }
 
-void open_audio(AVFormatContext *oc, AVStream *st)
+static void open_audio(AVFormatContext *oc, AVStream *st)
 {
     AVCodecContext *c;
     AVCodec *codec;
@@ -139,7 +139,7 @@
     }
 }
 
-void write_audio_frame(AVFormatContext *oc, AVStream *st)
+static void write_audio_frame(AVFormatContext *oc, AVStream *st)
 {
     AVCodecContext *c;
     AVPacket pkt;
@@ -163,7 +163,7 @@
     }
 }
 
-void close_audio(AVFormatContext *oc, AVStream *st)
+static void close_audio(AVFormatContext *oc, AVStream *st)
 {
     avcodec_close(st->codec);
 
@@ -179,7 +179,7 @@
 int frame_count, video_outbuf_size;
 
 /* add a video output stream */
-AVStream *add_video_stream(AVFormatContext *oc, int codec_id)
+static AVStream *add_video_stream(AVFormatContext *oc, int codec_id)
 {
     AVCodecContext *c;
     AVStream *st;
@@ -224,7 +224,7 @@
     return st;
 }
 
-AVFrame *alloc_picture(int pix_fmt, int width, int height)
+static AVFrame *alloc_picture(int pix_fmt, int width, int height)
 {
     AVFrame *picture;
     uint8_t *picture_buf;
@@ -244,7 +244,7 @@
     return picture;
 }
 
-void open_video(AVFormatContext *oc, AVStream *st)
+static void open_video(AVFormatContext *oc, AVStream *st)
 {
     AVCodec *codec;
     AVCodecContext *c;
@@ -293,7 +293,7 @@
 }
 
 /* prepare a dummy image */
-void fill_yuv_image(AVFrame *pict, int frame_index, int width, int height)
+static void fill_yuv_image(AVFrame *pict, int frame_index, int width, int height)
 {
     int x, y, i;
 
@@ -315,7 +315,7 @@
     }
 }
 
-void write_video_frame(AVFormatContext *oc, AVStream *st)
+static void write_video_frame(AVFormatContext *oc, AVStream *st)
 {
     int out_size, ret;
     AVCodecContext *c;
@@ -380,7 +380,7 @@
     frame_count++;
 }
 
-void close_video(AVFormatContext *oc, AVStream *st)
+static void close_video(AVFormatContext *oc, AVStream *st)
 {
     avcodec_close(st->codec);
     av_free(picture->data[0]);







More information about the ffmpeg-devel mailing list