[FFmpeg-devel] [PATCH] Add max value output option to psnr stats log.

Michael Niedermayer michael at niedermayer.cc
Wed Aug 17 19:09:43 EEST 2016


On Thu, Aug 11, 2016 at 10:44:12AM -0700, Lucas Cooper wrote:
> This allows retroactive calculation/aggregation of PSNR from the stats
> log.
> ---
>  libavfilter/vf_psnr.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
> index 3bec747..de5cc8f 100644
> --- a/libavfilter/vf_psnr.c
> +++ b/libavfilter/vf_psnr.c
> @@ -45,6 +45,7 @@ typedef struct PSNRContext {
>      char *stats_file_str;
>      int stats_version;
>      int stats_header_written;
> +    int stats_add_max;
>      int max[4], average_max;
>      int is_rgb;
>      uint8_t rgba_map[4];
> @@ -63,6 +64,7 @@ static const AVOption psnr_options[] = {
>      {"stats_file", "Set file where to store per-frame difference information", OFFSET(stats_file_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
>      {"f",          "Set file where to store per-frame difference information", OFFSET(stats_file_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS },
>      {"stats_version", "Set the format version for the stats file.",               OFFSET(stats_version),  AV_OPT_TYPE_INT,    {.i64=1},    1, 2, FLAGS },
> +    {"output_max",  "Add raw stats (max values) to the output log.",            OFFSET(stats_add_max), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
>      { NULL }
>  };
>  

> @@ -182,6 +184,12 @@ static AVFrame *do_psnr(AVFilterContext *ctx, AVFrame *main,
>              for (j = 0; j < s->nb_components; j++) {
>                  fprintf(s->stats_file, ",psnr_%c", s->comps[j]);
>              }
> +            if (s->stats_add_max) {
> +              fprintf(s->stats_file, ",max_avg");
> +              for (j = 0; j < s->nb_components; j++) {
> +                  fprintf(s->stats_file, ",max_%c", s->comps[j]);
> +              }
> +            }
>              fprintf(s->stats_file, "\n");
>              s->stats_header_written = 1;

newly added code should follow the same style as existing code
and indention depth is 4 throughout ffmpeg


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160817/d83ca96d/attachment.sig>


More information about the ffmpeg-devel mailing list