diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2005-04-18 20:07:48 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-04-18 20:07:48 +0000 |
commit | e91f4bf1606801d53c33234d0f5ff3a7138a6f3f (patch) | |
tree | a819add24a1a32ad7e51264e65bb13ab7af7a8f4 /libavcodec | |
parent | 5bb8a0daa1bd660fd70261eaf2bba44f7aab1cd5 (diff) | |
download | ffmpeg-e91f4bf1606801d53c33234d0f5ff3a7138a6f3f.tar.gz |
avoid UPDATE_CACHE() in GET_RL_VLC() if not needed
Originally committed as revision 4137 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/bitstream.h | 8 | ||||
-rw-r--r-- | libavcodec/h263.c | 6 | ||||
-rw-r--r-- | libavcodec/mdec.c | 2 | ||||
-rw-r--r-- | libavcodec/mpeg12.c | 12 | ||||
-rw-r--r-- | libavcodec/msmpeg4.c | 6 |
5 files changed, 18 insertions, 16 deletions
diff --git a/libavcodec/bitstream.h b/libavcodec/bitstream.h index 93e1e4fca2..fd69915d8f 100644 --- a/libavcodec/bitstream.h +++ b/libavcodec/bitstream.h @@ -727,7 +727,7 @@ void free_vlc(VLC *vlc); SKIP_BITS(name, gb, n)\ } -#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth)\ +#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)\ {\ int n, index, nb_bits;\ \ @@ -736,8 +736,10 @@ void free_vlc(VLC *vlc); n = table[index].len;\ \ if(max_depth > 1 && n < 0){\ - LAST_SKIP_BITS(name, gb, bits)\ - UPDATE_CACHE(name, gb)\ + SKIP_BITS(name, gb, bits)\ + if(need_update){\ + UPDATE_CACHE(name, gb)\ + }\ \ nb_bits = -n;\ \ diff --git a/libavcodec/h263.c b/libavcodec/h263.c index 32c1b94b34..81c3648f19 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -4797,7 +4797,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, OPEN_READER(re, &s->gb); for(;;) { UPDATE_CACHE(re, &s->gb); - GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2); + GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 0); if (level==0) { /* escape */ if(rvlc){ @@ -4908,7 +4908,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, #else SKIP_BITS(re, &s->gb, 2); #endif - GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2); + GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1); i+= run + rl->max_run[run>>7][level/qmul] +1; //FIXME opt indexing level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); LAST_SKIP_BITS(re, &s->gb, 1); @@ -4921,7 +4921,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, #else SKIP_BITS(re, &s->gb, 1); #endif - GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2); + GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1); i+= run; level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c index a71f050cde..d6e5d044a0 100644 --- a/libavcodec/mdec.c +++ b/libavcodec/mdec.c @@ -81,7 +81,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, DCTELEM *block, int n) /* now quantify & encode AC coefs */ for(;;) { UPDATE_CACHE(re, &a->gb); - GET_RL_VLC(level, run, re, &a->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2); + GET_RL_VLC(level, run, re, &a->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if(level == 127){ break; diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index be720e2185..78ba9c7bea 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -1507,7 +1507,7 @@ static inline int mpeg1_decode_block_intra(MpegEncContext *s, /* now quantify & encode AC coefs */ for(;;) { UPDATE_CACHE(re, &s->gb); - GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2); + GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if(level == 127){ break; @@ -1583,7 +1583,7 @@ static inline int mpeg1_decode_block_inter(MpegEncContext *s, /* now quantify & encode AC coefs */ for(;;) { UPDATE_CACHE(re, &s->gb); - GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2); + GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if(level == 127){ break; @@ -1656,7 +1656,7 @@ static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, DCTELEM *bloc /* now quantify & encode AC coefs */ for(;;) { UPDATE_CACHE(re, &s->gb); - GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2); + GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if(level == 127){ break; @@ -1737,7 +1737,7 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s, /* now quantify & encode AC coefs */ for(;;) { UPDATE_CACHE(re, &s->gb); - GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2); + GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if(level == 127){ break; @@ -1805,7 +1805,7 @@ static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s, /* now quantify & encode AC coefs */ for(;;) { UPDATE_CACHE(re, &s->gb); - GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2); + GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if(level == 127){ break; @@ -1879,7 +1879,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s, /* now quantify & encode AC coefs */ for(;;) { UPDATE_CACHE(re, &s->gb); - GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2); + GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if(level == 127){ break; diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index cdb536cbdf..b40916b538 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -1731,7 +1731,7 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, OPEN_READER(re, &s->gb); for(;;) { UPDATE_CACHE(re, &s->gb); - GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2); + GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 0); if (level==0) { int cache; cache= GET_CACHE(re, &s->gb); @@ -1829,7 +1829,7 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, #else SKIP_BITS(re, &s->gb, 2); #endif - GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2); + GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1); i+= run + rl->max_run[run>>7][level/qmul] + run_diff; //FIXME opt indexing level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); LAST_SKIP_BITS(re, &s->gb, 1); @@ -1848,7 +1848,7 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, #else SKIP_BITS(re, &s->gb, 1); #endif - GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2); + GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1); i+= run; level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); |