Mercurial > libavcodec.hg
comparison mpegvideo.c @ 6940:778ecab25dd8 libavcodec
Change init_vlc_rl() so it does not use *alloc_static() anymore.
author | michael |
---|---|
date | Fri, 30 May 2008 21:08:41 +0000 |
parents | 8f656b589911 |
children | 3f819263176e |
comparison
equal
deleted
inserted
replaced
6939:213852a36370 | 6940:778ecab25dd8 |
---|---|
720 rl->index_run[last] = av_malloc(MAX_RUN + 1); | 720 rl->index_run[last] = av_malloc(MAX_RUN + 1); |
721 memcpy(rl->index_run[last], index_run, MAX_RUN + 1); | 721 memcpy(rl->index_run[last], index_run, MAX_RUN + 1); |
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 int i, q; | 727 int i, q; |
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 | 728 |
738 for(q=0; q<32; q++){ | 729 for(q=0; q<32; q++){ |
739 int qmul= q*2; | 730 int qmul= q*2; |
740 int qadd= (q-1)|1; | 731 int qadd= (q-1)|1; |
741 | 732 |
742 if(q==0){ | 733 if(q==0){ |
743 qmul=1; | 734 qmul=1; |
744 qadd=0; | 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 for(i=0; i<rl->vlc.table_size; i++){ | 737 for(i=0; i<rl->vlc.table_size; i++){ |
751 int code= rl->vlc.table[i][0]; | 738 int code= rl->vlc.table[i][0]; |
752 int len = rl->vlc.table[i][1]; | 739 int len = rl->vlc.table[i][1]; |
753 int level, run; | 740 int level, run; |
754 | 741 |