summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2015-11-11 17:38:43 +0100
committerDiego Biurrun <diego@biurrun.de>2016-05-05 10:48:34 +0200
commit5afb94c817abffad030c6b94d7003dca8aace3d5 (patch)
tree517222058bab9a1b2ba41abd4a38280388dbf57a
parent1f1ad8ace040a08edc2646ff638ca42a8828779f (diff)
Mark read-only tables as static
-rw-r--r--libavcodec/dnxhdenc.c2
-rw-r--r--libavcodec/hevc.c2
-rw-r--r--libavcodec/mdec.c2
-rw-r--r--libavcodec/opus_silk.c6
-rw-r--r--libavcodec/texturedspenc.c6
-rw-r--r--libavcodec/vp8.c8
-rw-r--r--libavdevice/vfwcap.c2
-rw-r--r--libavfilter/vf_overlay.c4
-rw-r--r--libavformat/hls.c3
-rw-r--r--libavformat/matroskadec.c2
-rw-r--r--libavformat/movenc.c8
-rw-r--r--libavformat/mp3dec.c2
-rw-r--r--libavformat/rdt.c2
-rw-r--r--libavformat/smoothstreamingenc.c2
-rw-r--r--libavformat/spdifenc.c6
15 files changed, 29 insertions, 28 deletions
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index f3182c97d6..c02b51ebbe 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -398,7 +398,7 @@ fail: // for FF_ALLOCZ_OR_GOTO
static int dnxhd_write_header(AVCodecContext *avctx, uint8_t *buf)
{
DNXHDEncContext *ctx = avctx->priv_data;
- const uint8_t header_prefix[5] = { 0x00, 0x00, 0x02, 0x80, 0x01 };
+ static const uint8_t header_prefix[5] = { 0x00, 0x00, 0x02, 0x80, 0x01 };
memset(buf, 0, 640);
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 3bc730a68e..177cf93ada 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -902,7 +902,7 @@ static void hls_residual_coding(HEVCContext *s, int x0, int y0,
int trafo_size = 1 << log2_trafo_size;
int i, qp, shift, add, scale, scale_m;
- const uint8_t level_scale[] = { 40, 45, 51, 57, 64, 72 };
+ static const uint8_t level_scale[] = { 40, 45, 51, 57, 64, 72 };
const uint8_t *scale_matrix;
uint8_t dc_scale;
diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c
index 39395e2ea9..4b6056e15c 100644
--- a/libavcodec/mdec.c
+++ b/libavcodec/mdec.c
@@ -129,7 +129,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, int16_t *block, int n)
static inline int decode_mb(MDECContext *a, int16_t block[6][64])
{
int i, ret;
- const int block_index[6] = { 5, 4, 0, 1, 2, 3 };
+ static const int block_index[6] = { 5, 4, 0, 1, 2, 3 };
a->bdsp.clear_blocks(block[0]);
diff --git a/libavcodec/opus_silk.c b/libavcodec/opus_silk.c
index 583801d65c..d83fb373c6 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;
- const uint16_t *model[] = {
+ static const uint16_t *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;
- const uint16_t *filter_sel[] = {
+ static const uint16_t *filter_sel[] = {
silk_model_ltp_filter0_sel, silk_model_ltp_filter1_sel,
silk_model_ltp_filter2_sel
};
- const int8_t (*filter_taps[])[5] = {
+ static const int8_t (*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/texturedspenc.c b/libavcodec/texturedspenc.c
index 6fdf9c8c6b..27aaa78d53 100644
--- a/libavcodec/texturedspenc.c
+++ b/libavcodec/texturedspenc.c
@@ -181,7 +181,7 @@ static unsigned int match_colors(const uint8_t *block, ptrdiff_t stride,
int x, y, k = 0;
int c0_point, half_point, c3_point;
uint8_t color[16];
- const int indexMap[8] = {
+ static const int indexMap[8] = {
0 << 30, 2 << 30, 0 << 30, 2 << 30,
3 << 30, 3 << 30, 1 << 30, 1 << 30,
};
@@ -359,8 +359,8 @@ static int refine_colors(const uint8_t *block, ptrdiff_t stride,
/* Additional magic to save a lot of multiplies in the accumulating loop.
* The tables contain precomputed products of weights for least squares
* system, accumulated inside one 32-bit register */
- const int w1tab[4] = { 3, 0, 2, 1 };
- const int prods[4] = { 0x090000, 0x000900, 0x040102, 0x010402 };
+ static const int w1tab[4] = { 3, 0, 2, 1 };
+ static const int prods[4] = { 0x090000, 0x000900, 0x040102, 0x010402 };
/* Check if all pixels have the same index */
if ((mask ^ (mask << 2)) < 4) {
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index d5f8fbb666..cd7f6923fb 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -1131,10 +1131,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;
- const char *vp7_feature_name[] = { "q-index",
- "lf-delta",
- "partial-golden-update",
- "blit-pitch" };
+ static const char *vp7_feature_name[] = { "q-index",
+ "lf-delta",
+ "partial-golden-update",
+ "blit-pitch" };
if (is_vp7) {
int i;
*segment = 0;
diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c
index b0b2086883..9edd2c5f30 100644
--- a/libavdevice/vfwcap.c
+++ b/libavdevice/vfwcap.c
@@ -160,7 +160,7 @@ static void dump_bih(AVFormatContext *s, BITMAPINFOHEADER *bih)
static int shall_we_drop(AVFormatContext *s)
{
struct vfw_ctx *ctx = s->priv_data;
- const uint8_t dropscore[] = {62, 75, 87, 100};
+ static const uint8_t dropscore[4] = { 62, 75, 87, 100 };
const int ndropscores = FF_ARRAY_ELEMS(dropscore);
unsigned int buffer_fullness = (ctx->curbufsize*100)/s->max_picture_buffer;
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index bb7bde6f73..2fa791d001 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -99,8 +99,8 @@ static av_cold void uninit(AVFilterContext *ctx)
static int query_formats(AVFilterContext *ctx)
{
- const enum AVPixelFormat inout_pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE };
- const enum AVPixelFormat blend_pix_fmts[] = { AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE };
+ static const enum AVPixelFormat inout_pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE };
+ static const enum AVPixelFormat blend_pix_fmts[] = { AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE };
AVFilterFormats *inout_formats = ff_make_format_list(inout_pix_fmts);
AVFilterFormats *blend_formats = ff_make_format_list(blend_pix_fmts);
diff --git a/libavformat/hls.c b/libavformat/hls.c
index 8459f12269..3b8e28038d 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -477,7 +477,8 @@ reload:
static int save_avio_options(AVFormatContext *s)
{
HLSContext *c = s->priv_data;
- const char *opts[] = { "headers", "user_agent", NULL }, **opt = opts;
+ static const char *opts[] = { "headers", "user_agent", NULL };
+ const char **opt = opts;
uint8_t *buf;
int ret = 0;
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 978d56db16..ceac4babef 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1809,7 +1809,7 @@ static int matroska_parse_tracks(AVFormatContext *s)
track->codec_priv.size = 0;
} else {
if (codec_id == AV_CODEC_ID_SIPR && flavor < 4) {
- const int sipr_bit_rate[4] = { 6504, 8496, 5000, 16000 };
+ static const int sipr_bit_rate[4] = { 6504, 8496, 5000, 16000 };
track->audio.sub_packet_size = ff_sipr_subpk_size[flavor];
st->codecpar->bit_rate = sipr_bit_rate[flavor];
}
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index f7bbb2f8ed..202c72023c 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2345,7 +2345,7 @@ static int mov_write_isml_manifest(AVIOContext *pb, MOVMuxContext *mov)
{
int64_t pos = avio_tell(pb);
int i;
- const uint8_t uuid[] = {
+ static const uint8_t uuid[] = {
0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
};
@@ -2558,7 +2558,7 @@ static int mov_write_trun_tag(AVIOContext *pb, MOVMuxContext *mov,
static int mov_write_tfxd_tag(AVIOContext *pb, MOVTrack *track)
{
int64_t pos = avio_tell(pb);
- const uint8_t uuid[] = {
+ static const uint8_t uuid[] = {
0x6d, 0x1d, 0x9b, 0x05, 0x42, 0xd5, 0x44, 0xe6,
0x80, 0xe2, 0x14, 0x1d, 0xaf, 0xf7, 0x57, 0xb2
};
@@ -2581,7 +2581,7 @@ static int mov_write_tfrf_tag(AVIOContext *pb, MOVMuxContext *mov,
{
int n = track->nb_frag_info - 1 - entry, i;
int size = 8 + 16 + 4 + 1 + 16*n;
- const uint8_t uuid[] = {
+ static const uint8_t uuid[] = {
0xd4, 0x80, 0x7e, 0xf2, 0xca, 0x39, 0x46, 0x95,
0x8e, 0x54, 0x26, 0xcb, 0x9e, 0x46, 0xa7, 0x9f
};
@@ -3677,7 +3677,7 @@ static int mov_create_chapter_track(AVFormatContext *s, int tracknum)
pkt.duration = end - pkt.dts;
if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {
- const char encd[12] = {
+ static const char encd[12] = {
0x00, 0x00, 0x00, 0x0C,
'e', 'n', 'c', 'd',
0x00, 0x00, 0x01, 0x00 };
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 89fb376a06..0838962e76 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -151,7 +151,7 @@ static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st,
int32_t r_gain = INT32_MIN, a_gain = INT32_MIN;
MP3DecContext *mp3 = s->priv_data;
- const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}};
+ static const int64_t xing_offtbl[2][2] = { { 32, 17 }, { 17, 9 } };
/* Check for Xing / Info tag */
avio_skip(s->pb, xing_offtbl[c->lsf == 1][c->nb_channels == 1]);
diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index a759c7e9a2..eb718cfe81 100644
--- a/libavformat/rdt.c
+++ b/libavformat/rdt.c
@@ -98,7 +98,7 @@ ff_rdt_calc_response_and_checksum(char response[41], char chksum[9],
unsigned char zres[16],
buf[64] = { 0xa1, 0xe9, 0x14, 0x9d, 0x0e, 0x6b, 0x3b, 0x59 };
#define XOR_TABLE_SIZE 37
- const unsigned char xor_table[XOR_TABLE_SIZE] = {
+ static const unsigned char xor_table[XOR_TABLE_SIZE] = {
0x05, 0x18, 0x74, 0xd0, 0x0d, 0x09, 0x02, 0x53,
0xc0, 0x01, 0x05, 0x05, 0x67, 0x03, 0x19, 0x70,
0x08, 0x27, 0x66, 0x10, 0x10, 0x72, 0x08, 0x09,
diff --git a/libavformat/smoothstreamingenc.c b/libavformat/smoothstreamingenc.c
index bf1f8d49d6..065ecc2ee4 100644
--- a/libavformat/smoothstreamingenc.c
+++ b/libavformat/smoothstreamingenc.c
@@ -450,7 +450,7 @@ static int parse_fragment(AVFormatContext *s, const char *filename, int64_t *sta
if (len < 8 || len >= *moof_size)
goto fail;
if (tag == MKTAG('u','u','i','d')) {
- const uint8_t tfxd[] = {
+ static const uint8_t tfxd[] = {
0x6d, 0x1d, 0x9b, 0x05, 0x42, 0xd5, 0x44, 0xe6,
0x80, 0xe2, 0x14, 0x1d, 0xaf, 0xf7, 0x57, 0xb2
};
diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
index 368da03fc6..a19bcab4c9 100644
--- a/libavformat/spdifenc.c
+++ b/libavformat/spdifenc.c
@@ -398,15 +398,15 @@ static int spdif_header_truehd(AVFormatContext *s, AVPacket *pkt)
{
IEC61937Context *ctx = s->priv_data;
int mat_code_length = 0;
- const char mat_end_code[16] = { 0xC3, 0xC2, 0xC0, 0xC4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x97, 0x11 };
+ static const char mat_end_code[16] = { 0xC3, 0xC2, 0xC0, 0xC4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x97, 0x11 };
if (!ctx->hd_buf_count) {
- const char mat_start_code[20] = { 0x07, 0x9E, 0x00, 0x03, 0x84, 0x01, 0x01, 0x01, 0x80, 0x00, 0x56, 0xA5, 0x3B, 0xF4, 0x81, 0x83, 0x49, 0x80, 0x77, 0xE0 };
+ static const char mat_start_code[20] = { 0x07, 0x9E, 0x00, 0x03, 0x84, 0x01, 0x01, 0x01, 0x80, 0x00, 0x56, 0xA5, 0x3B, 0xF4, 0x81, 0x83, 0x49, 0x80, 0x77, 0xE0 };
mat_code_length = sizeof(mat_start_code) + BURST_HEADER_SIZE;
memcpy(ctx->hd_buf, mat_start_code, sizeof(mat_start_code));
} else if (ctx->hd_buf_count == 12) {
- const char mat_middle_code[12] = { 0xC3, 0xC1, 0x42, 0x49, 0x3B, 0xFA, 0x82, 0x83, 0x49, 0x80, 0x77, 0xE0 };
+ static const char mat_middle_code[12] = { 0xC3, 0xC1, 0x42, 0x49, 0x3B, 0xFA, 0x82, 0x83, 0x49, 0x80, 0x77, 0xE0 };
mat_code_length = sizeof(mat_middle_code) + MAT_MIDDLE_CODE_OFFSET;
memcpy(&ctx->hd_buf[12 * TRUEHD_FRAME_OFFSET - BURST_HEADER_SIZE + MAT_MIDDLE_CODE_OFFSET],
mat_middle_code, sizeof(mat_middle_code));