2013-07-06 02:21:12 +02:00
|
|
|
/*
|
2015-07-30 03:28:09 +02:00
|
|
|
* Copyright (c) 2011 Roger Pau Monné <roger.pau@entel.upc.edu>
|
2013-07-06 02:21:12 +02:00
|
|
|
* Copyright (c) 2011 Stefano Sabatini
|
|
|
|
* Copyright (c) 2013 Paul B Mahol
|
|
|
|
*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Caculate the PSNR between two input videos.
|
|
|
|
*/
|
|
|
|
|
2015-07-11 03:42:26 +02:00
|
|
|
#include "libavutil/avstring.h"
|
2013-07-06 02:21:12 +02:00
|
|
|
#include "libavutil/opt.h"
|
|
|
|
#include "libavutil/pixdesc.h"
|
|
|
|
#include "avfilter.h"
|
|
|
|
#include "dualinput.h"
|
|
|
|
#include "drawutils.h"
|
|
|
|
#include "formats.h"
|
|
|
|
#include "internal.h"
|
2015-07-12 12:44:39 +02:00
|
|
|
#include "psnr.h"
|
2013-07-06 02:21:12 +02:00
|
|
|
#include "video.h"
|
|
|
|
|
|
|
|
typedef struct PSNRContext {
|
|
|
|
const AVClass *class;
|
|
|
|
FFDualInputContext dinput;
|
2015-07-11 03:42:26 +02:00
|
|
|
double mse, min_mse, max_mse, mse_comp[4];
|
2013-07-06 02:21:12 +02:00
|
|
|
uint64_t nb_frames;
|
|
|
|
FILE *stats_file;
|
|
|
|
char *stats_file_str;
|
|
|
|
int max[4], average_max;
|
|
|
|
int is_rgb;
|
|
|
|
uint8_t rgba_map[4];
|
|
|
|
char comps[4];
|
2013-09-08 12:53:55 +02:00
|
|
|
int nb_components;
|
|
|
|
int planewidth[4];
|
|
|
|
int planeheight[4];
|
2015-07-11 03:42:26 +02:00
|
|
|
double planeweight[4];
|
2015-07-12 12:44:39 +02:00
|
|
|
PSNRDSPContext dsp;
|
2013-07-06 02:21:12 +02:00
|
|
|
} PSNRContext;
|
|
|
|
|
|
|
|
#define OFFSET(x) offsetof(PSNRContext, x)
|
|
|
|
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
|
|
|
|
|
|
|
|
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 },
|
2013-09-07 14:13:50 +02:00
|
|
|
{ NULL }
|
2013-07-06 02:21:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
AVFILTER_DEFINE_CLASS(psnr);
|
|
|
|
|
2013-09-08 13:37:07 +02:00
|
|
|
static inline unsigned pow2(unsigned base)
|
2013-07-06 02:21:12 +02:00
|
|
|
{
|
|
|
|
return base*base;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline double get_psnr(double mse, uint64_t nb_frames, int max)
|
|
|
|
{
|
2015-10-29 05:16:34 +01:00
|
|
|
return 10.0 * log10(pow2(max) / (mse / nb_frames));
|
2013-07-06 02:21:12 +02:00
|
|
|
}
|
|
|
|
|
2015-07-12 12:44:39 +02:00
|
|
|
static uint64_t sse_line_8bit(const uint8_t *main_line, const uint8_t *ref_line, int outw)
|
2013-07-06 02:21:12 +02:00
|
|
|
{
|
2015-07-12 12:44:39 +02:00
|
|
|
int j;
|
|
|
|
unsigned m2 = 0;
|
2013-07-06 02:21:12 +02:00
|
|
|
|
2015-07-12 12:44:39 +02:00
|
|
|
for (j = 0; j < outw; j++)
|
|
|
|
m2 += pow2(main_line[j] - ref_line[j]);
|
2013-07-06 02:21:12 +02:00
|
|
|
|
2015-07-12 12:44:39 +02:00
|
|
|
return m2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint64_t sse_line_16bit(const uint8_t *_main_line, const uint8_t *_ref_line, int outw)
|
|
|
|
{
|
|
|
|
int j;
|
|
|
|
uint64_t m2 = 0;
|
|
|
|
const uint16_t *main_line = (const uint16_t *) _main_line;
|
|
|
|
const uint16_t *ref_line = (const uint16_t *) _ref_line;
|
|
|
|
|
|
|
|
for (j = 0; j < outw; j++)
|
|
|
|
m2 += pow2(main_line[j] - ref_line[j]);
|
|
|
|
|
|
|
|
return m2;
|
2013-09-08 13:37:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
2015-07-12 12:44:39 +02:00
|
|
|
void compute_images_mse(PSNRContext *s,
|
2013-09-08 13:37:07 +02:00
|
|
|
const uint8_t *main_data[4], const int main_linesizes[4],
|
|
|
|
const uint8_t *ref_data[4], const int ref_linesizes[4],
|
|
|
|
int w, int h, double mse[4])
|
|
|
|
{
|
2015-07-12 12:44:39 +02:00
|
|
|
int i, c;
|
2013-09-08 13:37:07 +02:00
|
|
|
|
|
|
|
for (c = 0; c < s->nb_components; c++) {
|
|
|
|
const int outw = s->planewidth[c];
|
|
|
|
const int outh = s->planeheight[c];
|
2015-07-12 12:44:39 +02:00
|
|
|
const uint8_t *main_line = main_data[c];
|
|
|
|
const uint8_t *ref_line = ref_data[c];
|
|
|
|
const int ref_linesize = ref_linesizes[c];
|
|
|
|
const int main_linesize = main_linesizes[c];
|
2013-09-08 13:37:07 +02:00
|
|
|
uint64_t m = 0;
|
|
|
|
for (i = 0; i < outh; i++) {
|
2015-07-12 12:44:39 +02:00
|
|
|
m += s->dsp.sse_line(main_line, ref_line, outw);
|
2013-09-08 13:37:07 +02:00
|
|
|
ref_line += ref_linesize;
|
|
|
|
main_line += main_linesize;
|
|
|
|
}
|
|
|
|
mse[c] = m / (double)(outw * outh);
|
2013-07-06 02:21:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-08 22:13:14 +02:00
|
|
|
static void set_meta(AVDictionary **metadata, const char *key, char comp, float d)
|
|
|
|
{
|
|
|
|
char value[128];
|
|
|
|
snprintf(value, sizeof(value), "%0.2f", d);
|
|
|
|
if (comp) {
|
|
|
|
char key2[128];
|
|
|
|
snprintf(key2, sizeof(key2), "%s%c", key, comp);
|
|
|
|
av_dict_set(metadata, key2, value, 0);
|
|
|
|
} else {
|
|
|
|
av_dict_set(metadata, key, value, 0);
|
|
|
|
}
|
|
|
|
}
|
2013-07-06 02:21:12 +02:00
|
|
|
|
|
|
|
static AVFrame *do_psnr(AVFilterContext *ctx, AVFrame *main,
|
|
|
|
const AVFrame *ref)
|
|
|
|
{
|
|
|
|
PSNRContext *s = ctx->priv;
|
|
|
|
double comp_mse[4], mse = 0;
|
|
|
|
int j, c;
|
|
|
|
AVDictionary **metadata = avpriv_frame_get_metadatap(main);
|
|
|
|
|
2015-07-12 12:44:39 +02:00
|
|
|
compute_images_mse(s, (const uint8_t **)main->data, main->linesize,
|
|
|
|
(const uint8_t **)ref->data, ref->linesize,
|
|
|
|
main->width, main->height, comp_mse);
|
2013-07-06 02:21:12 +02:00
|
|
|
|
2013-09-08 12:53:55 +02:00
|
|
|
for (j = 0; j < s->nb_components; j++)
|
2015-07-11 03:42:26 +02:00
|
|
|
mse += comp_mse[j] * s->planeweight[j];
|
2013-07-06 02:21:12 +02:00
|
|
|
|
|
|
|
s->min_mse = FFMIN(s->min_mse, mse);
|
|
|
|
s->max_mse = FFMAX(s->max_mse, mse);
|
|
|
|
|
|
|
|
s->mse += mse;
|
2015-07-11 03:42:26 +02:00
|
|
|
for (j = 0; j < s->nb_components; j++)
|
|
|
|
s->mse_comp[j] += comp_mse[j];
|
2013-07-06 02:21:12 +02:00
|
|
|
s->nb_frames++;
|
|
|
|
|
2013-09-08 12:53:55 +02:00
|
|
|
for (j = 0; j < s->nb_components; j++) {
|
2013-07-06 02:21:12 +02:00
|
|
|
c = s->is_rgb ? s->rgba_map[j] : j;
|
2013-07-08 22:13:14 +02:00
|
|
|
set_meta(metadata, "lavfi.psnr.mse.", s->comps[j], comp_mse[c]);
|
2013-07-09 11:38:47 +02:00
|
|
|
set_meta(metadata, "lavfi.psnr.psnr.", s->comps[j], get_psnr(comp_mse[c], 1, s->max[c]));
|
2013-07-06 02:21:12 +02:00
|
|
|
}
|
2015-07-11 04:47:24 +02:00
|
|
|
set_meta(metadata, "lavfi.psnr.mse_avg", 0, mse);
|
|
|
|
set_meta(metadata, "lavfi.psnr.psnr_avg", 0, get_psnr(mse, 1, s->average_max));
|
2013-07-06 02:21:12 +02:00
|
|
|
|
|
|
|
if (s->stats_file) {
|
|
|
|
fprintf(s->stats_file, "n:%"PRId64" mse_avg:%0.2f ", s->nb_frames, mse);
|
2013-09-08 12:53:55 +02:00
|
|
|
for (j = 0; j < s->nb_components; j++) {
|
2013-07-06 02:21:12 +02:00
|
|
|
c = s->is_rgb ? s->rgba_map[j] : j;
|
|
|
|
fprintf(s->stats_file, "mse_%c:%0.2f ", s->comps[j], comp_mse[c]);
|
|
|
|
}
|
2015-08-05 13:30:16 +02:00
|
|
|
fprintf(s->stats_file, "psnr_avg:%0.2f ", get_psnr(mse, 1, s->average_max));
|
2013-09-08 12:53:55 +02:00
|
|
|
for (j = 0; j < s->nb_components; j++) {
|
2013-07-06 02:21:12 +02:00
|
|
|
c = s->is_rgb ? s->rgba_map[j] : j;
|
2013-07-09 11:38:47 +02:00
|
|
|
fprintf(s->stats_file, "psnr_%c:%0.2f ", s->comps[j],
|
2013-07-06 02:21:12 +02:00
|
|
|
get_psnr(comp_mse[c], 1, s->max[c]));
|
|
|
|
}
|
|
|
|
fprintf(s->stats_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
return main;
|
|
|
|
}
|
|
|
|
|
|
|
|
static av_cold int init(AVFilterContext *ctx)
|
|
|
|
{
|
|
|
|
PSNRContext *s = ctx->priv;
|
|
|
|
|
|
|
|
s->min_mse = +INFINITY;
|
|
|
|
s->max_mse = -INFINITY;
|
|
|
|
|
2015-10-23 00:00:40 +02:00
|
|
|
if (s->stats_file_str) {
|
|
|
|
if (!strcmp(s->stats_file_str, "-")) {
|
|
|
|
s->stats_file = stdout;
|
|
|
|
} else {
|
|
|
|
s->stats_file = fopen(s->stats_file_str, "w");
|
|
|
|
if (!s->stats_file) {
|
|
|
|
int err = AVERROR(errno);
|
|
|
|
char buf[128];
|
|
|
|
av_strerror(err, buf, sizeof(buf));
|
|
|
|
av_log(ctx, AV_LOG_ERROR, "Could not open stats file %s: %s\n",
|
|
|
|
s->stats_file_str, buf);
|
|
|
|
return err;
|
|
|
|
}
|
2013-07-06 02:21:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s->dinput.process = do_psnr;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int query_formats(AVFilterContext *ctx)
|
|
|
|
{
|
2015-03-18 01:18:40 +01:00
|
|
|
static const enum AVPixelFormat pix_fmts[] = {
|
2013-09-08 13:37:07 +02:00
|
|
|
AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY16,
|
|
|
|
#define PF_NOALPHA(suf) AV_PIX_FMT_YUV420##suf, AV_PIX_FMT_YUV422##suf, AV_PIX_FMT_YUV444##suf
|
|
|
|
#define PF_ALPHA(suf) AV_PIX_FMT_YUVA420##suf, AV_PIX_FMT_YUVA422##suf, AV_PIX_FMT_YUVA444##suf
|
|
|
|
#define PF(suf) PF_NOALPHA(suf), PF_ALPHA(suf)
|
|
|
|
PF(P), PF(P9), PF(P10), PF_NOALPHA(P12), PF_NOALPHA(P14), PF(P16),
|
|
|
|
AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P,
|
|
|
|
AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,
|
|
|
|
AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P,
|
|
|
|
AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10,
|
|
|
|
AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,
|
|
|
|
AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP16,
|
2013-07-06 02:21:12 +02:00
|
|
|
AV_PIX_FMT_NONE
|
|
|
|
};
|
|
|
|
|
2015-04-03 19:55:18 +02:00
|
|
|
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
|
|
|
|
if (!fmts_list)
|
|
|
|
return AVERROR(ENOMEM);
|
|
|
|
return ff_set_common_formats(ctx, fmts_list);
|
2013-07-06 02:21:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int config_input_ref(AVFilterLink *inlink)
|
|
|
|
{
|
2013-09-08 12:53:55 +02:00
|
|
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
|
2013-07-06 02:21:12 +02:00
|
|
|
AVFilterContext *ctx = inlink->dst;
|
|
|
|
PSNRContext *s = ctx->priv;
|
2015-07-11 03:42:26 +02:00
|
|
|
unsigned sum;
|
2013-07-06 02:21:12 +02:00
|
|
|
int j;
|
|
|
|
|
2013-09-08 12:53:55 +02:00
|
|
|
s->nb_components = desc->nb_components;
|
2013-07-06 02:21:12 +02:00
|
|
|
if (ctx->inputs[0]->w != ctx->inputs[1]->w ||
|
|
|
|
ctx->inputs[0]->h != ctx->inputs[1]->h) {
|
2014-02-07 09:33:56 +01:00
|
|
|
av_log(ctx, AV_LOG_ERROR, "Width and height of input videos must be same.\n");
|
2013-07-06 02:21:12 +02:00
|
|
|
return AVERROR(EINVAL);
|
|
|
|
}
|
|
|
|
if (ctx->inputs[0]->format != ctx->inputs[1]->format) {
|
|
|
|
av_log(ctx, AV_LOG_ERROR, "Inputs must be of same pixel format.\n");
|
|
|
|
return AVERROR(EINVAL);
|
|
|
|
}
|
|
|
|
|
2015-09-08 17:10:48 +02:00
|
|
|
s->max[0] = (1 << desc->comp[0].depth) - 1;
|
|
|
|
s->max[1] = (1 << desc->comp[1].depth) - 1;
|
|
|
|
s->max[2] = (1 << desc->comp[2].depth) - 1;
|
|
|
|
s->max[3] = (1 << desc->comp[3].depth) - 1;
|
2013-07-06 02:21:12 +02:00
|
|
|
|
|
|
|
s->is_rgb = ff_fill_rgba_map(s->rgba_map, inlink->format) >= 0;
|
|
|
|
s->comps[0] = s->is_rgb ? 'r' : 'y' ;
|
|
|
|
s->comps[1] = s->is_rgb ? 'g' : 'u' ;
|
|
|
|
s->comps[2] = s->is_rgb ? 'b' : 'v' ;
|
|
|
|
s->comps[3] = 'a';
|
|
|
|
|
2013-09-08 12:53:55 +02:00
|
|
|
s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
|
|
|
|
s->planeheight[0] = s->planeheight[3] = inlink->h;
|
|
|
|
s->planewidth[1] = s->planewidth[2] = FF_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
|
|
|
|
s->planewidth[0] = s->planewidth[3] = inlink->w;
|
2015-07-11 03:42:26 +02:00
|
|
|
sum = 0;
|
|
|
|
for (j = 0; j < s->nb_components; j++)
|
|
|
|
sum += s->planeheight[j] * s->planewidth[j];
|
|
|
|
for (j = 0; j < s->nb_components; j++) {
|
|
|
|
s->planeweight[j] = (double) s->planeheight[j] * s->planewidth[j] / sum;
|
|
|
|
s->average_max += s->max[j] * s->planeweight[j];
|
|
|
|
}
|
2013-07-06 02:21:12 +02:00
|
|
|
|
2015-09-08 17:10:48 +02:00
|
|
|
s->dsp.sse_line = desc->comp[0].depth > 8 ? sse_line_16bit : sse_line_8bit;
|
2015-07-12 12:44:39 +02:00
|
|
|
if (ARCH_X86)
|
2015-09-08 17:10:48 +02:00
|
|
|
ff_psnr_init_x86(&s->dsp, desc->comp[0].depth);
|
2013-09-08 13:37:07 +02:00
|
|
|
|
2013-07-06 02:21:12 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int config_output(AVFilterLink *outlink)
|
|
|
|
{
|
|
|
|
AVFilterContext *ctx = outlink->src;
|
2013-08-28 00:07:22 +02:00
|
|
|
PSNRContext *s = ctx->priv;
|
2013-07-06 02:21:12 +02:00
|
|
|
AVFilterLink *mainlink = ctx->inputs[0];
|
2013-08-28 00:07:22 +02:00
|
|
|
int ret;
|
2013-07-06 02:21:12 +02:00
|
|
|
|
|
|
|
outlink->w = mainlink->w;
|
|
|
|
outlink->h = mainlink->h;
|
|
|
|
outlink->time_base = mainlink->time_base;
|
|
|
|
outlink->sample_aspect_ratio = mainlink->sample_aspect_ratio;
|
|
|
|
outlink->frame_rate = mainlink->frame_rate;
|
2013-08-28 00:07:22 +02:00
|
|
|
if ((ret = ff_dualinput_init(ctx, &s->dinput)) < 0)
|
|
|
|
return ret;
|
2013-07-06 02:21:12 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-09-28 18:06:08 +02:00
|
|
|
static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
|
2013-07-06 02:21:12 +02:00
|
|
|
{
|
|
|
|
PSNRContext *s = inlink->dst->priv;
|
2013-09-28 18:06:08 +02:00
|
|
|
return ff_dualinput_filter_frame(&s->dinput, inlink, inpicref);
|
2013-07-06 02:21:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int request_frame(AVFilterLink *outlink)
|
|
|
|
{
|
|
|
|
PSNRContext *s = outlink->src->priv;
|
|
|
|
return ff_dualinput_request_frame(&s->dinput, outlink);
|
|
|
|
}
|
|
|
|
|
|
|
|
static av_cold void uninit(AVFilterContext *ctx)
|
|
|
|
{
|
|
|
|
PSNRContext *s = ctx->priv;
|
|
|
|
|
|
|
|
if (s->nb_frames > 0) {
|
2015-07-11 03:42:26 +02:00
|
|
|
int j;
|
|
|
|
char buf[256];
|
|
|
|
|
|
|
|
buf[0] = 0;
|
2015-07-11 17:21:17 +02:00
|
|
|
for (j = 0; j < s->nb_components; j++) {
|
|
|
|
int c = s->is_rgb ? s->rgba_map[j] : j;
|
2015-10-22 21:25:38 +02:00
|
|
|
av_strlcatf(buf, sizeof(buf), " %c:%f", s->comps[j],
|
2015-07-11 17:21:17 +02:00
|
|
|
get_psnr(s->mse_comp[c], s->nb_frames, s->max[c]));
|
|
|
|
}
|
2015-10-22 21:25:38 +02:00
|
|
|
av_log(ctx, AV_LOG_INFO, "PSNR%s average:%f min:%f max:%f\n",
|
2015-07-11 03:42:26 +02:00
|
|
|
buf,
|
2013-07-06 02:21:12 +02:00
|
|
|
get_psnr(s->mse, s->nb_frames, s->average_max),
|
|
|
|
get_psnr(s->max_mse, 1, s->average_max),
|
|
|
|
get_psnr(s->min_mse, 1, s->average_max));
|
|
|
|
}
|
|
|
|
|
|
|
|
ff_dualinput_uninit(&s->dinput);
|
|
|
|
|
2015-10-20 15:02:21 +02:00
|
|
|
if (s->stats_file && s->stats_file != stdout)
|
2013-07-06 02:21:12 +02:00
|
|
|
fclose(s->stats_file);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const AVFilterPad psnr_inputs[] = {
|
|
|
|
{
|
2013-09-07 14:13:50 +02:00
|
|
|
.name = "main",
|
|
|
|
.type = AVMEDIA_TYPE_VIDEO,
|
2013-09-28 18:06:08 +02:00
|
|
|
.filter_frame = filter_frame,
|
2013-07-06 02:21:12 +02:00
|
|
|
},{
|
2013-09-07 14:13:50 +02:00
|
|
|
.name = "reference",
|
|
|
|
.type = AVMEDIA_TYPE_VIDEO,
|
2013-09-28 18:06:08 +02:00
|
|
|
.filter_frame = filter_frame,
|
2013-09-07 14:13:50 +02:00
|
|
|
.config_props = config_input_ref,
|
2013-07-06 02:21:12 +02:00
|
|
|
},
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const AVFilterPad psnr_outputs[] = {
|
|
|
|
{
|
|
|
|
.name = "default",
|
|
|
|
.type = AVMEDIA_TYPE_VIDEO,
|
|
|
|
.config_props = config_output,
|
|
|
|
.request_frame = request_frame,
|
|
|
|
},
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
2013-10-29 11:50:56 +01:00
|
|
|
AVFilter ff_vf_psnr = {
|
2013-09-07 14:13:50 +02:00
|
|
|
.name = "psnr",
|
|
|
|
.description = NULL_IF_CONFIG_SMALL("Calculate the PSNR between two video streams."),
|
|
|
|
.init = init,
|
|
|
|
.uninit = uninit,
|
|
|
|
.query_formats = query_formats,
|
|
|
|
.priv_size = sizeof(PSNRContext),
|
|
|
|
.priv_class = &psnr_class,
|
|
|
|
.inputs = psnr_inputs,
|
|
|
|
.outputs = psnr_outputs,
|
2013-07-06 02:21:12 +02:00
|
|
|
};
|