From e96682e6f4c1fbddf468f9f051729332163c1db9 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 18 May 2004 17:09:46 +0000 Subject: [PATCH] some of the warning fixes by (Michael Roitzsch ) Originally committed as revision 3140 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/avcodec.h | 2 ++ libavcodec/cabac.c | 2 +- libavcodec/cabac.h | 6 +++--- libavcodec/dsputil.h | 5 +++++ libavcodec/faandct.c | 2 -- libavcodec/i386/dsputil_mmx.c | 2 +- libavcodec/i386/dsputil_mmx_avg.h | 4 ++-- libavcodec/i386/dsputil_mmx_rnd.h | 4 ++-- libavcodec/i386/fdct_mmx.c | 1 + libavcodec/i386/idct_mmx.c | 3 +++ libavcodec/i386/mpegvideo_mmx.c | 2 +- libavcodec/i386/simple_idct_mmx.c | 1 + libavcodec/libpostproc/postprocess.c | 7 ------- libavcodec/mpegvideo.c | 14 +++++++------- libavcodec/mpegvideo.h | 2 ++ libavcodec/parser.c | 2 +- libavcodec/ra288.c | 4 ++-- libavcodec/svq1.c | 2 ++ libavcodec/svq1_cb.h | 4 ++-- libavcodec/vp3data.h | 12 ++++++------ libavcodec/vp3dsp.c | 1 + libavcodec/wmv2.c | 3 ++- 22 files changed, 47 insertions(+), 38 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index f4605bec81..e56a5b280d 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2159,6 +2159,7 @@ extern void av_log_set_level(int); extern void av_log_set_callback(void (*)(void*, int, const char*, va_list)); /* endian macros */ +#if !defined(BE_16) || !defined(BE_32) || !defined(LE_16) || !defined(LE_32) #define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) #define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ (((uint8_t*)(x))[1] << 16) | \ @@ -2169,6 +2170,7 @@ extern void av_log_set_callback(void (*)(void*, int, const char*, va_list)); (((uint8_t*)(x))[2] << 16) | \ (((uint8_t*)(x))[1] << 8) | \ ((uint8_t*)(x))[0]) +#endif #ifdef __cplusplus } diff --git a/libavcodec/cabac.c b/libavcodec/cabac.c index 0e3e14f56e..2ae996a39d 100644 --- a/libavcodec/cabac.c +++ b/libavcodec/cabac.c @@ -90,7 +90,7 @@ void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size){ * * @param buf_size size of buf in bits */ -void ff_init_cabac_decoder(CABACContext *c, uint8_t *buf, int buf_size){ +void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size){ c->bytestream_start= c->bytestream= buf; diff --git a/libavcodec/cabac.h b/libavcodec/cabac.h index 852d47ebe8..05c47363d2 100644 --- a/libavcodec/cabac.h +++ b/libavcodec/cabac.h @@ -37,8 +37,8 @@ typedef struct CABACContext{ uint8_t lps_range[2*64][4]; ///< rangeTabLPS uint8_t lps_state[2*64]; ///< transIdxLPS uint8_t mps_state[2*64]; ///< transIdxMPS - uint8_t *bytestream_start; - uint8_t *bytestream; + const uint8_t *bytestream_start; + const uint8_t *bytestream; int bits_left; ///< PutBitContext pb; }CABACContext; @@ -48,7 +48,7 @@ extern const uint8_t ff_h264_mps_state[64]; extern const uint8_t ff_h264_lps_state[64]; void ff_init_cabac_encoder(CABACContext *c, uint8_t *buf, int buf_size); -void ff_init_cabac_decoder(CABACContext *c, uint8_t *buf, int buf_size); +void ff_init_cabac_decoder(CABACContext *c, const uint8_t *buf, int buf_size); void ff_init_cabac_states(CABACContext *c, uint8_t const (*lps_range)[4], uint8_t const *mps_state, uint8_t const *lps_state, int state_count); diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 3681541f5a..0d42fe1089 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -564,6 +564,11 @@ static inline long int lrintf(float x) return (int)(rint(x)); #endif } +#else +#ifndef _ISOC9X_SOURCE +#define _ISOC9X_SOURCE +#endif +#include #endif #endif diff --git a/libavcodec/faandct.c b/libavcodec/faandct.c index 2a91184953..0462cee612 100644 --- a/libavcodec/faandct.c +++ b/libavcodec/faandct.c @@ -26,8 +26,6 @@ * @author Michael Niedermayer */ -#include - #include "dsputil.h" #include "faandct.h" diff --git a/libavcodec/i386/dsputil_mmx.c b/libavcodec/i386/dsputil_mmx.c index c8db22e648..11504e2250 100644 --- a/libavcodec/i386/dsputil_mmx.c +++ b/libavcodec/i386/dsputil_mmx.c @@ -2132,10 +2132,10 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) #endif if (mm_flags & MM_MMX) { - const int dct_algo = avctx->dct_algo; const int idct_algo= avctx->idct_algo; #ifdef CONFIG_ENCODERS + const int dct_algo = avctx->dct_algo; if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){ if(mm_flags & MM_SSE2){ c->fdct = ff_fdct_sse2; diff --git a/libavcodec/i386/dsputil_mmx_avg.h b/libavcodec/i386/dsputil_mmx_avg.h index c8494f51a6..052aad75c0 100644 --- a/libavcodec/i386/dsputil_mmx_avg.h +++ b/libavcodec/i386/dsputil_mmx_avg.h @@ -53,7 +53,7 @@ static void DEF(put_pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line_ :"%eax", "memory"); } -static void DEF(put_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) +static __attribute__((unused)) void DEF(put_pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) { __asm __volatile( "1: \n\t" @@ -125,7 +125,7 @@ static void DEF(put_pixels16_x2)(uint8_t *block, const uint8_t *pixels, int line :"%eax", "memory"); } -static void DEF(put_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) +static __attribute__((unused)) void DEF(put_pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) { __asm __volatile( "1: \n\t" diff --git a/libavcodec/i386/dsputil_mmx_rnd.h b/libavcodec/i386/dsputil_mmx_rnd.h index 21f0bfd849..1b79aa56aa 100644 --- a/libavcodec/i386/dsputil_mmx_rnd.h +++ b/libavcodec/i386/dsputil_mmx_rnd.h @@ -359,7 +359,7 @@ static void DEF(avg, pixels8_x2)(uint8_t *block, const uint8_t *pixels, int line } while (--h); } -static void DEF(avg, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) +static __attribute__((unused)) void DEF(avg, pixels8_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) { MOVQ_BFE(mm6); JUMPALIGN(); @@ -406,7 +406,7 @@ static void DEF(avg, pixels16_x2)(uint8_t *block, const uint8_t *pixels, int lin } while (--h); } -static void DEF(avg, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) +static __attribute__((unused)) void DEF(avg, pixels16_l2)(uint8_t *dst, uint8_t *src1, uint8_t *src2, int dstStride, int src1Stride, int h) { MOVQ_BFE(mm6); JUMPALIGN(); diff --git a/libavcodec/i386/fdct_mmx.c b/libavcodec/i386/fdct_mmx.c index 68f788a23b..7f348329a2 100644 --- a/libavcodec/i386/fdct_mmx.c +++ b/libavcodec/i386/fdct_mmx.c @@ -14,6 +14,7 @@ * Skal's fdct at http://skal.planet-d.net/coding/dct.html */ #include "../common.h" +#include "../dsputil.h" #include "mmx.h" #define ATTR_ALIGN(align) __attribute__ ((__aligned__ (align))) diff --git a/libavcodec/i386/idct_mmx.c b/libavcodec/i386/idct_mmx.c index 298c8a8b03..c356afe12c 100644 --- a/libavcodec/i386/idct_mmx.c +++ b/libavcodec/i386/idct_mmx.c @@ -23,6 +23,7 @@ */ #include "../common.h" +#include "../dsputil.h" #include "mmx.h" @@ -588,6 +589,8 @@ void idct (int16_t * block) \ idct_col (block, 4); \ } +void ff_mmx_idct(DCTELEM *block); +void ff_mmxext_idct(DCTELEM *block); declare_idct (ff_mmxext_idct, mmxext_table, mmxext_row_head, mmxext_row, mmxext_row_tail, mmxext_row_mid) diff --git a/libavcodec/i386/mpegvideo_mmx.c b/libavcodec/i386/mpegvideo_mmx.c index 1c0e9f5ae3..f19de73d61 100644 --- a/libavcodec/i386/mpegvideo_mmx.c +++ b/libavcodec/i386/mpegvideo_mmx.c @@ -109,7 +109,7 @@ asm volatile( static void dct_unquantize_h263_inter_mmx(MpegEncContext *s, DCTELEM *block, int n, int qscale) { - int level, qmul, qadd, nCoeffs; + int qmul, qadd, nCoeffs; qmul = qscale << 1; qadd = (qscale - 1) | 1; diff --git a/libavcodec/i386/simple_idct_mmx.c b/libavcodec/i386/simple_idct_mmx.c index b005f9d822..92a366f217 100644 --- a/libavcodec/i386/simple_idct_mmx.c +++ b/libavcodec/i386/simple_idct_mmx.c @@ -18,6 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../dsputil.h" +#include "../simple_idct.h" /* 23170.475006 diff --git a/libavcodec/libpostproc/postprocess.c b/libavcodec/libpostproc/postprocess.c index 9ac18eaf2f..d4f6138f84 100644 --- a/libavcodec/libpostproc/postprocess.c +++ b/libavcodec/libpostproc/postprocess.c @@ -158,13 +158,6 @@ static char *replaceTable[]= NULL //End Marker }; -#ifdef ARCH_X86 -static inline void unusedVariableWarningFixer() -{ - if(w05 + w20 + b00 + b01 + b02 + b08 + b80 == 0) b00=0; -} -#endif - #ifdef ARCH_X86 static inline void prefetchnta(void *p) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 74af8999a7..246d480e56 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -25,12 +25,11 @@ * The simplest mpeg encoder (well, it was the simplest!). */ -#include -#include //for PI #include "avcodec.h" #include "dsputil.h" #include "mpegvideo.h" #include "faandct.h" +#include #ifdef USE_FASTMEMCPY #include "fastmemcpy.h" @@ -567,7 +566,7 @@ void MPV_decode_defaults(MpegEncContext *s){ */ #ifdef CONFIG_ENCODERS -void MPV_encode_defaults(MpegEncContext *s){ +static void MPV_encode_defaults(MpegEncContext *s){ static int done=0; MPV_common_defaults(s); @@ -1708,7 +1707,7 @@ void ff_print_debug_info(MpegEncContext *s, AVFrame *pict){ if((s->avctx->debug_mv) && pict->motion_val){ int type; for(type=0; type<3; type++){ - int direction; + int direction = 0; switch (type) { case 0: if ((!(s->avctx->debug_mv&FF_DEBUG_VIS_MV_P_FOR)) || (pict->pict_type!=FF_P_TYPE)) continue; @@ -4589,7 +4588,7 @@ static void merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src) static void encode_picture(MpegEncContext *s, int picture_number) { - int i, j; + int i; int bits; s->picture_number = picture_number; @@ -4671,6 +4670,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) ff_fix_long_p_mvs(s); ff_fix_long_mvs(s, NULL, 0, s->p_mv_table, s->f_code, CANDIDATE_MB_TYPE_INTER, 0); if(s->flags & CODEC_FLAG_INTERLACED_ME){ + int j; for(i=0; i<2; i++){ for(j=0; j<2; j++) ff_fix_long_mvs(s, s->p_field_select_table[i], j, @@ -4695,7 +4695,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) ff_fix_long_mvs(s, NULL, 0, s->b_bidir_forw_mv_table, s->f_code, CANDIDATE_MB_TYPE_BIDIR, 1); ff_fix_long_mvs(s, NULL, 0, s->b_bidir_back_mv_table, s->b_code, CANDIDATE_MB_TYPE_BIDIR, 1); if(s->flags & CODEC_FLAG_INTERLACED_ME){ - int dir; + int dir, j; for(dir=0; dir<2; dir++){ for(i=0; i<2; i++){ for(j=0; j<2; j++){ @@ -5260,7 +5260,7 @@ STOP_TIMER("init rem[]") int best_score=s->dsp.try_8x8basis(rem, weight, basis[0], 0); int best_coeff=0; int best_change=0; - int run2, best_unquant_change, analyze_gradient; + int run2, best_unquant_change=0, analyze_gradient; #ifdef REFINE_STATS {START_TIMER #endif diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 0bdf0a305c..bdd05403b6 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -813,6 +813,7 @@ void mpeg1_encode_mb(MpegEncContext *s, void ff_mpeg1_encode_init(MpegEncContext *s); void ff_mpeg1_encode_slice_header(MpegEncContext *s); void ff_mpeg1_clean_buffers(MpegEncContext *s); +int ff_mpeg1_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size); /** RLTable. */ @@ -852,6 +853,7 @@ extern const uint8_t ff_h263_chroma_qscale_table[32]; extern const uint8_t ff_h263_loop_filter_strength[32]; +/* h263.c, h263dec.c */ int ff_h263_decode_init(AVCodecContext *avctx); int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *data_size, diff --git a/libavcodec/parser.c b/libavcodec/parser.c index 88894884cb..b7d6de31b9 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -426,7 +426,7 @@ static int av_mpeg4_decode_header(AVCodecParserContext *s1, return ret; } -int mpeg4video_parse_init(AVCodecParserContext *s) +static int mpeg4video_parse_init(AVCodecParserContext *s) { ParseContext1 *pc = s->priv_data; diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c index a44eb96f14..09ecc7aacb 100644 --- a/libavcodec/ra288.c +++ b/libavcodec/ra288.c @@ -206,7 +206,7 @@ static void prodsum(float *tgt, float *src, int len, int n) } } -void * decode_block(AVCodecContext * avctx, unsigned char *in, signed short int *out,unsigned len) +static void * decode_block(AVCodecContext * avctx, unsigned char *in, signed short int *out,unsigned len) { int x,y; Real288_internal *glob=avctx->priv_data; @@ -255,7 +255,7 @@ static int ra288_decode_frame(AVCodecContext * avctx, data=decode_block(avctx,&buf[j*cfs+cfs*i*h/2],(signed short *)data,cfs); bret += cfs; } - *data_size = data - datao; + *data_size = (char *)data - (char *)datao; return bret; } else diff --git a/libavcodec/svq1.c b/libavcodec/svq1.c index 097c453299..b4f8e03b0b 100644 --- a/libavcodec/svq1.c +++ b/libavcodec/svq1.c @@ -600,6 +600,7 @@ static uint16_t svq1_packet_checksum (uint8_t *data, int length, int value) { return value; } +#if 0 static uint16_t svq1_component_checksum (uint16_t *pixels, int pitch, int width, int height, int value) { int x, y; @@ -614,6 +615,7 @@ static uint16_t svq1_component_checksum (uint16_t *pixels, int pitch, return value; } +#endif static void svq1_parse_string (GetBitContext *bitbuf, uint8_t *out) { uint8_t seed; diff --git a/libavcodec/svq1_cb.h b/libavcodec/svq1_cb.h index 0f766aa882..c6735fe8ea 100644 --- a/libavcodec/svq1_cb.h +++ b/libavcodec/svq1_cb.h @@ -769,7 +769,7 @@ static const int8_t* const svq1_inter_codebooks[4] = { svq1_inter_codebook_8x4, svq1_inter_codebook_8x8 }; -static const int8_t const svq1_inter_codebook_sum[4][16*6] = { +static const int8_t svq1_inter_codebook_sum[4][16*6] = { { -1, 1, -2, 0, 1, -1, -1, -1, -2, -1, 1, -1, -1, 0, -1, -1, 0, -1, -1, -1, -1, 0, -1, 0, 0, 0, -3, 1, -1, 0, 1, -1, @@ -1543,7 +1543,7 @@ static const int8_t* const svq1_intra_codebooks[4] = { svq1_intra_codebook_8x4, svq1_intra_codebook_8x8 }; -static const int8_t const svq1_intra_codebook_sum[4][16*6] = { +static const int8_t svq1_intra_codebook_sum[4][16*6] = { { 0, 0, 0, -1, -1, -1, -1, -2, 0, -1, -1, 0, -1, 0, 1, 0, 1, 0, -1, 1, 0, 0, -1, 1, -1, 0, 0, 0, -1, 1, 0, 0, diff --git a/libavcodec/vp3data.h b/libavcodec/vp3data.h index a25c9f06ef..1dd511fa0f 100644 --- a/libavcodec/vp3data.h +++ b/libavcodec/vp3data.h @@ -3,7 +3,7 @@ /* these coefficients dequantize intraframe Y plane coefficients * (note: same as JPEG) */ -static int16_t vp31_intra_y_dequant[64] = +static const int16_t vp31_intra_y_dequant[64] = { 16, 11, 10, 16, 24, 40, 51, 61, 12, 12, 14, 19, 26, 58, 60, 55, 14, 13, 16, 24, 40, 57, 69, 56, @@ -16,7 +16,7 @@ static int16_t vp31_intra_y_dequant[64] = /* these coefficients dequantize intraframe C plane coefficients * (note: same as JPEG) */ -static int16_t vp31_intra_c_dequant[64] = +static const int16_t vp31_intra_c_dequant[64] = { 17, 18, 24, 47, 99, 99, 99, 99, 18, 21, 26, 66, 99, 99, 99, 99, 24, 26, 56, 99, 99, 99, 99, 99, @@ -28,7 +28,7 @@ static int16_t vp31_intra_c_dequant[64] = }; /* these coefficients dequantize interframe coefficients (all planes) */ -static int16_t vp31_inter_dequant[64] = +static const int16_t vp31_inter_dequant[64] = { 16, 16, 16, 20, 24, 28, 32, 40, 16, 16, 20, 24, 28, 32, 40, 48, 16, 20, 24, 28, 32, 40, 48, 64, @@ -39,7 +39,7 @@ static int16_t vp31_inter_dequant[64] = 40, 48, 64, 64, 64, 96, 128, 128 }; -static int16_t vp31_dc_scale_factor[64] = +static const int16_t vp31_dc_scale_factor[64] = { 220, 200, 190, 180, 170, 170, 160, 160, 150, 150, 140, 140, 130, 130, 120, 120, 110, 110, 100, 100, 90, 90, 90, 80, @@ -50,7 +50,7 @@ static int16_t vp31_dc_scale_factor[64] = 20, 10, 10, 10, 10, 10, 10, 10 }; -static uint32_t vp31_ac_scale_factor[64] = +static const uint32_t vp31_ac_scale_factor[64] = { 500, 450, 400, 370, 340, 310, 285, 265, 245, 225, 210, 195, 185, 180, 170, 160, 150, 145, 135, 130, 125, 115, 110, 107, @@ -74,7 +74,7 @@ static const int dezigzag_index[64] = }; /* inverse of dezigzag index */ -static int zigzag_index[64]; +static __attribute__((unused)) int zigzag_index[64]; static const uint16_t dc_bias[16][32][2] = { { /* DC bias table 0 */ diff --git a/libavcodec/vp3dsp.c b/libavcodec/vp3dsp.c index 3ead732803..9c9530d05b 100644 --- a/libavcodec/vp3dsp.c +++ b/libavcodec/vp3dsp.c @@ -24,6 +24,7 @@ #include "common.h" #include "avcodec.h" +#include "dsputil.h" #include "vp3data.h" #define IdctAdjustBeforeShift 8 diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c index 376f0706e1..a5ba1dd2da 100644 --- a/libavcodec/wmv2.c +++ b/libavcodec/wmv2.c @@ -59,6 +59,8 @@ static void wmv2_common_init(Wmv2Context * w){ ff_init_scantable(s->dsp.idct_permutation, &w->abt_scantable[1], wmv2_scantableB); } +#ifdef CONFIG_ENCODERS + static int encode_ext_header(Wmv2Context *w){ MpegEncContext * const s= &w->s; PutBitContext pb; @@ -84,7 +86,6 @@ static int encode_ext_header(Wmv2Context *w){ return 0; } -#ifdef CONFIG_ENCODERS static int wmv2_encode_init(AVCodecContext *avctx){ Wmv2Context * const w= avctx->priv_data;