- Added PSNR feature to libavcodec and ffmpeg. By now just Y PSNR until I'm

sure it works ok. Also it's slow, so use it only when you _really_ need to
measure quality.
- Fix libavcodec Makefile to enable profiling.

Originally committed as revision 314 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Juanjo
2002-02-26 22:14:27 +00:00
parent 2b9ab1d54a
commit 43f1708f8b
7 changed files with 76 additions and 8 deletions

View File

@@ -98,6 +98,7 @@ static char *str_comment = NULL;
static int do_benchmark = 0;
static int do_hex_dump = 0;
static int do_play = 0;
static int do_psnr = 0;
typedef struct AVOutputStream {
int file_index; /* file index */
@@ -958,6 +959,8 @@ static int av_encode(AVFormatContext **output_files,
frame_number = ist->frame_number;
sprintf(buf + strlen(buf), "frame=%5d q=%2d ",
frame_number, enc->quality);
if (do_psnr)
sprintf(buf + strlen(buf), "PSNR=%6.2f ", enc->psnr_y);
vid = 1;
}
/* compute min pts value */
@@ -1006,6 +1009,8 @@ static int av_encode(AVFormatContext **output_files,
frame_number = ist->frame_number;
sprintf(buf + strlen(buf), "frame=%5d q=%2d ",
frame_number, enc->quality);
if (do_psnr)
sprintf(buf + strlen(buf), "PSNR=%6.2f ", enc->psnr_y);
vid = 1;
}
/* compute min pts value */
@@ -1618,6 +1623,10 @@ void opt_output_file(const char *filename)
video_enc->flags |= CODEC_FLAG_QSCALE;
video_enc->quality = video_qscale;
}
if (do_psnr)
video_enc->get_psnr = 1;
else
video_enc->get_psnr = 0;
/* XXX: need to find a way to set codec parameters */
if (oc->format == &ppm_format ||
oc->format == &ppmpipe_format) {
@@ -1960,6 +1969,7 @@ const OptionDef options[] = {
"add timings for benchmarking" },
{ "hex", OPT_BOOL | OPT_EXPERT, {(void*)&do_hex_dump},
"dump each input packet" },
{ "psnr", OPT_BOOL | OPT_EXPERT, {(void*)&do_psnr}, "calculate PSNR of compressed frames" },
{ NULL, },
};