Commit c80c8430 authored by michael's avatar michael

avoid UPDATE_CACHE() in GET_RL_VLC() if not needed


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@4137 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 84b4de89
...@@ -727,7 +727,7 @@ void free_vlc(VLC *vlc); ...@@ -727,7 +727,7 @@ void free_vlc(VLC *vlc);
SKIP_BITS(name, gb, n)\ 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;\ int n, index, nb_bits;\
\ \
...@@ -736,8 +736,10 @@ void free_vlc(VLC *vlc); ...@@ -736,8 +736,10 @@ void free_vlc(VLC *vlc);
n = table[index].len;\ n = table[index].len;\
\ \
if(max_depth > 1 && n < 0){\ if(max_depth > 1 && n < 0){\
LAST_SKIP_BITS(name, gb, bits)\ SKIP_BITS(name, gb, bits)\
UPDATE_CACHE(name, gb)\ if(need_update){\
UPDATE_CACHE(name, gb)\
}\
\ \
nb_bits = -n;\ nb_bits = -n;\
\ \
......
...@@ -4797,7 +4797,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, ...@@ -4797,7 +4797,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
OPEN_READER(re, &s->gb); OPEN_READER(re, &s->gb);
for(;;) { for(;;) {
UPDATE_CACHE(re, &s->gb); 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) { if (level==0) {
/* escape */ /* escape */
if(rvlc){ if(rvlc){
...@@ -4908,7 +4908,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block, ...@@ -4908,7 +4908,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
#else #else
SKIP_BITS(re, &s->gb, 2); SKIP_BITS(re, &s->gb, 2);
#endif #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 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); level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(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, ...@@ -4921,7 +4921,7 @@ static inline int mpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
#else #else
SKIP_BITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
#endif #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; i+= run;
level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing 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); level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
......
...@@ -81,7 +81,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, DCTELEM *block, int n) ...@@ -81,7 +81,7 @@ static inline int mdec_decode_block_intra(MDECContext *a, DCTELEM *block, int n)
/* now quantify & encode AC coefs */ /* now quantify & encode AC coefs */
for(;;) { for(;;) {
UPDATE_CACHE(re, &a->gb); 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){ if(level == 127){
break; break;
......
...@@ -1507,7 +1507,7 @@ static inline int mpeg1_decode_block_intra(MpegEncContext *s, ...@@ -1507,7 +1507,7 @@ static inline int mpeg1_decode_block_intra(MpegEncContext *s,
/* now quantify & encode AC coefs */ /* now quantify & encode AC coefs */
for(;;) { for(;;) {
UPDATE_CACHE(re, &s->gb); 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){ if(level == 127){
break; break;
...@@ -1583,7 +1583,7 @@ static inline int mpeg1_decode_block_inter(MpegEncContext *s, ...@@ -1583,7 +1583,7 @@ static inline int mpeg1_decode_block_inter(MpegEncContext *s,
/* now quantify & encode AC coefs */ /* now quantify & encode AC coefs */
for(;;) { for(;;) {
UPDATE_CACHE(re, &s->gb); 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){ if(level == 127){
break; break;
...@@ -1656,7 +1656,7 @@ static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, DCTELEM *bloc ...@@ -1656,7 +1656,7 @@ static inline int mpeg1_fast_decode_block_inter(MpegEncContext *s, DCTELEM *bloc
/* now quantify & encode AC coefs */ /* now quantify & encode AC coefs */
for(;;) { for(;;) {
UPDATE_CACHE(re, &s->gb); 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){ if(level == 127){
break; break;
...@@ -1737,7 +1737,7 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s, ...@@ -1737,7 +1737,7 @@ static inline int mpeg2_decode_block_non_intra(MpegEncContext *s,
/* now quantify & encode AC coefs */ /* now quantify & encode AC coefs */
for(;;) { for(;;) {
UPDATE_CACHE(re, &s->gb); 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){ if(level == 127){
break; break;
...@@ -1805,7 +1805,7 @@ static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s, ...@@ -1805,7 +1805,7 @@ static inline int mpeg2_fast_decode_block_non_intra(MpegEncContext *s,
/* now quantify & encode AC coefs */ /* now quantify & encode AC coefs */
for(;;) { for(;;) {
UPDATE_CACHE(re, &s->gb); 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){ if(level == 127){
break; break;
...@@ -1879,7 +1879,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s, ...@@ -1879,7 +1879,7 @@ static inline int mpeg2_decode_block_intra(MpegEncContext *s,
/* now quantify & encode AC coefs */ /* now quantify & encode AC coefs */
for(;;) { for(;;) {
UPDATE_CACHE(re, &s->gb); 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){ if(level == 127){
break; break;
......
...@@ -1731,7 +1731,7 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, ...@@ -1731,7 +1731,7 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
OPEN_READER(re, &s->gb); OPEN_READER(re, &s->gb);
for(;;) { for(;;) {
UPDATE_CACHE(re, &s->gb); 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) { if (level==0) {
int cache; int cache;
cache= GET_CACHE(re, &s->gb); cache= GET_CACHE(re, &s->gb);
...@@ -1829,7 +1829,7 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, ...@@ -1829,7 +1829,7 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
#else #else
SKIP_BITS(re, &s->gb, 2); SKIP_BITS(re, &s->gb, 2);
#endif #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 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); level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
LAST_SKIP_BITS(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, ...@@ -1848,7 +1848,7 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block,
#else #else
SKIP_BITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1);
#endif #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; i+= run;
level = level + rl->max_level[run>>7][(run-1)&63] * qmul;//FIXME opt indexing 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); level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment