[FFmpeg-devel] [PATCH] avfilter: Add max stats to PSNR log

Lucas Cooper bobobo at google.com
Tue Jul 19 20:49:20 EEST 2016


This allows retroactive aggregation of the PSNR statistics (e.g.
calculating average PSNR for entire video or a segment of the video).
---
 libavfilter/vf_psnr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
index 89acd3c..f3dff62 100644
--- a/libavfilter/vf_psnr.c
+++ b/libavfilter/vf_psnr.c
@@ -180,6 +180,11 @@ static AVFrame *do_psnr(AVFilterContext *ctx, AVFrame *main,
             fprintf(s->stats_file, "psnr_%c:%0.2f ", s->comps[j],
                     get_psnr(comp_mse[c], 1, s->max[c]));
         }
+        fprintf(s->stats_file, "max_avg:%d ", s->average_max);
+        for (j = 0; j < s->nb_components; j++) {
+            c = s->is_rgb ? s->rgba_map[j] : j;
+            fprintf(s->stats_file, "max_%c:%d ", s->comps[j], s->max[c]);
+        }
         fprintf(s->stats_file, "\n");
     }
 
-- 
2.8.0.rc3.226.g39d4020



More information about the ffmpeg-devel mailing list