Revision ceaaf78b

View differences:

libavcodec/h261dec.c
66 66
                 &h261_cbp_tab[0][1], 2, 1,
67 67
                 &h261_cbp_tab[0][0], 2, 1, 1);
68 68
        init_rl(&h261_rl_tcoeff, ff_h261_rl_table_store);
69
        init_vlc_rl(&h261_rl_tcoeff, 1);
69
        INIT_VLC_RL(h261_rl_tcoeff, 552);
70 70
    }
71 71
}
72 72

  
libavcodec/h263.c
2924 2924
        init_rl(&rvlc_rl_inter, static_rl_table_store[3]);
2925 2925
        init_rl(&rvlc_rl_intra, static_rl_table_store[4]);
2926 2926
        init_rl(&rl_intra_aic, static_rl_table_store[2]);
2927
        init_vlc_rl(&rl_inter, 1);
2928
        init_vlc_rl(&rl_intra, 1);
2929
        init_vlc_rl(&rvlc_rl_inter, 1);
2930
        init_vlc_rl(&rvlc_rl_intra, 1);
2931
        init_vlc_rl(&rl_intra_aic, 1);
2927
        INIT_VLC_RL(rl_inter, 554);
2928
        INIT_VLC_RL(rl_intra, 554);
2929
        INIT_VLC_RL(rvlc_rl_inter, 1072);
2930
        INIT_VLC_RL(rvlc_rl_intra, 1072);
2931
        INIT_VLC_RL(rl_intra_aic, 554);
2932 2932
        init_vlc(&dc_lum, DC_VLC_BITS, 10 /* 13 */,
2933 2933
                 &DCtab_lum[0][1], 2, 1,
2934 2934
                 &DCtab_lum[0][0], 2, 1, 1);
libavcodec/mpegvideo.c
722 722
    }
723 723
}
724 724

  
725
void init_vlc_rl(RLTable *rl, int use_static)
725
void init_vlc_rl(RLTable *rl)
726 726
{
727 727
    int i, q;
728 728

  
729
    /* Return if static table is already initialized */
730
    if(use_static && rl->rl_vlc[0])
731
        return;
732

  
733
    init_vlc(&rl->vlc, 9, rl->n + 1,
734
             &rl->table_vlc[0][1], 4, 2,
735
             &rl->table_vlc[0][0], 4, 2, use_static);
736

  
737

  
738 729
    for(q=0; q<32; q++){
739 730
        int qmul= q*2;
740 731
        int qadd= (q-1)|1;
......
743 734
            qmul=1;
744 735
            qadd=0;
745 736
        }
746
        if(use_static)
747
            rl->rl_vlc[q]= av_mallocz_static(rl->vlc.table_size*sizeof(RL_VLC_ELEM));
748
        else
749
            rl->rl_vlc[q]= av_malloc(rl->vlc.table_size*sizeof(RL_VLC_ELEM));
750 737
        for(i=0; i<rl->vlc.table_size; i++){
751 738
            int code= rl->vlc.table[i][0];
752 739
            int len = rl->vlc.table[i][1];
libavcodec/msmpeg4.c
1063 1063

  
1064 1064
        for(i=0;i<NB_RL_TABLES;i++) {
1065 1065
            init_rl(&rl_table[i], static_rl_table_store[i]);
1066
            init_vlc_rl(&rl_table[i], 1);
1067 1066
        }
1067
        INIT_VLC_RL(rl_table[0], 642);
1068
        INIT_VLC_RL(rl_table[1], 1104);
1069
        INIT_VLC_RL(rl_table[2], 554);
1070
        INIT_VLC_RL(rl_table[3], 940);
1071
        INIT_VLC_RL(rl_table[4], 962);
1072
        INIT_VLC_RL(rl_table[5], 554);
1068 1073
        for(i=0;i<2;i++) {
1069 1074
            mv = &mv_tables[i];
1070 1075
            init_vlc(&mv->vlc, MV_VLC_BITS, mv->n + 1,
libavcodec/rl.h
54 54
 *                     the level and run tables, if this is NULL av_malloc() will be used
55 55
 */
56 56
void init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3]);
57
void init_vlc_rl(RLTable *rl, int use_static);
57
void init_vlc_rl(RLTable *rl);
58

  
59
#define INIT_VLC_RL(rl, static_size)\
60
{\
61
    int q;\
62
    static RL_VLC_ELEM rl_vlc_table[32][static_size];\
63
    INIT_VLC_STATIC(&rl.vlc, 9, rl.n + 1,\
64
             &rl.table_vlc[0][1], 4, 2,\
65
             &rl.table_vlc[0][0], 4, 2, static_size);\
66
\
67
    if(!rl.rl_vlc[0]){\
68
        for(q=0; q<32; q++)\
69
            rl.rl_vlc[q]= rl_vlc_table[q];\
70
\
71
        init_vlc_rl(&rl);\
72
    }\
73
}
58 74

  
59 75
static inline int get_rl_index(const RLTable *rl, int last, int run, int level)
60 76
{

Also available in: Unified diff