From fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 3 Jul 2016 10:09:36 +0200 Subject: [PATCH] Mark some arrays that never change as const. --- configure | 2 +- libavcodec/aaccoder.c | 4 ++-- libavcodec/aacenc.c | 4 ++-- libavcodec/aacenc.h | 4 ++-- libavcodec/aic.c | 2 +- libavcodec/amrnbdata.h | 4 ++-- libavcodec/amrwbdata.h | 4 ++-- libavcodec/atrac3plus.c | 38 ++++++++++++++++----------------- libavcodec/dfa.c | 2 +- libavcodec/g722dec.c | 6 +++--- libavcodec/h263data.c | 4 ++-- libavcodec/h263data.h | 4 ++-- libavcodec/indeo3.c | 4 ++-- libavcodec/indeo4data.h | 2 +- libavcodec/mpeg4videodec.c | 2 +- libavcodec/on2avc.c | 4 ++-- libavcodec/on2avcdata.c | 20 ++++++++--------- libavcodec/on2avcdata.h | 20 ++++++++--------- libavcodec/opus_silk.c | 6 +++--- libavcodec/qsvdec_h2645.c | 4 ++-- libavcodec/qsvenc_hevc.c | 4 ++-- libavcodec/sipr.c | 2 +- libavcodec/sipr16k.c | 2 +- libavcodec/sipr16kdata.h | 2 +- libavcodec/siprdata.h | 2 +- libavcodec/tscc2data.h | 6 +++--- libavcodec/vaapi_encode.c | 2 +- libavcodec/vaapi_encode_mjpeg.c | 2 +- libavcodec/vp8.c | 8 +++---- libavcodec/vp9block.c | 4 ++-- libavcodec/vp9data.c | 4 ++-- libavcodec/vp9data.h | 4 ++-- libavcodec/x86/fdct.c | 4 ++-- libavcodec/x86/mlpdsp.c | 16 +++++++------- libavcodec/x86/videodsp_init.c | 12 +++++------ libavfilter/af_volume.c | 2 +- libavfilter/vf_drawtext.c | 2 +- libavfilter/vf_libopencv.c | 4 ++-- libavfilter/vf_overlay.c | 2 +- libavformat/hls.c | 4 ++-- libavformat/id3v2.c | 2 +- libavformat/id3v2.h | 2 +- libavformat/mov_chan.c | 2 +- libavformat/movenc.c | 2 +- libavformat/mxfdec.c | 2 +- libavresample/audio_mix.c | 2 +- libavutil/hwcontext.c | 2 +- libavutil/hwcontext_vaapi.c | 2 +- libavutil/parseutils.c | 2 +- libavutil/pixdesc.c | 10 ++++----- libavutil/stereo3d.c | 2 +- 51 files changed, 129 insertions(+), 129 deletions(-) diff --git a/configure b/configure index a2223022cb..64c077465d 100755 --- a/configure +++ b/configure @@ -5414,7 +5414,7 @@ print_enabled_components(){ struct_name=$2 name=$3 shift 3 - echo "static const $struct_name *$name[] = {" > $TMPH + echo "static const $struct_name * const $name[] = {" > $TMPH for c in $*; do enabled $c && printf " &ff_%s,\n" $c >> $TMPH done diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index ee89148ef4..a654844cd0 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -53,7 +53,7 @@ static const uint8_t run_value_bits_short[16] = { 3, 3, 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 9 }; -static const uint8_t *run_value_bits[2] = { +static const uint8_t * const run_value_bits[2] = { run_value_bits_long, run_value_bits_short }; @@ -1112,7 +1112,7 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe, } } -AACCoefficientsEncoder ff_aac_coders[] = { +const AACCoefficientsEncoder ff_aac_coders[] = { { search_for_quantizers_faac, encode_window_bands_info, diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index c247c5b390..9b0e99b28d 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -98,7 +98,7 @@ static const uint8_t swb_size_1024_8[] = { 32, 36, 36, 40, 44, 48, 52, 56, 60, 64, 80 }; -static const uint8_t *swb_size_1024[] = { +static const uint8_t * const swb_size_1024[] = { swb_size_1024_96, swb_size_1024_96, swb_size_1024_64, swb_size_1024_48, swb_size_1024_48, swb_size_1024_32, swb_size_1024_24, swb_size_1024_24, swb_size_1024_16, @@ -125,7 +125,7 @@ static const uint8_t swb_size_128_8[] = { 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 12, 16, 20, 20 }; -static const uint8_t *swb_size_128[] = { +static const uint8_t * const swb_size_128[] = { /* the last entry on the following row is swb_size_128_64 but is a duplicate of swb_size_128_96 */ swb_size_128_96, swb_size_128_96, swb_size_128_96, diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h index dec445ce34..f77b2002e4 100644 --- a/libavcodec/aacenc.h +++ b/libavcodec/aacenc.h @@ -46,7 +46,7 @@ typedef struct AACCoefficientsEncoder { void (*search_for_ms)(struct AACEncContext *s, ChannelElement *cpe, const float lambda); } AACCoefficientsEncoder; -extern AACCoefficientsEncoder ff_aac_coders[]; +extern const AACCoefficientsEncoder ff_aac_coders[]; /** * AAC encoder context @@ -67,7 +67,7 @@ typedef struct AACEncContext { ChannelElement *cpe; ///< channel elements FFPsyContext psy; struct FFPsyPreprocessContext* psypp; - AACCoefficientsEncoder *coder; + const AACCoefficientsEncoder *coder; int cur_channel; int last_frame; float lambda; diff --git a/libavcodec/aic.c b/libavcodec/aic.c index 368b3bcf23..ed0be44629 100644 --- a/libavcodec/aic.c +++ b/libavcodec/aic.c @@ -133,7 +133,7 @@ static const uint8_t aic_c_ext_scan[192] = { 177, 184, 176, 169, 162, 161, 168, 160, }; -static const uint8_t *aic_scan[NUM_BANDS] = { +static const uint8_t * const aic_scan[NUM_BANDS] = { aic_y_scan, aic_c_scan, aic_y_ext_scan, aic_c_ext_scan }; diff --git a/libavcodec/amrnbdata.h b/libavcodec/amrnbdata.h index b7d1b89608..4eaeb0e355 100644 --- a/libavcodec/amrnbdata.h +++ b/libavcodec/amrnbdata.h @@ -1655,10 +1655,10 @@ static const float ir_filter_medium[AMR_SUBFRAME_SIZE] = { 0.016998, 0.023804, -0.041779, 0.025696, 0.019989, }; -static const float *ir_filters_lookup[2] = { +static const float * const ir_filters_lookup[2] = { ir_filter_strong, ir_filter_medium }; -static const float *ir_filters_lookup_MODE_7k95[2] = { +static const float * const ir_filters_lookup_MODE_7k95[2] = { ir_filter_strong_MODE_7k95, ir_filter_medium }; diff --git a/libavcodec/amrwbdata.h b/libavcodec/amrwbdata.h index c0078b3c6e..19f5a311be 100644 --- a/libavcodec/amrwbdata.h +++ b/libavcodec/amrwbdata.h @@ -673,7 +673,7 @@ static const uint16_t order_MODE_23k85[] = { }; /** Reordering array addresses for each mode */ -static const uint16_t* amr_bit_orderings_by_mode[] = { +static const uint16_t * const amr_bit_orderings_by_mode[] = { order_MODE_6k60, order_MODE_8k85, order_MODE_12k65, @@ -1805,7 +1805,7 @@ static const float ir_filter_mid[64] = { -7.501221e-02, 2.920532e-02, 1.660156e-02, 7.751465e-02 }; -static const float *ir_filters_lookup[2] = { +static const float * const ir_filters_lookup[2] = { ir_filter_str, ir_filter_mid }; diff --git a/libavcodec/atrac3plus.c b/libavcodec/atrac3plus.c index 2731a80725..e3c2504178 100644 --- a/libavcodec/atrac3plus.c +++ b/libavcodec/atrac3plus.c @@ -82,52 +82,52 @@ av_cold void ff_atrac3p_init_vlcs(AVCodec *codec) { int i, wl_vlc_offs, ct_vlc_offs, sf_vlc_offs, tab_offset; - static int wl_nb_bits[4] = { 2, 3, 5, 5 }; - static int wl_nb_codes[4] = { 3, 5, 8, 8 }; - static const uint8_t *wl_bits[4] = { + static const int wl_nb_bits[4] = { 2, 3, 5, 5 }; + static const int wl_nb_codes[4] = { 3, 5, 8, 8 }; + static const uint8_t * const wl_bits[4] = { atrac3p_wl_huff_bits1, atrac3p_wl_huff_bits2, atrac3p_wl_huff_bits3, atrac3p_wl_huff_bits4 }; - static const uint8_t *wl_codes[4] = { + static const uint8_t * const wl_codes[4] = { atrac3p_wl_huff_code1, atrac3p_wl_huff_code2, atrac3p_wl_huff_code3, atrac3p_wl_huff_code4 }; - static const uint8_t *wl_xlats[4] = { + static const uint8_t * const wl_xlats[4] = { atrac3p_wl_huff_xlat1, atrac3p_wl_huff_xlat2, NULL, NULL }; - static int ct_nb_bits[4] = { 3, 4, 4, 4 }; - static int ct_nb_codes[4] = { 4, 8, 8, 8 }; - static const uint8_t *ct_bits[4] = { + static const int ct_nb_bits[4] = { 3, 4, 4, 4 }; + static const int ct_nb_codes[4] = { 4, 8, 8, 8 }; + static const uint8_t * const ct_bits[4] = { atrac3p_ct_huff_bits1, atrac3p_ct_huff_bits2, atrac3p_ct_huff_bits2, atrac3p_ct_huff_bits3 }; - static const uint8_t *ct_codes[4] = { + static const uint8_t * const ct_codes[4] = { atrac3p_ct_huff_code1, atrac3p_ct_huff_code2, atrac3p_ct_huff_code2, atrac3p_ct_huff_code3 }; - static const uint8_t *ct_xlats[4] = { + static const uint8_t * const ct_xlats[4] = { NULL, NULL, atrac3p_ct_huff_xlat1, NULL }; - static int sf_nb_bits[8] = { 9, 9, 9, 9, 6, 6, 7, 7 }; - static int sf_nb_codes[8] = { 64, 64, 64, 64, 16, 16, 16, 16 }; - static const uint8_t *sf_bits[8] = { + static const int sf_nb_bits[8] = { 9, 9, 9, 9, 6, 6, 7, 7 }; + static const int sf_nb_codes[8] = { 64, 64, 64, 64, 16, 16, 16, 16 }; + static const uint8_t * const sf_bits[8] = { atrac3p_sf_huff_bits1, atrac3p_sf_huff_bits1, atrac3p_sf_huff_bits2, atrac3p_sf_huff_bits3, atrac3p_sf_huff_bits4, atrac3p_sf_huff_bits4, atrac3p_sf_huff_bits5, atrac3p_sf_huff_bits6 }; - static const uint16_t *sf_codes[8] = { + static const uint16_t * const sf_codes[8] = { atrac3p_sf_huff_code1, atrac3p_sf_huff_code1, atrac3p_sf_huff_code2, atrac3p_sf_huff_code3, atrac3p_sf_huff_code4, atrac3p_sf_huff_code4, atrac3p_sf_huff_code5, atrac3p_sf_huff_code6 }; - static const uint8_t *sf_xlats[8] = { + static const uint8_t * const sf_xlats[8] = { atrac3p_sf_huff_xlat1, atrac3p_sf_huff_xlat2, NULL, NULL, atrac3p_sf_huff_xlat4, atrac3p_sf_huff_xlat5, NULL, NULL }; - static const uint8_t *gain_cbs[11] = { + static const uint8_t * const gain_cbs[11] = { atrac3p_huff_gain_npoints1_cb, atrac3p_huff_gain_npoints1_cb, atrac3p_huff_gain_lev1_cb, atrac3p_huff_gain_lev2_cb, atrac3p_huff_gain_lev3_cb, atrac3p_huff_gain_lev4_cb, @@ -135,7 +135,7 @@ av_cold void ff_atrac3p_init_vlcs(AVCodec *codec) atrac3p_huff_gain_loc4_cb, atrac3p_huff_gain_loc2_cb, atrac3p_huff_gain_loc5_cb }; - static const uint8_t *gain_xlats[11] = { + static const uint8_t * const gain_xlats[11] = { NULL, atrac3p_huff_gain_npoints2_xlat, atrac3p_huff_gain_lev1_xlat, atrac3p_huff_gain_lev2_xlat, atrac3p_huff_gain_lev3_xlat, atrac3p_huff_gain_lev4_xlat, atrac3p_huff_gain_loc3_xlat, @@ -143,13 +143,13 @@ av_cold void ff_atrac3p_init_vlcs(AVCodec *codec) atrac3p_huff_gain_loc2_xlat, atrac3p_huff_gain_loc5_xlat }; - static const uint8_t *tone_cbs[7] = { + static const uint8_t * const tone_cbs[7] = { atrac3p_huff_tonebands_cb, atrac3p_huff_numwavs1_cb, atrac3p_huff_numwavs2_cb, atrac3p_huff_wav_ampsf1_cb, atrac3p_huff_wav_ampsf2_cb, atrac3p_huff_wav_ampsf3_cb, atrac3p_huff_freq_cb }; - static const uint8_t *tone_xlats[7] = { + static const uint8_t * const tone_xlats[7] = { NULL, NULL, atrac3p_huff_numwavs2_xlat, atrac3p_huff_wav_ampsf1_xlat, atrac3p_huff_wav_ampsf2_xlat, atrac3p_huff_wav_ampsf3_xlat, atrac3p_huff_freq_xlat diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c index 8021193894..2654118fad 100644 --- a/libavcodec/dfa.c +++ b/libavcodec/dfa.c @@ -322,7 +322,7 @@ static const chunk_decoder decoder[8] = { decode_tdlt, decode_dsw1, decode_blck, decode_dds1, }; -static const char* chunk_name[8] = { +static const char * const chunk_name[8] = { "COPY", "TSW1", "BDLT", "WDLT", "TDLT", "DSW1", "BLCK", "DDS1" }; diff --git a/libavcodec/g722dec.c b/libavcodec/g722dec.c index bfd4b420b2..f9605c99c5 100644 --- a/libavcodec/g722dec.c +++ b/libavcodec/g722dec.c @@ -80,9 +80,9 @@ static const int16_t low_inv_quant5[32] = { 587, 473, 370, 276, 190, 110, 35, -35 }; -static const int16_t *low_inv_quants[3] = { ff_g722_low_inv_quant6, - low_inv_quant5, - ff_g722_low_inv_quant4 }; +static const int16_t * const low_inv_quants[3] = { ff_g722_low_inv_quant6, + low_inv_quant5, + ff_g722_low_inv_quant4 }; static int g722_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) diff --git a/libavcodec/h263data.c b/libavcodec/h263data.c index b7f4f20e42..0e368a3ac7 100644 --- a/libavcodec/h263data.c +++ b/libavcodec/h263data.c @@ -264,11 +264,11 @@ const uint8_t ff_h263_chroma_qscale_table[32] = { 0, 1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15 }; -uint16_t ff_mba_max[6] = { +const uint16_t ff_mba_max[6] = { 47, 98, 395, 1583, 6335, 9215 }; -uint8_t ff_mba_length[7] = { +const uint8_t ff_mba_length[7] = { 6, 7, 9, 11, 13, 14, 14 }; diff --git a/libavcodec/h263data.h b/libavcodec/h263data.h index a431d58f12..2c494b32cc 100644 --- a/libavcodec/h263data.h +++ b/libavcodec/h263data.h @@ -71,7 +71,7 @@ extern const uint8_t ff_modified_quant_tab[2][32]; extern const uint8_t ff_h263_chroma_qscale_table[32]; -extern uint16_t ff_mba_max[6]; -extern uint8_t ff_mba_length[7]; +extern const uint16_t ff_mba_max[6]; +extern const uint8_t ff_mba_length[7]; #endif /* AVCODEC_H263DATA_H */ diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c index 1b5b6505d6..37d85e1abc 100644 --- a/libavcodec/indeo3.c +++ b/libavcodec/indeo3.c @@ -118,8 +118,8 @@ static uint8_t requant_tab[8][128]; */ static av_cold void build_requant_tab(void) { - static int8_t offsets[8] = { 1, 1, 2, -3, -3, 3, 4, 4 }; - static int8_t deltas [8] = { 0, 1, 0, 4, 4, 1, 0, 1 }; + static const int8_t offsets[8] = { 1, 1, 2, -3, -3, 3, 4, 4 }; + static const int8_t deltas [8] = { 0, 1, 0, 4, 4, 1, 0, 1 }; int i, j, step; diff --git a/libavcodec/indeo4data.h b/libavcodec/indeo4data.h index be7c41356b..35ff404e18 100644 --- a/libavcodec/indeo4data.h +++ b/libavcodec/indeo4data.h @@ -60,7 +60,7 @@ static const uint8_t ivi4_horizontal_scan_4x4[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; -static const uint8_t *scan_index_to_tab[15] = { +static const uint8_t * const scan_index_to_tab[15] = { // for 8x8 transforms ff_zigzag_direct, ivi4_alternate_scan_8x8, diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index e16d482f9c..8891ec1bb7 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1274,7 +1274,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) Mpeg4DecContext *ctx = (Mpeg4DecContext *)s; int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant; int16_t *mot_val; - static int8_t quant_tab[4] = { -1, -2, 1, 2 }; + static const int8_t quant_tab[4] = { -1, -2, 1, 2 }; const int xy = s->mb_x + s->mb_y * s->mb_stride; assert(s->h263_pred); diff --git a/libavcodec/on2avc.c b/libavcodec/on2avc.c index 1b81980f7d..39ae1178f1 100644 --- a/libavcodec/on2avc.c +++ b/libavcodec/on2avc.c @@ -320,7 +320,7 @@ static void zero_head_and_tail(float *src, int len, int order0, int order1) } static void pretwiddle(float *src, float *dst, int dst_len, int tab_step, - int step, int order0, int order1, const double **tabs) + int step, int order0, int order1, const double * const *tabs) { float *src2, *out; const double *tab; @@ -348,7 +348,7 @@ static void pretwiddle(float *src, float *dst, int dst_len, int tab_step, static void twiddle(float *src1, float *src2, int src2_len, const double *tab, int tab_len, int step, - int order0, int order1, const double **tabs) + int order0, int order1, const double * const *tabs) { int steps; int mask; diff --git a/libavcodec/on2avcdata.c b/libavcodec/on2avcdata.c index d039f23509..93543ad17c 100644 --- a/libavcodec/on2avcdata.c +++ b/libavcodec/on2avcdata.c @@ -7641,11 +7641,11 @@ static const double tabs_4_10[4 * 2][10] = { -0.099339873, -0.041293536, 0.31028851, 0.17727433, -0.92756648 } }; -const double *ff_on2avc_tabs_4_10_1[4] = { +const double * const ff_on2avc_tabs_4_10_1[4] = { tabs_4_10[0], tabs_4_10[1], tabs_4_10[2], tabs_4_10[3] }; -const double *ff_on2avc_tabs_4_10_2[4] = { +const double * const ff_on2avc_tabs_4_10_2[4] = { tabs_4_10[4], tabs_4_10[5], tabs_4_10[6], tabs_4_10[7] }; @@ -7724,12 +7724,12 @@ static const double tabs_9_20[9 * 2][20] = { 0.22783, 0.058894795, -0.61350902, 0.69559873, -0.27013783, } }; -const double* ff_on2avc_tabs_9_20_1[9] = { +const double * const ff_on2avc_tabs_9_20_1[9] = { tabs_9_20[0], tabs_9_20[1], tabs_9_20[2], tabs_9_20[3], tabs_9_20[4], tabs_9_20[5], tabs_9_20[6], tabs_9_20[7], tabs_9_20[8] }; -const double* ff_on2avc_tabs_9_20_2[9] = { +const double * const ff_on2avc_tabs_9_20_2[9] = { tabs_9_20[ 9], tabs_9_20[10], tabs_9_20[11], tabs_9_20[12], tabs_9_20[13], tabs_9_20[14], tabs_9_20[15], tabs_9_20[16], tabs_9_20[17] }; @@ -7927,7 +7927,7 @@ static const double tabs_19_40[19 * 2][40] = { 0.019871848, -0.11989559, 0.036659135, 0.26632201, -0.3057397, -0.23220335, 0.68741352, -0.54024027, } }; -const double* ff_on2avc_tabs_19_40_1[19] = { +const double * const ff_on2avc_tabs_19_40_1[19] = { tabs_19_40[ 0], tabs_19_40[ 1], tabs_19_40[ 2], tabs_19_40[ 3], tabs_19_40[ 4], tabs_19_40[ 5], tabs_19_40[ 6], tabs_19_40[ 7], tabs_19_40[ 8], tabs_19_40[ 9], tabs_19_40[10], tabs_19_40[11], @@ -7935,7 +7935,7 @@ const double* ff_on2avc_tabs_19_40_1[19] = { tabs_19_40[16], tabs_19_40[17], tabs_19_40[18], }; -const double* ff_on2avc_tabs_19_40_2[19] = { +const double * const ff_on2avc_tabs_19_40_2[19] = { tabs_19_40[19], tabs_19_40[20], tabs_19_40[21], tabs_19_40[22], tabs_19_40[23], tabs_19_40[24], tabs_19_40[25], tabs_19_40[26], tabs_19_40[27], tabs_19_40[28], tabs_19_40[29], tabs_19_40[30], @@ -8826,7 +8826,7 @@ static const double tabs_20_84[20 * 4][84] = { 0.51434408, -0.41486443, 0.27672635, -0.10432054, }, }; -const double* ff_on2avc_tabs_20_84_1[20] = { +const double * const ff_on2avc_tabs_20_84_1[20] = { tabs_20_84[ 0], tabs_20_84[ 1], tabs_20_84[ 2], tabs_20_84[ 3], tabs_20_84[ 4], tabs_20_84[ 5], tabs_20_84[ 6], tabs_20_84[ 7], tabs_20_84[ 8], tabs_20_84[ 9], tabs_20_84[10], tabs_20_84[11], @@ -8834,7 +8834,7 @@ const double* ff_on2avc_tabs_20_84_1[20] = { tabs_20_84[16], tabs_20_84[17], tabs_20_84[18], tabs_20_84[19] }; -const double* ff_on2avc_tabs_20_84_2[20] = { +const double * const ff_on2avc_tabs_20_84_2[20] = { tabs_20_84[20], tabs_20_84[21], tabs_20_84[22], tabs_20_84[23], tabs_20_84[24], tabs_20_84[25], tabs_20_84[26], tabs_20_84[27], tabs_20_84[28], tabs_20_84[29], tabs_20_84[30], tabs_20_84[31], @@ -8842,7 +8842,7 @@ const double* ff_on2avc_tabs_20_84_2[20] = { tabs_20_84[36], tabs_20_84[37], tabs_20_84[38], tabs_20_84[39] }; -const double* ff_on2avc_tabs_20_84_3[20] = { +const double * const ff_on2avc_tabs_20_84_3[20] = { tabs_20_84[40], tabs_20_84[41], tabs_20_84[42], tabs_20_84[43], tabs_20_84[44], tabs_20_84[45], tabs_20_84[46], tabs_20_84[47], tabs_20_84[48], tabs_20_84[49], tabs_20_84[50], tabs_20_84[51], @@ -8850,7 +8850,7 @@ const double* ff_on2avc_tabs_20_84_3[20] = { tabs_20_84[56], tabs_20_84[57], tabs_20_84[58], tabs_20_84[59] }; -const double* ff_on2avc_tabs_20_84_4[20] = { +const double * const ff_on2avc_tabs_20_84_4[20] = { tabs_20_84[60], tabs_20_84[61], tabs_20_84[62], tabs_20_84[63], tabs_20_84[64], tabs_20_84[65], tabs_20_84[66], tabs_20_84[67], tabs_20_84[68], tabs_20_84[69], tabs_20_84[70], tabs_20_84[71], diff --git a/libavcodec/on2avcdata.h b/libavcodec/on2avcdata.h index 39d29110ec..ff66ccacd3 100644 --- a/libavcodec/on2avcdata.h +++ b/libavcodec/on2avcdata.h @@ -64,16 +64,16 @@ extern const double ff_on2avc_tab_84_1[]; extern const double ff_on2avc_tab_84_2[]; extern const double ff_on2avc_tab_84_3[]; extern const double ff_on2avc_tab_84_4[]; -extern const double* ff_on2avc_tabs_4_10_1[4]; -extern const double* ff_on2avc_tabs_4_10_2[4]; -extern const double* ff_on2avc_tabs_9_20_1[9]; -extern const double* ff_on2avc_tabs_9_20_2[9]; -extern const double* ff_on2avc_tabs_19_40_1[19]; -extern const double* ff_on2avc_tabs_19_40_2[19]; -extern const double* ff_on2avc_tabs_20_84_1[20]; -extern const double* ff_on2avc_tabs_20_84_2[20]; -extern const double* ff_on2avc_tabs_20_84_3[20]; -extern const double* ff_on2avc_tabs_20_84_4[20]; +extern const double * const ff_on2avc_tabs_4_10_1[4]; +extern const double * const ff_on2avc_tabs_4_10_2[4]; +extern const double * const ff_on2avc_tabs_9_20_1[9]; +extern const double * const ff_on2avc_tabs_9_20_2[9]; +extern const double * const ff_on2avc_tabs_19_40_1[19]; +extern const double * const ff_on2avc_tabs_19_40_2[19]; +extern const double * const ff_on2avc_tabs_20_84_1[20]; +extern const double * const ff_on2avc_tabs_20_84_2[20]; +extern const double * const ff_on2avc_tabs_20_84_3[20]; +extern const double * const ff_on2avc_tabs_20_84_4[20]; extern const float ff_on2avc_ctab_1[2048]; extern const float ff_on2avc_ctab_2[2048]; extern const float ff_on2avc_ctab_3[2048]; diff --git a/libavcodec/opus_silk.c b/libavcodec/opus_silk.c index 5db1b26c6f..e5d1a9923d 100644 --- a/libavcodec/opus_silk.c +++ b/libavcodec/opus_silk.c @@ -1323,7 +1323,7 @@ static void silk_decode_frame(SilkContext *s, OpusRangeCoder *rc, if (lag_absolute) { /* primary lag is coded absolute */ int highbits, lowbits; - static const uint16_t *model[] = { + static const uint16_t * const model[] = { silk_model_pitch_lowbits_nb, silk_model_pitch_lowbits_mb, silk_model_pitch_lowbits_wb }; @@ -1357,11 +1357,11 @@ static void silk_decode_frame(SilkContext *s, OpusRangeCoder *rc, ltpfilter = opus_rc_getsymbol(rc, silk_model_ltp_filter); for (i = 0; i < s->subframes; i++) { int index, j; - static const uint16_t *filter_sel[] = { + static const uint16_t * const filter_sel[] = { silk_model_ltp_filter0_sel, silk_model_ltp_filter1_sel, silk_model_ltp_filter2_sel }; - static const int8_t (*filter_taps[])[5] = { + static const int8_t (* const filter_taps[])[5] = { silk_ltp_filter0_taps, silk_ltp_filter1_taps, silk_ltp_filter2_taps }; index = opus_rc_getsymbol(rc, filter_sel[ltpfilter]); diff --git a/libavcodec/qsvdec_h2645.c b/libavcodec/qsvdec_h2645.c index 6624fbecc7..a2a6cc3c47 100644 --- a/libavcodec/qsvdec_h2645.c +++ b/libavcodec/qsvdec_h2645.c @@ -84,8 +84,8 @@ static av_cold int qsv_decode_init(AVCodecContext *avctx) int ret; if (avctx->codec_id == AV_CODEC_ID_HEVC && s->load_plugin != LOAD_PLUGIN_NONE) { - static const char *uid_hevcdec_sw = "15dd936825ad475ea34e35f3f54217a6"; - static const char *uid_hevcdec_hw = "33a61c0b4c27454ca8d85dde757c6f8e"; + static const char * const uid_hevcdec_sw = "15dd936825ad475ea34e35f3f54217a6"; + static const char * const uid_hevcdec_hw = "33a61c0b4c27454ca8d85dde757c6f8e"; if (s->qsv.load_plugins[0]) { av_log(avctx, AV_LOG_WARNING, diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index c51309f9c6..27ff0c6feb 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -161,8 +161,8 @@ static av_cold int qsv_enc_init(AVCodecContext *avctx) int ret; if (q->load_plugin != LOAD_PLUGIN_NONE) { - static const char *uid_hevcenc_sw = "2fca99749fdb49aeb121a5b63ef568f7"; - static const char *uid_hevcenc_hw = "6fadc791a0c2eb479ab6dcd5ea9da347"; + static const char * const uid_hevcenc_sw = "2fca99749fdb49aeb121a5b63ef568f7"; + static const char * const uid_hevcenc_hw = "6fadc791a0c2eb479ab6dcd5ea9da347"; if (q->qsv.load_plugins[0]) { av_log(avctx, AV_LOG_WARNING, diff --git a/libavcodec/sipr.c b/libavcodec/sipr.c index cf29d3bba7..5d2bdbdcba 100644 --- a/libavcodec/sipr.c +++ b/libavcodec/sipr.c @@ -139,7 +139,7 @@ const float ff_pow_0_5[] = { 1.0/(1 << 13), 1.0/(1 << 14), 1.0/(1 << 15), 1.0/(1 << 16) }; -static void dequant(float *out, const int *idx, const float *cbs[]) +static void dequant(float *out, const int *idx, const float * const cbs[]) { int i; int stride = 2; diff --git a/libavcodec/sipr16k.c b/libavcodec/sipr16k.c index f7fcb34315..6a0ef8d98c 100644 --- a/libavcodec/sipr16k.c +++ b/libavcodec/sipr16k.c @@ -51,7 +51,7 @@ static void lsf2lsp(const float *lsf, double *lsp) lsp[i] = cosf(lsf[i]); } -static void dequant(float *out, const int *idx, const float *cbs[]) +static void dequant(float *out, const int *idx, const float * const cbs[]) { int i; diff --git a/libavcodec/sipr16kdata.h b/libavcodec/sipr16kdata.h index ec60c29b51..7677a69a18 100644 --- a/libavcodec/sipr16kdata.h +++ b/libavcodec/sipr16kdata.h @@ -525,7 +525,7 @@ static const float lsf_cb5_16k[128][4] = { { 0.124405, 0.009943, -0.148477, -0.205184} }; -static const float *lsf_codebooks_16k[] = { +static const float * const lsf_codebooks_16k[] = { lsf_cb1_16k[0], lsf_cb2_16k[0], lsf_cb3_16k[0], lsf_cb4_16k[0], lsf_cb5_16k[0] }; diff --git a/libavcodec/siprdata.h b/libavcodec/siprdata.h index 92037a4a87..2644d59d57 100644 --- a/libavcodec/siprdata.h +++ b/libavcodec/siprdata.h @@ -206,7 +206,7 @@ static const float lsf_cb5[32][2] = { { 0.150514, 0.034366}, { 0.186092, -0.069272} }; -static const float *lsf_codebooks[] = { +static const float * const lsf_codebooks[] = { lsf_cb1[0], lsf_cb2[0], lsf_cb3[0], lsf_cb4[0], lsf_cb5[0] }; diff --git a/libavcodec/tscc2data.h b/libavcodec/tscc2data.h index ac0a898177..bcadc094a2 100644 --- a/libavcodec/tscc2data.h +++ b/libavcodec/tscc2data.h @@ -903,14 +903,14 @@ static const int tscc2_ac_vlc_sizes[NUM_VLC_SETS] = { 172, 169, 165, 162, 131, 132, 130, 125, 121, 114, 110, 101, 96 }; -static const uint16_t *tscc2_ac_vlc_syms[NUM_VLC_SETS] = { +static const uint16_t * const tscc2_ac_vlc_syms[NUM_VLC_SETS] = { ac_vlc_desc0_syms, ac_vlc_desc1_syms, ac_vlc_desc2_syms, ac_vlc_desc3_syms, ac_vlc_desc4_syms, ac_vlc_desc5_syms, ac_vlc_desc6_syms, ac_vlc_desc7_syms, ac_vlc_desc8_syms, ac_vlc_desc9_syms, ac_vlc_descA_syms, ac_vlc_descB_syms, ac_vlc_descC_syms, }; -static const uint16_t *tscc2_ac_vlc_codes[NUM_VLC_SETS] = { +static const uint16_t * const tscc2_ac_vlc_codes[NUM_VLC_SETS] = { ac_vlc_desc0_codes, ac_vlc_desc1_codes, ac_vlc_desc2_codes, ac_vlc_desc3_codes, ac_vlc_desc4_codes, ac_vlc_desc5_codes, ac_vlc_desc6_codes, ac_vlc_desc7_codes, ac_vlc_desc8_codes, @@ -918,7 +918,7 @@ static const uint16_t *tscc2_ac_vlc_codes[NUM_VLC_SETS] = { ac_vlc_descC_codes, }; -static const uint8_t *tscc2_ac_vlc_bits[NUM_VLC_SETS] = { +static const uint8_t * const tscc2_ac_vlc_bits[NUM_VLC_SETS] = { ac_vlc_desc0_bits, ac_vlc_desc1_bits, ac_vlc_desc2_bits, ac_vlc_desc3_bits, ac_vlc_desc4_bits, ac_vlc_desc5_bits, ac_vlc_desc6_bits, ac_vlc_desc7_bits, ac_vlc_desc8_bits, ac_vlc_desc9_bits, ac_vlc_descA_bits, ac_vlc_descB_bits, diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 8238952543..c02b633b46 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -27,7 +27,7 @@ #include "vaapi_encode.h" #include "avcodec.h" -static const char *picture_type_name[] = { "IDR", "I", "P", "B" }; +static const char * const picture_type_name[] = { "IDR", "I", "P", "B" }; static int vaapi_encode_make_packed_header(AVCodecContext *avctx, VAAPIEncodePicture *pic, diff --git a/libavcodec/vaapi_encode_mjpeg.c b/libavcodec/vaapi_encode_mjpeg.c index 78d5e789f1..b96715146d 100644 --- a/libavcodec/vaapi_encode_mjpeg.c +++ b/libavcodec/vaapi_encode_mjpeg.c @@ -361,7 +361,7 @@ static av_cold int vaapi_encode_mjpeg_configure(AVCodecContext *avctx) return 0; } -static VAAPIEncodeType vaapi_encode_type_mjpeg = { +static const VAAPIEncodeType vaapi_encode_type_mjpeg = { .priv_data_size = sizeof(VAAPIEncodeMJPEGContext), .configure = &vaapi_encode_mjpeg_configure, diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index bf1b03e9f7..43580a3a81 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -1166,10 +1166,10 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_t *segment, uint8_t *ref, int layout, int is_vp7) { VP56RangeCoder *c = &s->c; - static const char *vp7_feature_name[] = { "q-index", - "lf-delta", - "partial-golden-update", - "blit-pitch" }; + static const char * const vp7_feature_name[] = { "q-index", + "lf-delta", + "partial-golden-update", + "blit-pitch" }; if (is_vp7) { int i; *segment = 0; diff --git a/libavcodec/vp9block.c b/libavcodec/vp9block.c index 194d619ce2..35c9c27c53 100644 --- a/libavcodec/vp9block.c +++ b/libavcodec/vp9block.c @@ -842,8 +842,8 @@ static int decode_coeffs(AVCodecContext *avctx) int uvstep1d = 1 << b->uvtx, uvstep = 1 << (b->uvtx * 2), ret; int16_t (*qmul)[2] = s->segmentation.feat[b->seg_id].qmul; int tx = 4 * s->lossless + b->tx; - const int16_t **yscans = ff_vp9_scans[tx]; - const int16_t (**ynbs)[2] = ff_vp9_scans_nb[tx]; + const int16_t * const *yscans = ff_vp9_scans[tx]; + const int16_t (* const * ynbs)[2] = ff_vp9_scans_nb[tx]; const int16_t *uvscan = ff_vp9_scans[b->uvtx][DCT_DCT]; const int16_t (*uvnb)[2] = ff_vp9_scans_nb[b->uvtx][DCT_DCT]; uint8_t *a = &s->above_y_nnz_ctx[col * 2]; diff --git a/libavcodec/vp9data.c b/libavcodec/vp9data.c index 374fa8bb8c..2b678781b8 100644 --- a/libavcodec/vp9data.c +++ b/libavcodec/vp9data.c @@ -483,7 +483,7 @@ const int16_t ff_vp9_default_scan_32x32[1024] = { 924, 925, 956, 926, 957, 988, 927, 958, 989, 1020, 959, 990, 1021, 991, 1022, 1023, }; -const int16_t *ff_vp9_scans[5][4] = { +const int16_t * const ff_vp9_scans[5][4] = { { ff_vp9_default_scan_4x4, ff_vp9_col_scan_4x4, ff_vp9_row_scan_4x4, ff_vp9_default_scan_4x4 @@ -1040,7 +1040,7 @@ const int16_t ff_vp9_default_scan_32x32_nb[1024][2] = { { 990, 959 }, { 1021, 990 }, { 1022, 991 }, { 0, 0 }, }; -const int16_t (*ff_vp9_scans_nb[5][4])[2] = { +const int16_t (* const ff_vp9_scans_nb[5][4])[2] = { { ff_vp9_default_scan_4x4_nb, ff_vp9_col_scan_4x4_nb, ff_vp9_row_scan_4x4_nb, ff_vp9_default_scan_4x4_nb diff --git a/libavcodec/vp9data.h b/libavcodec/vp9data.h index a52cc0a353..f9ad9119d1 100644 --- a/libavcodec/vp9data.h +++ b/libavcodec/vp9data.h @@ -48,7 +48,7 @@ extern const int16_t ff_vp9_default_scan_16x16[256]; extern const int16_t ff_vp9_col_scan_16x16[256]; extern const int16_t ff_vp9_row_scan_16x16[256]; extern const int16_t ff_vp9_default_scan_32x32[1024]; -extern const int16_t *ff_vp9_scans[5][4]; +extern const int16_t * const ff_vp9_scans[5][4]; extern const int16_t ff_vp9_default_scan_4x4_nb[16][2]; extern const int16_t ff_vp9_col_scan_4x4_nb[16][2]; extern const int16_t ff_vp9_row_scan_4x4_nb[16][2]; @@ -59,7 +59,7 @@ extern const int16_t ff_vp9_default_scan_16x16_nb[256][2]; extern const int16_t ff_vp9_col_scan_16x16_nb[256][2]; extern const int16_t ff_vp9_row_scan_16x16_nb[256][2]; extern const int16_t ff_vp9_default_scan_32x32_nb[1024][2]; -extern const int16_t (*ff_vp9_scans_nb[5][4])[2]; +extern const int16_t (* const ff_vp9_scans_nb[5][4])[2]; extern const uint8_t ff_vp9_model_pareto8[256][8]; extern const ProbContext ff_vp9_default_probs; extern const uint8_t ff_vp9_default_coef_probs[4][2][2][6][6][3]; diff --git a/libavcodec/x86/fdct.c b/libavcodec/x86/fdct.c index 6528b57361..e01509eaef 100644 --- a/libavcodec/x86/fdct.c +++ b/libavcodec/x86/fdct.c @@ -70,7 +70,7 @@ DECLARE_ALIGNED(16, static const int16_t, fdct_one_corr)[8] = { X8(1) }; DECLARE_ALIGNED(8, static const int32_t, fdct_r_row)[2] = {RND_FRW_ROW, RND_FRW_ROW }; -static struct +static const struct { DECLARE_ALIGNED(16, const int32_t, fdct_r_row_sse2)[4]; } fdct_r_row_sse2 = @@ -153,7 +153,7 @@ DECLARE_ALIGNED(8, static const int16_t, tab_frw_01234567)[] = { // forward_dct 29692, -12299, 26722, -31521, }; -static struct +static const struct { DECLARE_ALIGNED(16, const int16_t, tab_frw_01234567_sse2)[256]; } tab_frw_01234567_sse2 = diff --git a/libavcodec/x86/mlpdsp.c b/libavcodec/x86/mlpdsp.c index 72fc637764..157ba7c907 100644 --- a/libavcodec/x86/mlpdsp.c +++ b/libavcodec/x86/mlpdsp.c @@ -45,14 +45,14 @@ extern char ff_mlp_iirorder_2; extern char ff_mlp_iirorder_1; extern char ff_mlp_iirorder_0; -static const void *firtable[9] = { &ff_mlp_firorder_0, &ff_mlp_firorder_1, - &ff_mlp_firorder_2, &ff_mlp_firorder_3, - &ff_mlp_firorder_4, &ff_mlp_firorder_5, - &ff_mlp_firorder_6, &ff_mlp_firorder_7, - &ff_mlp_firorder_8 }; -static const void *iirtable[5] = { &ff_mlp_iirorder_0, &ff_mlp_iirorder_1, - &ff_mlp_iirorder_2, &ff_mlp_iirorder_3, - &ff_mlp_iirorder_4 }; +static const void * const firtable[9] = { &ff_mlp_firorder_0, &ff_mlp_firorder_1, + &ff_mlp_firorder_2, &ff_mlp_firorder_3, + &ff_mlp_firorder_4, &ff_mlp_firorder_5, + &ff_mlp_firorder_6, &ff_mlp_firorder_7, + &ff_mlp_firorder_8 }; +static const void * const iirtable[5] = { &ff_mlp_iirorder_0, &ff_mlp_iirorder_1, + &ff_mlp_iirorder_2, &ff_mlp_iirorder_3, + &ff_mlp_iirorder_4 }; #if ARCH_X86_64 diff --git a/libavcodec/x86/videodsp_init.c b/libavcodec/x86/videodsp_init.c index 8ee837096a..d5bfe010f7 100644 --- a/libavcodec/x86/videodsp_init.c +++ b/libavcodec/x86/videodsp_init.c @@ -59,7 +59,7 @@ extern emu_edge_vfix_func ff_emu_edge_vfix20_mmx; extern emu_edge_vfix_func ff_emu_edge_vfix21_mmx; extern emu_edge_vfix_func ff_emu_edge_vfix22_mmx; #if ARCH_X86_32 -static emu_edge_vfix_func *vfixtbl_mmx[22] = { +static emu_edge_vfix_func * const vfixtbl_mmx[22] = { &ff_emu_edge_vfix1_mmx, &ff_emu_edge_vfix2_mmx, &ff_emu_edge_vfix3_mmx, &ff_emu_edge_vfix4_mmx, &ff_emu_edge_vfix5_mmx, &ff_emu_edge_vfix6_mmx, &ff_emu_edge_vfix7_mmx, &ff_emu_edge_vfix8_mmx, &ff_emu_edge_vfix9_mmx, @@ -78,7 +78,7 @@ extern emu_edge_vfix_func ff_emu_edge_vfix19_sse; extern emu_edge_vfix_func ff_emu_edge_vfix20_sse; extern emu_edge_vfix_func ff_emu_edge_vfix21_sse; extern emu_edge_vfix_func ff_emu_edge_vfix22_sse; -static emu_edge_vfix_func *vfixtbl_sse[22] = { +static emu_edge_vfix_func * const vfixtbl_sse[22] = { ff_emu_edge_vfix1_mmx, ff_emu_edge_vfix2_mmx, ff_emu_edge_vfix3_mmx, ff_emu_edge_vfix4_mmx, ff_emu_edge_vfix5_mmx, ff_emu_edge_vfix6_mmx, ff_emu_edge_vfix7_mmx, ff_emu_edge_vfix8_mmx, ff_emu_edge_vfix9_mmx, @@ -107,7 +107,7 @@ extern emu_edge_hfix_func ff_emu_edge_hfix18_mmx; extern emu_edge_hfix_func ff_emu_edge_hfix20_mmx; extern emu_edge_hfix_func ff_emu_edge_hfix22_mmx; #if ARCH_X86_32 -static emu_edge_hfix_func *hfixtbl_mmx[11] = { +static emu_edge_hfix_func * const hfixtbl_mmx[11] = { ff_emu_edge_hfix2_mmx, ff_emu_edge_hfix4_mmx, ff_emu_edge_hfix6_mmx, ff_emu_edge_hfix8_mmx, ff_emu_edge_hfix10_mmx, ff_emu_edge_hfix12_mmx, ff_emu_edge_hfix14_mmx, ff_emu_edge_hfix16_mmx, ff_emu_edge_hfix18_mmx, @@ -119,7 +119,7 @@ extern emu_edge_hfix_func ff_emu_edge_hfix16_sse2; extern emu_edge_hfix_func ff_emu_edge_hfix18_sse2; extern emu_edge_hfix_func ff_emu_edge_hfix20_sse2; extern emu_edge_hfix_func ff_emu_edge_hfix22_sse2; -static emu_edge_hfix_func *hfixtbl_sse2[11] = { +static emu_edge_hfix_func * const hfixtbl_sse2[11] = { ff_emu_edge_hfix2_mmx, ff_emu_edge_hfix4_mmx, ff_emu_edge_hfix6_mmx, ff_emu_edge_hfix8_mmx, ff_emu_edge_hfix10_mmx, ff_emu_edge_hfix12_mmx, ff_emu_edge_hfix14_mmx, ff_emu_edge_hfix16_sse2, ff_emu_edge_hfix18_sse2, @@ -133,9 +133,9 @@ static av_always_inline void emulated_edge_mc(uint8_t *dst, const uint8_t *src, x86_reg block_w, x86_reg block_h, x86_reg src_x, x86_reg src_y, x86_reg w, x86_reg h, - emu_edge_vfix_func **vfix_tbl, + emu_edge_vfix_func * const *vfix_tbl, emu_edge_vvar_func *v_extend_var, - emu_edge_hfix_func **hfix_tbl, + emu_edge_hfix_func * const *hfix_tbl, emu_edge_hvar_func *h_extend_var) { x86_reg start_y, start_x, end_y, end_x, src_y_add = 0, p; diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c index 11d85a17eb..0ec42b031e 100644 --- a/libavfilter/af_volume.c +++ b/libavfilter/af_volume.c @@ -38,7 +38,7 @@ #include "internal.h" #include "af_volume.h" -static const char *precision_str[] = { +static const char * const precision_str[] = { "fixed", "float", "double" }; diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index d119251712..5668c8e8e0 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -219,7 +219,7 @@ static const AVClass drawtext_class = { #define FT_ERRORDEF(e, v, s) { (e), (s) }, #define FT_ERROR_END_LIST { 0, NULL } }; -static struct ft_error { +static const struct ft_error { int err; const char *err_msg; } ft_errors[] = diff --git a/libavfilter/vf_libopencv.c b/libavfilter/vf_libopencv.c index 50d02f84a8..5a97e4bfb6 100644 --- a/libavfilter/vf_libopencv.c +++ b/libavfilter/vf_libopencv.c @@ -321,7 +321,7 @@ typedef struct OCVFilterEntry { void (*end_frame_filter)(AVFilterContext *ctx, IplImage *inimg, IplImage *outimg); } OCVFilterEntry; -static OCVFilterEntry ocv_filter_entries[] = { +static const OCVFilterEntry ocv_filter_entries[] = { { "dilate", sizeof(DilateContext), dilate_init, dilate_uninit, dilate_end_frame_filter }, { "erode", sizeof(DilateContext), dilate_init, dilate_uninit, erode_end_frame_filter }, { "smooth", sizeof(SmoothContext), smooth_init, NULL, smooth_end_frame_filter }, @@ -333,7 +333,7 @@ static av_cold int init(AVFilterContext *ctx) int i; for (i = 0; i < FF_ARRAY_ELEMS(ocv_filter_entries); i++) { - OCVFilterEntry *entry = &ocv_filter_entries[i]; + const OCVFilterEntry *entry = &ocv_filter_entries[i]; if (!strcmp(s->name, entry->name)) { s->init = entry->init; s->uninit = entry->uninit; diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index 2fa791d001..fb30993260 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -66,7 +66,7 @@ enum EOFAction { EOF_ACTION_PASS }; -static const char *eof_action_str[] = { +static const char * const eof_action_str[] = { "repeat", "endall", "pass" }; diff --git a/libavformat/hls.c b/libavformat/hls.c index 3b8e28038d..c9da4e30ec 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -477,8 +477,8 @@ reload: static int save_avio_options(AVFormatContext *s) { HLSContext *c = s->priv_data; - static const char *opts[] = { "headers", "user_agent", NULL }; - const char **opt = opts; + static const char * const opts[] = { "headers", "user_agent", NULL }; + const char * const *opt = opts; uint8_t *buf; int ret = 0; diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 3f43b4aa8b..643891c082 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -86,7 +86,7 @@ const char ff_id3v2_3_tags[][4] = { { 0 }, }; -const char *ff_id3v2_picture_types[21] = { +const char * const ff_id3v2_picture_types[21] = { "Other", "32x32 pixels 'file icon'", "Other file icon", diff --git a/libavformat/id3v2.h b/libavformat/id3v2.h index 7cb4296f11..2d65a4dcb4 100644 --- a/libavformat/id3v2.h +++ b/libavformat/id3v2.h @@ -158,6 +158,6 @@ extern const char ff_id3v2_3_tags[][4]; extern const CodecMime ff_id3v2_mime_tags[]; -extern const char *ff_id3v2_picture_types[21]; +extern const char * const ff_id3v2_picture_types[21]; #endif /* AVFORMAT_ID3V2_H */ diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c index 1b05cdff4e..42decb1e81 100644 --- a/libavformat/mov_chan.c +++ b/libavformat/mov_chan.c @@ -344,7 +344,7 @@ static const struct MovChannelLayoutMap mov_ch_layout_map_9ch[] = { { 0, 0 }, }; -static const struct MovChannelLayoutMap *mov_ch_layout_map[] = { +static const struct MovChannelLayoutMap * const mov_ch_layout_map[] = { mov_ch_layout_map_misc, mov_ch_layout_map_1ch, mov_ch_layout_map_2ch, diff --git a/libavformat/movenc.c b/libavformat/movenc.c index ac76dedca4..440370e259 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -3529,7 +3529,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) if (par->codec_id == AV_CODEC_ID_AMR_NB) { /* We must find out how many AMR blocks there are in one packet */ - static uint16_t packed_size[16] = + static const uint16_t packed_size[16] = {13, 14, 16, 18, 20, 21, 27, 32, 6, 0, 0, 0, 0, 0, 0, 1}; int len = 0; diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 1c7c280188..cf4931e731 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -981,7 +981,7 @@ static const MXFCodecUL mxf_data_essence_container_uls[] = { { { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x09,0x0d,0x01,0x03,0x01,0x02,0x0e,0x00,0x00 }, 16, AV_CODEC_ID_NONE }, }; -static const char* mxf_data_essence_descriptor[] = { +static const char * const mxf_data_essence_descriptor[] = { "vbi_vanc_smpte_436M", }; diff --git a/libavresample/audio_mix.c b/libavresample/audio_mix.c index 8ff82a2b94..89ecc6ba71 100644 --- a/libavresample/audio_mix.c +++ b/libavresample/audio_mix.c @@ -28,7 +28,7 @@ #include "audio_data.h" #include "audio_mix.h" -static const char *coeff_type_names[] = { "q8", "q15", "flt" }; +static const char * const coeff_type_names[] = { "q8", "q15", "flt" }; struct AudioMix { AVAudioResampleContext *avr; diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index 83f733e9f9..608da68727 100644 --- a/libavutil/hwcontext.c +++ b/libavutil/hwcontext.c @@ -28,7 +28,7 @@ #include "pixdesc.h" #include "pixfmt.h" -static const HWContextType *hw_table[] = { +static const HWContextType * const hw_table[] = { #if CONFIG_CUDA &ff_hwcontext_type_cuda, #endif diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index b2e212c1fe..f8719aaf0a 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -84,7 +84,7 @@ typedef struct VAAPIMapping { } // The map fourcc <-> pix_fmt isn't bijective because of the annoying U/V // plane swap cases. The frame handling below tries to hide these. -static struct { +static const struct { unsigned int fourcc; unsigned int rt_format; enum AVPixelFormat pix_fmt; diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c index f4248114b5..d9d5839f67 100644 --- a/libavutil/parseutils.c +++ b/libavutil/parseutils.c @@ -152,7 +152,7 @@ typedef struct ColorEntry { uint8_t rgb_color[3]; ///< RGB values for the color } ColorEntry; -static ColorEntry color_table[] = { +static const ColorEntry color_table[] = { { "AliceBlue", { 0xF0, 0xF8, 0xFF } }, { "AntiqueWhite", { 0xFA, 0xEB, 0xD7 } }, { "Aqua", { 0x00, 0xFF, 0xFF } }, diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 2f1adf5d8d..d69eeea9de 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -1764,13 +1764,13 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { FF_ENABLE_DEPRECATION_WARNINGS #endif -static const char *color_range_names[] = { +static const char * const color_range_names[] = { [AVCOL_RANGE_UNSPECIFIED] = "unknown", [AVCOL_RANGE_MPEG] = "tv", [AVCOL_RANGE_JPEG] = "pc", }; -static const char *color_primaries_names[] = { +static const char * const color_primaries_names[] = { [AVCOL_PRI_RESERVED0] = "reserved", [AVCOL_PRI_BT709] = "bt709", [AVCOL_PRI_UNSPECIFIED] = "unknown", @@ -1787,7 +1787,7 @@ static const char *color_primaries_names[] = { [AVCOL_PRI_JEDEC_P22] = "jedec-p22", }; -static const char *color_transfer_names[] = { +static const char * const color_transfer_names[] = { [AVCOL_TRC_RESERVED0] = "reserved", [AVCOL_TRC_BT709] = "bt709", [AVCOL_TRC_UNSPECIFIED] = "unknown", @@ -1809,7 +1809,7 @@ static const char *color_transfer_names[] = { [AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67", }; -static const char *color_space_names[] = { +static const char * const color_space_names[] = { [AVCOL_SPC_RGB] = "gbr", [AVCOL_SPC_BT709] = "bt709", [AVCOL_SPC_UNSPECIFIED] = "unknown", @@ -1824,7 +1824,7 @@ static const char *color_space_names[] = { [AVCOL_SPC_SMPTE2085] = "smpte2085", }; -static const char *chroma_location_names[] = { +static const char * const chroma_location_names[] = { [AVCHROMA_LOC_UNSPECIFIED] = "unspecified", [AVCHROMA_LOC_LEFT] = "left", [AVCHROMA_LOC_CENTER] = "center", diff --git a/libavutil/stereo3d.c b/libavutil/stereo3d.c index 0d72609cd0..5dc902e909 100644 --- a/libavutil/stereo3d.c +++ b/libavutil/stereo3d.c @@ -43,7 +43,7 @@ AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame) return (AVStereo3D *)side_data->data; } -static const char *stereo3d_type_names[] = { +static const char * const stereo3d_type_names[] = { [AV_STEREO3D_2D] = "2D", [AV_STEREO3D_SIDEBYSIDE] = "side by side", [AV_STEREO3D_TOPBOTTOM] = "top and bottom",