From 060f89b3283b5a00fad483f5da4e967531ef9324 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 27 Oct 2002 12:20:58 +0000 Subject: mergeing inter & intra rl_length tables (50% smaller & no meassureable difference in filesize/quality) Originally committed as revision 1078 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/msmpeg4.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'libavcodec/msmpeg4.c') diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index 19d672627e..81dc91fbb4 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -74,7 +74,7 @@ int frame_count = 0; #include "msmpeg4data.h" -static UINT8 rl_length[2][NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2]; +static UINT8 rl_length[NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2]; #ifdef STATS @@ -234,8 +234,7 @@ void ff_msmpeg4_encode_init(MpegEncContext *s) for(run=0; run<=MAX_RUN; run++){ int last; for(last=0; last<2; last++){ - rl_length[0][i][level][run][last]= get_size_of_code(s, &rl_table[ i], last, run, level,0); - rl_length[1][i][level][run][last]= get_size_of_code(s, &rl_table[ i], last, run, level,1); + rl_length[i][level][run][last]= get_size_of_code(s, &rl_table[ i], last, run, level, 0); } } } @@ -310,12 +309,12 @@ static void find_best_tables(MpegEncContext * s) int intra_chroma_count= s->ac_stats[1][1][level][run][last]; if(s->pict_type==I_TYPE){ - size += intra_luma_count *rl_length[1][i ][level][run][last]; - chroma_size+= intra_chroma_count*rl_length[1][i+3][level][run][last]; + size += intra_luma_count *rl_length[i ][level][run][last]; + chroma_size+= intra_chroma_count*rl_length[i+3][level][run][last]; }else{ - size+= intra_luma_count *rl_length[1][i ][level][run][last] - +intra_chroma_count*rl_length[1][i+3][level][run][last] - +inter_count *rl_length[0][i+3][level][run][last]; + size+= intra_luma_count *rl_length[i ][level][run][last] + +intra_chroma_count*rl_length[i+3][level][run][last] + +inter_count *rl_length[i+3][level][run][last]; } } if(last_size == size+chroma_size) break; -- cgit v1.2.3