vF_psnr: move set_meta() calls out of loop.
authorRonald S. Bultje <rsbultje@gmail.com>
Sat, 11 Jul 2015 02:47:24 +0000 (22:47 -0400)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 11 Jul 2015 10:48:58 +0000 (12:48 +0200)
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavfilter/vf_psnr.c

index b2c6531..0c2c950 100644 (file)
@@ -173,10 +173,10 @@ static AVFrame *do_psnr(AVFilterContext *ctx, AVFrame *main,
     for (j = 0; j < s->nb_components; j++) {
         c = s->is_rgb ? s->rgba_map[j] : j;
         set_meta(metadata, "lavfi.psnr.mse.", s->comps[j], comp_mse[c]);
-        set_meta(metadata, "lavfi.psnr.mse_avg", 0, mse);
         set_meta(metadata, "lavfi.psnr.psnr.", s->comps[j], get_psnr(comp_mse[c], 1, s->max[c]));
-        set_meta(metadata, "lavfi.psnr.psnr_avg", 0, get_psnr(mse, 1, s->average_max));
     }
+    set_meta(metadata, "lavfi.psnr.mse_avg", 0, mse);
+    set_meta(metadata, "lavfi.psnr.psnr_avg", 0, get_psnr(mse, 1, s->average_max));
 
     if (s->stats_file) {
         fprintf(s->stats_file, "n:%"PRId64" mse_avg:%0.2f ", s->nb_frames, mse);