# HG changeset patch # User aurel # Date 1184087862 0 # Node ID c6bc608d265998c756cc8e8c25cbf325915244c8 # Parent 101f20612a9432133f769d21376fe3e4ffe0fcaa move init_vlc_rl from h263.c to mpegvideo.c diff -r 101f20612a94 -r c6bc608d2659 h263.c --- a/h263.c Tue Jul 10 14:37:33 2007 +0000 +++ b/h263.c Tue Jul 10 17:17:42 2007 +0000 @@ -2889,59 +2889,6 @@ static VLC h263_mbtype_b_vlc; static VLC cbpc_b_vlc; -void init_vlc_rl(RLTable *rl, int use_static) -{ - int i, q; - - /* Return if static table is already initialized */ - if(use_static && rl->rl_vlc[0]) - return; - - init_vlc(&rl->vlc, 9, rl->n + 1, - &rl->table_vlc[0][1], 4, 2, - &rl->table_vlc[0][0], 4, 2, use_static); - - - for(q=0; q<32; q++){ - int qmul= q*2; - int qadd= (q-1)|1; - - if(q==0){ - qmul=1; - qadd=0; - } - if(use_static) - rl->rl_vlc[q]= av_mallocz_static(rl->vlc.table_size*sizeof(RL_VLC_ELEM)); - else - rl->rl_vlc[q]= av_malloc(rl->vlc.table_size*sizeof(RL_VLC_ELEM)); - for(i=0; ivlc.table_size; i++){ - int code= rl->vlc.table[i][0]; - int len = rl->vlc.table[i][1]; - int level, run; - - if(len==0){ // illegal code - run= 66; - level= MAX_LEVEL; - }else if(len<0){ //more bits needed - run= 0; - level= code; - }else{ - if(code==rl->n){ //esc - run= 66; - level= 0; - }else{ - run= rl->table_run [code] + 1; - level= rl->table_level[code] * qmul + qadd; - if(code >= rl->last) run+=192; - } - } - rl->rl_vlc[q][i].len= len; - rl->rl_vlc[q][i].level= level; - rl->rl_vlc[q][i].run= run; - } - } -} - /* init vlcs */ /* XXX: find a better solution to handle static init */ diff -r 101f20612a94 -r c6bc608d2659 mpegvideo.c --- a/mpegvideo.c Tue Jul 10 14:37:33 2007 +0000 +++ b/mpegvideo.c Tue Jul 10 17:17:42 2007 +0000 @@ -742,6 +742,59 @@ } } +void init_vlc_rl(RLTable *rl, int use_static) +{ + int i, q; + + /* Return if static table is already initialized */ + if(use_static && rl->rl_vlc[0]) + return; + + init_vlc(&rl->vlc, 9, rl->n + 1, + &rl->table_vlc[0][1], 4, 2, + &rl->table_vlc[0][0], 4, 2, use_static); + + + for(q=0; q<32; q++){ + int qmul= q*2; + int qadd= (q-1)|1; + + if(q==0){ + qmul=1; + qadd=0; + } + if(use_static) + rl->rl_vlc[q]= av_mallocz_static(rl->vlc.table_size*sizeof(RL_VLC_ELEM)); + else + rl->rl_vlc[q]= av_malloc(rl->vlc.table_size*sizeof(RL_VLC_ELEM)); + for(i=0; ivlc.table_size; i++){ + int code= rl->vlc.table[i][0]; + int len = rl->vlc.table[i][1]; + int level, run; + + if(len==0){ // illegal code + run= 66; + level= MAX_LEVEL; + }else if(len<0){ //more bits needed + run= 0; + level= code; + }else{ + if(code==rl->n){ //esc + run= 66; + level= 0; + }else{ + run= rl->table_run [code] + 1; + level= rl->table_level[code] * qmul + qadd; + if(code >= rl->last) run+=192; + } + } + rl->rl_vlc[q][i].len= len; + rl->rl_vlc[q][i].level= level; + rl->rl_vlc[q][i].run= run; + } + } +} + /* draw the edges of width 'w' of an image of size width, height */ //FIXME check that this is ok for mpeg4 interlaced static void draw_edges_c(uint8_t *buf, int wrap, int width, int height, int w)