vd_lavc: remove -lavdopts vstats suboption

This printed per-frame statistics into a file, like bitrate or frame
type. Not very useful and accesses obscure AVCodecContext fields
(danger of deprecation/breakage), so get rid of it.
This commit is contained in:
wm4 2013-01-13 23:05:48 +01:00
parent 8e172afc8f
commit 4056765643
4 changed files with 0 additions and 100 deletions

View File

@ -1041,8 +1041,6 @@
:2: Visualize forward predicted MVs of B-frames. :2: Visualize forward predicted MVs of B-frames.
:4: Visualize backward predicted MVs of B-frames. :4: Visualize backward predicted MVs of B-frames.
vstats
Prints some statistics and stores them in ``./vstats_*.log``.
--lavfdopts=<option1:option2:...> --lavfdopts=<option1:option2:...>
Specify parameters for libavformat demuxers (``--demuxer=lavf``). Separate Specify parameters for libavformat demuxers (``--demuxer=lavf``). Separate

View File

@ -135,7 +135,6 @@ typedef struct MPOpts {
int error_resilience; int error_resilience;
int error_concealment; int error_concealment;
int gray; int gray;
int vstats;
int idct_algo; int idct_algo;
int debug; int debug;
int vismv; int vismv;

View File

@ -16,9 +16,6 @@ typedef struct ffmpeg_ctx {
int do_hw_dr1, do_dr1; int do_hw_dr1, do_dr1;
int vo_initialized; int vo_initialized;
int best_csp; int best_csp;
int qp_stat[32];
double qp_sum;
double inv_qp_sum;
AVRational last_sample_aspect_ratio; AVRational last_sample_aspect_ratio;
enum AVDiscard skip_frame; enum AVDiscard skip_frame;
AVCodec *software_fallback; AVCodec *software_fallback;

View File

@ -84,7 +84,6 @@ const m_option_t lavc_decode_opts_conf[] = {
OPT_FLAG_ON("gray", lavc_param.gray, 0), OPT_FLAG_ON("gray", lavc_param.gray, 0),
OPT_INTRANGE("idct", lavc_param.idct_algo, 0, 0, 99), OPT_INTRANGE("idct", lavc_param.idct_algo, 0, 0, 99),
OPT_INTRANGE("ec", lavc_param.error_concealment, 0, 0, 99), OPT_INTRANGE("ec", lavc_param.error_concealment, 0, 0, 99),
OPT_FLAG_ON("vstats", lavc_param.vstats, 0),
OPT_INTRANGE("debug", lavc_param.debug, 0, 0, 9999999), OPT_INTRANGE("debug", lavc_param.debug, 0, 0, 9999999),
OPT_INTRANGE("vismv", lavc_param.vismv, 0, 0, 9999999), OPT_INTRANGE("vismv", lavc_param.vismv, 0, 0, 9999999),
OPT_INTRANGE("st", lavc_param.skip_top, 0, 0, 999), OPT_INTRANGE("st", lavc_param.skip_top, 0, 0, 999),
@ -143,87 +142,6 @@ static struct hwdec *find_hwcodec(enum hwdec_type api, const char *codec)
return NULL; return NULL;
} }
// print debugging stats into a file
static void print_vstats(sh_video_t *sh, int len)
{
vd_ffmpeg_ctx *ctx = sh->context;
AVCodecContext *avctx = ctx->avctx;
struct lavc_param *lavc_param = &sh->opts->lavc_param;
if (!lavc_param->vstats)
return;
static FILE *fvstats = NULL;
char filename[20];
static long long int all_len = 0;
static int frame_number = 0;
static double all_frametime = 0.0;
AVFrame *pic = avctx->coded_frame;
double quality = 0.0;
if (!pic)
return;
if (!fvstats) {
time_t today2;
struct tm *today;
today2 = time(NULL);
today = localtime(&today2);
sprintf(filename, "vstats_%02d%02d%02d.log", today->tm_hour,
today->tm_min, today->tm_sec);
fvstats = fopen(filename, "w");
if (!fvstats) {
perror("fopen");
lavc_param->vstats = 0; // disable block
return;
/*exit(1);*/
}
}
// average MB quantizer
{
int x, y;
int w = ((avctx->width) + 15) >> 4;
int h = ((avctx->height) + 15) >> 4;
int8_t *q = pic->qscale_table;
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++)
quality += (double)*(q + x);
q += pic->qstride;
}
quality /= w * h;
}
all_len += len;
all_frametime += sh->frametime;
fprintf(fvstats, "frame= %5d q= %2.2f f_size= %6d s_size= %8.0fkB ",
++frame_number, quality, len, (double)all_len / 1024);
fprintf(fvstats, "time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
all_frametime, (double)(len * 8) / sh->frametime / 1000.0,
(double)(all_len * 8) / all_frametime / 1000.0);
switch (pic->pict_type) {
case AV_PICTURE_TYPE_I:
fprintf(fvstats, "type= I\n");
break;
case AV_PICTURE_TYPE_P:
fprintf(fvstats, "type= P\n");
break;
case AV_PICTURE_TYPE_S:
fprintf(fvstats, "type= S\n");
break;
case AV_PICTURE_TYPE_B:
fprintf(fvstats, "type= B\n");
break;
default:
fprintf(fvstats, "type= ? (%d)\n", pic->pict_type);
break;
}
ctx->qp_stat[(int)(quality + 0.5)]++;
ctx->qp_sum += quality;
ctx->inv_qp_sum += 1.0 / (double)quality;
}
static enum AVDiscard str2AVDiscard(char *str) static enum AVDiscard str2AVDiscard(char *str)
{ {
if (!str) return AVDISCARD_DEFAULT; if (!str) return AVDISCARD_DEFAULT;
@ -478,16 +396,6 @@ static void uninit(sh_video_t *sh)
vd_ffmpeg_ctx *ctx = sh->context; vd_ffmpeg_ctx *ctx = sh->context;
AVCodecContext *avctx = ctx->avctx; AVCodecContext *avctx = ctx->avctx;
if (avctx && sh->opts->lavc_param.vstats && avctx->coded_frame) {
for (int i = 1; i < 32; i++)
mp_msg(MSGT_DECVIDEO, MSGL_INFO,
"QP: %d, count: %d\n", i, ctx->qp_stat[i]);
mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "[VD_FFMPEG] Arithmetic mean of QP: "
"%2.4f, Harmonic mean of QP: %2.4f\n",
ctx->qp_sum / avctx->coded_frame->coded_picture_number,
1.0 / (ctx->inv_qp_sum / avctx->coded_frame->coded_picture_number));
}
uninit_avctx(sh); uninit_avctx(sh);
talloc_free(ctx); talloc_free(ctx);
} }
@ -682,8 +590,6 @@ static int decode(struct sh_video *sh, struct demux_packet *packet, void *data,
} }
*reordered_pts = (union pts){.i = pic->reordered_opaque}.d; *reordered_pts = (union pts){.i = pic->reordered_opaque}.d;
print_vstats(sh, len);
if (!got_picture) if (!got_picture)
return 0; // skipped image return 0; // skipped image