Mercurial > libavcodec.hg
comparison msmpeg4.c @ 774:baa66649df35 libavcodec
mergeing inter & intra rl_length tables (50% smaller & no meassureable difference in filesize/quality)
author | michaelni |
---|---|
date | Sun, 27 Oct 2002 12:20:58 +0000 |
parents | ab67f85da840 |
children | f3c369b8ddca |
comparison
equal
deleted
inserted
replaced
773:ab67f85da840 | 774:baa66649df35 |
---|---|
72 int frame_count = 0; | 72 int frame_count = 0; |
73 #endif | 73 #endif |
74 | 74 |
75 #include "msmpeg4data.h" | 75 #include "msmpeg4data.h" |
76 | 76 |
77 static UINT8 rl_length[2][NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2]; | 77 static UINT8 rl_length[NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2]; |
78 | 78 |
79 #ifdef STATS | 79 #ifdef STATS |
80 | 80 |
81 const char *st_names[ST_NB] = { | 81 const char *st_names[ST_NB] = { |
82 "unknown", | 82 "unknown", |
232 for(level=0; level<=MAX_LEVEL; level++){ | 232 for(level=0; level<=MAX_LEVEL; level++){ |
233 int run; | 233 int run; |
234 for(run=0; run<=MAX_RUN; run++){ | 234 for(run=0; run<=MAX_RUN; run++){ |
235 int last; | 235 int last; |
236 for(last=0; last<2; last++){ | 236 for(last=0; last<2; last++){ |
237 rl_length[0][i][level][run][last]= get_size_of_code(s, &rl_table[ i], last, run, level,0); | 237 rl_length[i][level][run][last]= get_size_of_code(s, &rl_table[ i], last, run, level, 0); |
238 rl_length[1][i][level][run][last]= get_size_of_code(s, &rl_table[ i], last, run, level,1); | |
239 } | 238 } |
240 } | 239 } |
241 } | 240 } |
242 } | 241 } |
243 } | 242 } |
308 int inter_count = s->ac_stats[0][0][level][run][last] + s->ac_stats[0][1][level][run][last]; | 307 int inter_count = s->ac_stats[0][0][level][run][last] + s->ac_stats[0][1][level][run][last]; |
309 int intra_luma_count = s->ac_stats[1][0][level][run][last]; | 308 int intra_luma_count = s->ac_stats[1][0][level][run][last]; |
310 int intra_chroma_count= s->ac_stats[1][1][level][run][last]; | 309 int intra_chroma_count= s->ac_stats[1][1][level][run][last]; |
311 | 310 |
312 if(s->pict_type==I_TYPE){ | 311 if(s->pict_type==I_TYPE){ |
313 size += intra_luma_count *rl_length[1][i ][level][run][last]; | 312 size += intra_luma_count *rl_length[i ][level][run][last]; |
314 chroma_size+= intra_chroma_count*rl_length[1][i+3][level][run][last]; | 313 chroma_size+= intra_chroma_count*rl_length[i+3][level][run][last]; |
315 }else{ | 314 }else{ |
316 size+= intra_luma_count *rl_length[1][i ][level][run][last] | 315 size+= intra_luma_count *rl_length[i ][level][run][last] |
317 +intra_chroma_count*rl_length[1][i+3][level][run][last] | 316 +intra_chroma_count*rl_length[i+3][level][run][last] |
318 +inter_count *rl_length[0][i+3][level][run][last]; | 317 +inter_count *rl_length[i+3][level][run][last]; |
319 } | 318 } |
320 } | 319 } |
321 if(last_size == size+chroma_size) break; | 320 if(last_size == size+chroma_size) break; |
322 } | 321 } |
323 } | 322 } |