From a7702890bd470fc1683578609b7e1c5a2acfcd94 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 9 Jul 2006 10:33:49 +0000 Subject: [PATCH] remove STATS code (probably hasnt been used for years ..., and its not completely clear what it was good for anyway) Originally committed as revision 5689 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/bitstream.h | 3 -- libavcodec/mpegvideo.c | 4 --- libavcodec/msmpeg4.c | 78 ------------------------------------------ libavcodec/wmv2.c | 3 -- libavformat/gif.c | 3 -- libavutil/common.h | 24 ------------- 6 files changed, 115 deletions(-) diff --git a/libavcodec/bitstream.h b/libavcodec/bitstream.h index 265e934734..10db64d338 100644 --- a/libavcodec/bitstream.h +++ b/libavcodec/bitstream.h @@ -177,9 +177,6 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value) unsigned int bit_buf; int bit_left; -#ifdef STATS - st_out_bit_counts[st_current_index] += n; -#endif // printf("put_bits=%d %x\n", n, value); assert(n == 32 || value < (1U << n)); diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 6393cc91fe..6f5a37b90a 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1371,10 +1371,6 @@ int MPV_encode_end(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; -#ifdef STATS - print_stats(); -#endif - ff_rate_control_uninit(s); MPV_common_end(s); diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c index 9790494baa..6d83f5c6c5 100644 --- a/libavcodec/msmpeg4.c +++ b/libavcodec/msmpeg4.c @@ -89,70 +89,6 @@ int frame_count = 0; static uint8_t rl_length[NB_RL_TABLES][MAX_LEVEL+1][MAX_RUN+1][2]; #endif //CONFIG_ENCODERS -#ifdef STATS - -const char *st_names[ST_NB] = { - "unknown", - "dc", - "intra_ac", - "inter_ac", - "intra_mb", - "inter_mb", - "mv", -}; - -int st_current_index = 0; -unsigned int st_bit_counts[ST_NB]; -unsigned int st_out_bit_counts[ST_NB]; - -#define set_stat(var) st_current_index = var; - -void print_stats(void) -{ - unsigned int total; - int i; - - printf("Input:\n"); - total = 0; - for(i=0;imv_table_index]; code = mv->table_mv_index[(mx << 6) | my]; - set_stat(ST_MV); put_bits(&s->pb, mv->table_mv_bits[code], mv->table_mv_code[code]); @@ -545,7 +480,6 @@ void msmpeg4_encode_mb(MpegEncContext * s, if (!s->mb_intra) { /* compute cbp */ - set_stat(ST_INTER_MB); cbp = 0; for (i = 0; i < 6; i++) { if (s->block_last_index[i] >= 0) @@ -636,7 +570,6 @@ void msmpeg4_encode_mb(MpegEncContext * s, cbpy_tab[cbp>>2][0]); }else{ if (s->pict_type == I_TYPE) { - set_stat(ST_INTRA_MB); put_bits(&s->pb, ff_msmp4_mb_i_table[coded_cbp][1], ff_msmp4_mb_i_table[coded_cbp][0]); } else { @@ -646,7 +579,6 @@ void msmpeg4_encode_mb(MpegEncContext * s, table_mb_non_intra[cbp][1], table_mb_non_intra[cbp][0]); } - set_stat(ST_INTRA_MB); put_bits(&s->pb, 1, 0); /* no AC prediction yet */ if(s->inter_intra_pred){ s->h263_aic_dir=0; @@ -924,7 +856,6 @@ static inline void msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int const uint8_t *scantable; if (s->mb_intra) { - set_stat(ST_DC); msmpeg4_encode_dc(s, block[0], n, &dc_pred_dir); i = 1; if (n < 4) { @@ -934,7 +865,6 @@ static inline void msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int } run_diff = 0; scantable= s->intra_scantable.permutated; - set_stat(ST_INTRA_AC); } else { i = 0; rl = &rl_table[3 + s->rl_table_index]; @@ -943,7 +873,6 @@ static inline void msmpeg4_encode_block(MpegEncContext * s, DCTELEM * block, int else run_diff = 1; scantable= s->inter_scantable.permutated; - set_stat(ST_INTER_AC); } /* recalculate block_last_index for M$ wmv1 */ @@ -1572,7 +1501,6 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) uint32_t * const mb_type_ptr= &s->current_picture.mb_type[ s->mb_x + s->mb_y*s->mb_stride ]; if (s->pict_type == P_TYPE) { - set_stat(ST_INTER_MB); if (s->use_skip_mb_code) { if (get_bits1(&s->gb)) { /* skip mb */ @@ -1598,7 +1526,6 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) cbp = code & 0x3f; } else { - set_stat(ST_INTRA_MB); s->mb_intra = 1; code = get_vlc2(&s->gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2); if (code < 0) @@ -1623,7 +1550,6 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) s->rl_table_index = decode012(&s->gb); s->rl_chroma_table_index = s->rl_table_index; } - set_stat(ST_MV); h263_pred_motion(s, 0, 0, &mx, &my); if (msmpeg4_decode_motion(s, &mx, &my) < 0) return -1; @@ -1634,7 +1560,6 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, DCTELEM block[6][64]) *mb_type_ptr = MB_TYPE_L0 | MB_TYPE_16x16; } else { //printf("I at %d %d %d %06X\n", s->mb_x, s->mb_y, ((cbp&3)? 1 : 0) +((cbp&0x3C)? 2 : 0), show_bits(&s->gb, 24)); - set_stat(ST_INTRA_MB); s->ac_pred = get_bits1(&s->gb); *mb_type_ptr = MB_TYPE_INTRA; if(s->inter_intra_pred){ @@ -1673,7 +1598,6 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, qadd=0; /* DC coef */ - set_stat(ST_DC); level = msmpeg4_decode_dc(s, n, &dc_pred_dir); if (level < 0){ @@ -1709,7 +1633,6 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, } else { scan_table = s->intra_scantable.permutated; } - set_stat(ST_INTRA_AC); rl_vlc= rl->rl_vlc[0]; } else { qmul = s->qscale << 1; @@ -1728,7 +1651,6 @@ static inline int msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, } if(!scan_table) scan_table = s->inter_scantable.permutated; - set_stat(ST_INTER_AC); rl_vlc= rl->rl_vlc[s->qscale]; } { diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c index dd88b7d286..3f405af4f9 100644 --- a/libavcodec/wmv2.c +++ b/libavcodec/wmv2.c @@ -207,7 +207,6 @@ void ff_wmv2_encode_mb(MpegEncContext * s, if (!s->mb_intra) { /* compute cbp */ - set_stat(ST_INTER_MB); cbp = 0; for (i = 0; i < 6; i++) { if (s->block_last_index[i] >= 0) @@ -244,7 +243,6 @@ void ff_wmv2_encode_mb(MpegEncContext * s, #endif if (s->pict_type == I_TYPE) { - set_stat(ST_INTRA_MB); put_bits(&s->pb, ff_msmp4_mb_i_table[coded_cbp][1], ff_msmp4_mb_i_table[coded_cbp][0]); } else { @@ -252,7 +250,6 @@ void ff_wmv2_encode_mb(MpegEncContext * s, wmv2_inter_table[w->cbp_table_index][cbp][1], wmv2_inter_table[w->cbp_table_index][cbp][0]); } - set_stat(ST_INTRA_MB); put_bits(&s->pb, 1, 0); /* no AC prediction yet */ if(s->inter_intra_pred){ s->h263_aic_dir=0; diff --git a/libavformat/gif.c b/libavformat/gif.c index f81a70def5..c82d174f1a 100644 --- a/libavformat/gif.c +++ b/libavformat/gif.c @@ -113,9 +113,6 @@ static void gif_put_bits_rev(PutBitContext *s, int n, unsigned int value) unsigned int bit_buf; int bit_cnt; -#ifdef STATS - st_out_bit_counts[st_current_index] += n; -#endif // printf("put_bits=%d %x\n", n, value); assert(n == 32 || value < (1U << n)); diff --git a/libavutil/common.h b/libavutil/common.h index ffded89a4c..5318d3cb42 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -339,30 +339,6 @@ extern const uint32_t inverse[256]; # define FASTDIV(a,b) ((a)/(b)) #endif -/* define it to include statistics code (useful only for optimizing - codec efficiency */ -//#define STATS - -#ifdef STATS - -enum { - ST_UNKNOWN, - ST_DC, - ST_INTRA_AC, - ST_INTER_AC, - ST_INTRA_MB, - ST_INTER_MB, - ST_MV, - ST_NB, -}; - -extern int st_current_index; -extern unsigned int st_bit_counts[ST_NB]; -extern unsigned int st_out_bit_counts[ST_NB]; - -void print_stats(void); -#endif - /* misc math functions */ extern FF_IMPORT_ATTR const uint8_t ff_log2_tab[256];