diff options
author | Juanjo <pulento@users.sourceforge.net> | 2002-02-26 22:14:27 +0000 |
---|---|---|
committer | Juanjo <pulento@users.sourceforge.net> | 2002-02-26 22:14:27 +0000 |
commit | 43f1708f8bb400790b226993ab1e6c3d12564d3b (patch) | |
tree | cb98d6f57b9964653dfc407897d0081429d572f2 /ffmpeg.c | |
parent | 2b9ab1d54a35f7d689b2396cfc59f9dbdcae391f (diff) | |
download | ffmpeg-43f1708f8bb400790b226993ab1e6c3d12564d3b.tar.gz |
- 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
Diffstat (limited to 'ffmpeg.c')
-rw-r--r-- | ffmpeg.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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, }, }; |