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
pull/126/head
Michael Niedermayer 19 years ago
parent fdb5983285
commit a7702890bd
  1. 3
      libavcodec/bitstream.h
  2. 4
      libavcodec/mpegvideo.c
  3. 78
      libavcodec/msmpeg4.c
  4. 3
      libavcodec/wmv2.c
  5. 3
      libavformat/gif.c
  6. 24
      libavutil/common.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));

@ -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);

@ -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;i<ST_NB;i++)
total += st_bit_counts[i];
if (total == 0)
total = 1;
for(i=0;i<ST_NB;i++) {
printf("%-10s : %10.1f %5.1f%%\n",
st_names[i],
(double)st_bit_counts[i] / 8.0,
(double)st_bit_counts[i] * 100.0 / total);
}
printf("%-10s : %10.1f %5.1f%%\n",
"total",
(double)total / 8.0,
100.0);
printf("Output:\n");
total = 0;
for(i=0;i<ST_NB;i++)
total += st_out_bit_counts[i];
if (total == 0)
total = 1;
for(i=0;i<ST_NB;i++) {
printf("%-10s : %10.1f %5.1f%%\n",
st_names[i],
(double)st_out_bit_counts[i] / 8.0,
(double)st_out_bit_counts[i] * 100.0 / total);
}
printf("%-10s : %10.1f %5.1f%%\n",
"total",
(double)total / 8.0,
100.0);
}
#else
#define set_stat(var)
#endif
static void common_init(MpegEncContext * s)
{
static int inited=0;
@ -509,7 +445,6 @@ static void msmpeg4_encode_motion(MpegEncContext * s,
mv = &mv_tables[s->mv_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];
}
{

@ -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;

@ -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));

@ -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];

Loading…
Cancel
Save