Revision 350120d2

View differences:

libavcodec/aac_tablegen.c
31 31

  
32 32
    write_fileheader();
33 33

  
34
    printf("const float ff_aac_pow2sf_tab[428] = {\n");
35
    write_float_array(ff_aac_pow2sf_tab, 428);
36
    printf("};\n");
34
    WRITE_ARRAY("const", float, ff_aac_pow2sf_tab);
37 35

  
38 36
    return 0;
39 37
}
libavcodec/cbrt_tablegen.c
31 31

  
32 32
    write_fileheader();
33 33

  
34
    printf("static const uint32_t cbrt_tab[1<<13] = {\n");
35
    write_uint32_t_array(cbrt_tab, 1 << 13);
36
    printf("};\n");
34
    WRITE_ARRAY("static const", uint32_t, cbrt_tab);
37 35

  
38 36
    return 0;
39 37
}
libavcodec/mpegaudio_tablegen.c
31 31

  
32 32
    write_fileheader();
33 33

  
34
    printf("static const int8_t table_4_3_exp[TABLE_4_3_SIZE] = {\n");
35
    write_int8_t_array(table_4_3_exp, TABLE_4_3_SIZE);
36
    printf("};\n");
37

  
38
    printf("static const uint32_t table_4_3_value[TABLE_4_3_SIZE] = {\n");
39
    write_uint32_t_array(table_4_3_value, TABLE_4_3_SIZE);
40
    printf("};\n");
41

  
42
    printf("static const uint32_t exp_table[512] = {\n");
43
    write_uint32_t_array(exp_table, 512);
44
    printf("};\n");
45

  
46
    printf("static const float exp_table_float[512] = {\n");
47
    write_float_array(exp_table_float, 512);
48
    printf("};\n");
49

  
50
    printf("static const uint32_t expval_table[512][16] = {\n");
51
    write_uint32_t_2d_array(expval_table, 512, 16);
52
    printf("};\n");
53

  
54
    printf("static const float expval_table_float[512][16] = {\n");
55
    write_float_2d_array(expval_table_float, 512, 16);
56
    printf("};\n");
34
    WRITE_ARRAY("static const", int8_t, table_4_3_exp);
35
    WRITE_ARRAY("static const", uint32_t, table_4_3_value);
36
    WRITE_ARRAY("static const", uint32_t, exp_table);
37
    WRITE_ARRAY("static const", float, exp_table_float);
38
    WRITE_2D_ARRAY("static const", uint32_t, expval_table);
39
    WRITE_2D_ARRAY("static const", float, expval_table_float);
57 40

  
58 41
    return 0;
59 42
}
libavcodec/pcm_tablegen.c
32 32

  
33 33
    write_fileheader();
34 34

  
35
    printf("static const uint8_t linear_to_alaw[1 << 14] = {\n");
36
    write_uint8_t_array(linear_to_alaw, 1 << 14);
37
    printf("};\n");
38

  
39
    printf("static const uint8_t linear_to_ulaw[1 << 14] = {\n");
40
    write_uint8_t_array(linear_to_ulaw, 1 << 14);
41
    printf("};\n");
35
    WRITE_ARRAY("static const", uint8_t, linear_to_alaw);
36
    WRITE_ARRAY("static const", uint8_t, linear_to_ulaw);
42 37

  
43 38
    return 0;
44 39
}
libavcodec/qdm2_tablegen.c
33 33

  
34 34
    write_fileheader();
35 35

  
36
    printf("static const uint16_t softclip_table[HARDCLIP_THRESHOLD - SOFTCLIP_THRESHOLD + 1] = {\n");
37
    write_uint16_t_array(softclip_table, HARDCLIP_THRESHOLD - SOFTCLIP_THRESHOLD + 1);
38
    printf("};\n");
36
    WRITE_ARRAY("static const", uint16_t, softclip_table);
37
    WRITE_ARRAY("static const", float, noise_table);
38
    WRITE_ARRAY("static const", float, noise_samples);
39 39

  
40
    printf("static const float noise_table[4096] = {\n");
41
    write_float_array(noise_table, 4096);
42
    printf("};\n");
43

  
44
    printf("static const uint8_t random_dequant_index[256][5] = {\n");
45
    write_uint8_t_2d_array(random_dequant_index, 256, 5);
46
    printf("};\n");
47

  
48
    printf("static const uint8_t random_dequant_type24[128][3] = {\n");
49
    write_uint8_t_2d_array(random_dequant_type24, 128, 3);
50
    printf("};\n");
51

  
52
    printf("static const float noise_samples[128] = {\n");
53
    write_float_array(noise_samples, 128);
54
    printf("};\n");
40
    WRITE_2D_ARRAY("static const", uint8_t, random_dequant_index);
41
    WRITE_2D_ARRAY("static const", uint8_t, random_dequant_type24);
55 42

  
56 43
    return 0;
57 44
}
libavcodec/tableprint.h
25 25

  
26 26
#include <stdint.h>
27 27
#include <stdio.h>
28
#include "libavutil/common.h"
28 29

  
29 30
#define WRITE_1D_FUNC_ARGV(type, linebrk, fmtstr, ...)\
30 31
void write_##type##_array(const type *data, int len)\
......
72 73
/** Write a standard file header */
73 74
void write_fileheader(void);
74 75

  
76
#define WRITE_ARRAY(prefix, type, name)                 \
77
    do {                                                \
78
        const size_t array_size = FF_ARRAY_ELEMS(name); \
79
        printf(prefix" "#type" "#name"[%zu] = {\n",     \
80
               array_size);                             \
81
        write_##type##_array(name, array_size);         \
82
        printf("};\n");                                 \
83
    } while(0)
84

  
85
#define WRITE_2D_ARRAY(prefix, type, name)                              \
86
    do {                                                                \
87
        const size_t array_size1 = FF_ARRAY_ELEMS(name);                \
88
        const size_t array_size2 = FF_ARRAY_ELEMS(name[0]);             \
89
        printf(prefix" "#type" "#name"[%zu][%zu] = {\n",                \
90
               array_size1, array_size2 );                              \
91
        write_##type##_2d_array(name, array_size1, array_size2);        \
92
        printf("};\n");                                                 \
93
    } while(0)
94

  
75 95
#endif /* AVCODEC_TABLEPRINT_H */

Also available in: Unified diff