Mark read-only tables as static

pull/221/head
Diego Biurrun 9 years ago
parent 1f1ad8ace0
commit 5afb94c817
  1. 2
      libavcodec/dnxhdenc.c
  2. 2
      libavcodec/hevc.c
  3. 2
      libavcodec/mdec.c
  4. 6
      libavcodec/opus_silk.c
  5. 6
      libavcodec/texturedspenc.c
  6. 2
      libavcodec/vp8.c
  7. 2
      libavdevice/vfwcap.c
  8. 4
      libavfilter/vf_overlay.c
  9. 3
      libavformat/hls.c
  10. 2
      libavformat/matroskadec.c
  11. 8
      libavformat/movenc.c
  12. 2
      libavformat/mp3dec.c
  13. 2
      libavformat/rdt.c
  14. 2
      libavformat/smoothstreamingenc.c
  15. 6
      libavformat/spdifenc.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);

@ -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;

@ -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]);

@ -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]);

@ -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) {

@ -1131,7 +1131,7 @@ 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",
static const char *vp7_feature_name[] = { "q-index",
"lf-delta",
"partial-golden-update",
"blit-pitch" };

@ -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;

@ -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);

@ -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;

@ -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];
}

@ -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 };

@ -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]);

@ -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,

@ -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
};

@ -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));

Loading…
Cancel
Save