Revision bd4110f9 libavcodec/mpc7.c

View differences:

libavcodec/mpc7.c
40 40

  
41 41
static VLC scfi_vlc, dscf_vlc, hdr_vlc, quant_vlc[MPC7_QUANT_VLC_TABLES][2];
42 42

  
43
static uint16_t quant_offsets[MPC7_QUANT_VLC_TABLES*2 + 1] =
44
{
45
       0, 512, 1024, 1536, 2052, 2564, 3076, 3588, 4100, 4612, 5124,
46
       5636, 6164, 6676, 7224
47
};
48

  
49

  
43 50
static av_cold int mpc7_decode_init(AVCodecContext * avctx)
44 51
{
45 52
    int i, j;
......
48 55
    uint8_t buf[16];
49 56
    static int vlc_initialized = 0;
50 57

  
58
    static VLC_TYPE scfi_table[1 << MPC7_SCFI_BITS][2];
59
    static VLC_TYPE dscf_table[1 << MPC7_DSCF_BITS][2];
60
    static VLC_TYPE hdr_table[1 << MPC7_HDR_BITS][2];
61
    static VLC_TYPE quant_tables[7224][2];
62

  
51 63
    if(avctx->extradata_size < 16){
52 64
        av_log(avctx, AV_LOG_ERROR, "Too small extradata size (%i)!\n", avctx->extradata_size);
53 65
        return -1;
......
75 87

  
76 88
    if(vlc_initialized) return 0;
77 89
    av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n");
90
    scfi_vlc.table = scfi_table;
91
    scfi_vlc.table_allocated = 1 << MPC7_SCFI_BITS;
78 92
    if(init_vlc(&scfi_vlc, MPC7_SCFI_BITS, MPC7_SCFI_SIZE,
79 93
                &mpc7_scfi[1], 2, 1,
80
                &mpc7_scfi[0], 2, 1, INIT_VLC_USE_STATIC)){
94
                &mpc7_scfi[0], 2, 1, INIT_VLC_USE_NEW_STATIC)){
81 95
        av_log(avctx, AV_LOG_ERROR, "Cannot init SCFI VLC\n");
82 96
        return -1;
83 97
    }
98
    dscf_vlc.table = dscf_table;
99
    dscf_vlc.table_allocated = 1 << MPC7_DSCF_BITS;
84 100
    if(init_vlc(&dscf_vlc, MPC7_DSCF_BITS, MPC7_DSCF_SIZE,
85 101
                &mpc7_dscf[1], 2, 1,
86
                &mpc7_dscf[0], 2, 1, INIT_VLC_USE_STATIC)){
102
                &mpc7_dscf[0], 2, 1, INIT_VLC_USE_NEW_STATIC)){
87 103
        av_log(avctx, AV_LOG_ERROR, "Cannot init DSCF VLC\n");
88 104
        return -1;
89 105
    }
106
    hdr_vlc.table = hdr_table;
107
    hdr_vlc.table_allocated = 1 << MPC7_HDR_BITS;
90 108
    if(init_vlc(&hdr_vlc, MPC7_HDR_BITS, MPC7_HDR_SIZE,
91 109
                &mpc7_hdr[1], 2, 1,
92
                &mpc7_hdr[0], 2, 1, INIT_VLC_USE_STATIC)){
110
                &mpc7_hdr[0], 2, 1, INIT_VLC_USE_NEW_STATIC)){
93 111
        av_log(avctx, AV_LOG_ERROR, "Cannot init HDR VLC\n");
94 112
        return -1;
95 113
    }
96 114
    for(i = 0; i < MPC7_QUANT_VLC_TABLES; i++){
97 115
        for(j = 0; j < 2; j++){
116
            quant_vlc[i][j].table = &quant_tables[quant_offsets[i*2 + j]];
117
            quant_vlc[i][j].table_allocated = quant_offsets[i*2 + j + 1] - quant_offsets[i*2 + j];
98 118
            if(init_vlc(&quant_vlc[i][j], 9, mpc7_quant_vlc_sizes[i],
99 119
                        &mpc7_quant_vlc[i][j][1], 4, 2,
100
                        &mpc7_quant_vlc[i][j][0], 4, 2, INIT_VLC_USE_STATIC)){
120
                        &mpc7_quant_vlc[i][j][0], 4, 2, INIT_VLC_USE_NEW_STATIC)){
101 121
                av_log(avctx, AV_LOG_ERROR, "Cannot init QUANT VLC %i,%i\n",i,j);
102 122
                return -1;
103 123
            }

Also available in: Unified diff