2012-12-21 21:50:13 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2012-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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "libavutil/avassert.h"
|
|
|
|
#include "libavutil/opt.h"
|
|
|
|
#include "libavutil/parseutils.h"
|
|
|
|
#include "libavutil/pixdesc.h"
|
|
|
|
#include "avfilter.h"
|
|
|
|
#include "formats.h"
|
|
|
|
#include "internal.h"
|
|
|
|
#include "video.h"
|
|
|
|
|
|
|
|
enum HistogramMode {
|
|
|
|
MODE_LEVELS,
|
|
|
|
MODE_WAVEFORM,
|
|
|
|
MODE_COLOR,
|
|
|
|
MODE_COLOR2,
|
|
|
|
MODE_NB
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct HistogramContext {
|
|
|
|
const AVClass *class; ///< AVClass context for log and options purpose
|
2015-03-18 13:23:39 +02:00
|
|
|
int mode; ///< HistogramMode
|
2012-12-21 21:50:13 +03:00
|
|
|
unsigned histogram[256];
|
|
|
|
int ncomp;
|
|
|
|
const uint8_t *bg_color;
|
|
|
|
const uint8_t *fg_color;
|
|
|
|
int level_height;
|
|
|
|
int scale_height;
|
|
|
|
int step;
|
|
|
|
int waveform_mode;
|
2013-10-02 23:23:55 +03:00
|
|
|
int waveform_mirror;
|
2013-02-09 19:05:28 +03:00
|
|
|
int display_mode;
|
2013-05-15 15:36:41 +03:00
|
|
|
int levels_mode;
|
2013-10-01 22:53:57 +03:00
|
|
|
const AVPixFmtDescriptor *desc;
|
2012-12-21 21:50:13 +03:00
|
|
|
} HistogramContext;
|
|
|
|
|
|
|
|
#define OFFSET(x) offsetof(HistogramContext, x)
|
|
|
|
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
|
|
|
|
|
|
|
|
static const AVOption histogram_options[] = {
|
|
|
|
{ "mode", "set histogram mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=MODE_LEVELS}, 0, MODE_NB-1, FLAGS, "mode"},
|
|
|
|
{ "levels", "standard histogram", 0, AV_OPT_TYPE_CONST, {.i64=MODE_LEVELS}, 0, 0, FLAGS, "mode" },
|
|
|
|
{ "waveform", "per row/column luminance graph", 0, AV_OPT_TYPE_CONST, {.i64=MODE_WAVEFORM}, 0, 0, FLAGS, "mode" },
|
|
|
|
{ "color", "chroma values in vectorscope", 0, AV_OPT_TYPE_CONST, {.i64=MODE_COLOR}, 0, 0, FLAGS, "mode" },
|
|
|
|
{ "color2", "chroma values in vectorscope", 0, AV_OPT_TYPE_CONST, {.i64=MODE_COLOR2}, 0, 0, FLAGS, "mode" },
|
|
|
|
{ "level_height", "set level height", OFFSET(level_height), AV_OPT_TYPE_INT, {.i64=200}, 50, 2048, FLAGS},
|
|
|
|
{ "scale_height", "set scale height", OFFSET(scale_height), AV_OPT_TYPE_INT, {.i64=12}, 0, 40, FLAGS},
|
|
|
|
{ "step", "set waveform step value", OFFSET(step), AV_OPT_TYPE_INT, {.i64=10}, 1, 255, FLAGS},
|
|
|
|
{ "waveform_mode", "set waveform mode", OFFSET(waveform_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "waveform_mode"},
|
|
|
|
{ "row", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "waveform_mode" },
|
|
|
|
{ "column", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "waveform_mode" },
|
2013-10-02 23:23:55 +03:00
|
|
|
{ "waveform_mirror", "set waveform mirroring", OFFSET(waveform_mirror), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "waveform_mirror"},
|
2013-02-09 19:05:28 +03:00
|
|
|
{ "display_mode", "set display mode", OFFSET(display_mode), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, FLAGS, "display_mode"},
|
|
|
|
{ "parade", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "display_mode" },
|
|
|
|
{ "overlay", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "display_mode" },
|
2013-05-15 15:36:41 +03:00
|
|
|
{ "levels_mode", "set levels mode", OFFSET(levels_mode), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "levels_mode"},
|
|
|
|
{ "linear", NULL, 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "levels_mode" },
|
|
|
|
{ "logarithmic", NULL, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "levels_mode" },
|
2013-09-07 15:13:50 +03:00
|
|
|
{ NULL }
|
2012-12-21 21:50:13 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
AVFILTER_DEFINE_CLASS(histogram);
|
|
|
|
|
|
|
|
static const enum AVPixelFormat color_pix_fmts[] = {
|
|
|
|
AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVJ444P,
|
|
|
|
AV_PIX_FMT_NONE
|
|
|
|
};
|
|
|
|
|
|
|
|
static const enum AVPixelFormat levels_pix_fmts[] = {
|
|
|
|
AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVJ444P,
|
2013-05-06 18:36:20 +03:00
|
|
|
AV_PIX_FMT_GRAY8, AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE
|
2012-12-21 21:50:13 +03:00
|
|
|
};
|
|
|
|
|
2013-10-01 23:39:03 +03:00
|
|
|
static const enum AVPixelFormat waveform_pix_fmts[] = {
|
|
|
|
AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRAP,
|
|
|
|
AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P,
|
|
|
|
AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV440P,
|
|
|
|
AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P,
|
|
|
|
AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUVJ420P,
|
|
|
|
AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P,
|
|
|
|
AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA420P,
|
|
|
|
AV_PIX_FMT_GRAY8,
|
|
|
|
AV_PIX_FMT_NONE
|
|
|
|
};
|
|
|
|
|
2012-12-21 21:50:13 +03:00
|
|
|
static int query_formats(AVFilterContext *ctx)
|
|
|
|
{
|
|
|
|
HistogramContext *h = ctx->priv;
|
|
|
|
const enum AVPixelFormat *pix_fmts;
|
|
|
|
|
|
|
|
switch (h->mode) {
|
2013-02-09 19:05:28 +03:00
|
|
|
case MODE_WAVEFORM:
|
2013-10-01 23:39:03 +03:00
|
|
|
pix_fmts = waveform_pix_fmts;
|
|
|
|
break;
|
2012-12-21 21:50:13 +03:00
|
|
|
case MODE_LEVELS:
|
|
|
|
pix_fmts = levels_pix_fmts;
|
|
|
|
break;
|
|
|
|
case MODE_COLOR:
|
|
|
|
case MODE_COLOR2:
|
|
|
|
pix_fmts = color_pix_fmts;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
av_assert0(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const uint8_t black_yuva_color[4] = { 0, 127, 127, 255 };
|
|
|
|
static const uint8_t black_gbrp_color[4] = { 0, 0, 0, 255 };
|
|
|
|
static const uint8_t white_yuva_color[4] = { 255, 127, 127, 255 };
|
|
|
|
static const uint8_t white_gbrp_color[4] = { 255, 255, 255, 255 };
|
|
|
|
|
|
|
|
static int config_input(AVFilterLink *inlink)
|
|
|
|
{
|
|
|
|
HistogramContext *h = inlink->dst->priv;
|
|
|
|
|
2013-10-01 22:53:57 +03:00
|
|
|
h->desc = av_pix_fmt_desc_get(inlink->format);
|
|
|
|
h->ncomp = h->desc->nb_components;
|
2012-12-21 21:50:13 +03:00
|
|
|
|
|
|
|
switch (inlink->format) {
|
2013-05-06 18:36:20 +03:00
|
|
|
case AV_PIX_FMT_GBRAP:
|
2012-12-21 21:50:13 +03:00
|
|
|
case AV_PIX_FMT_GBRP:
|
|
|
|
h->bg_color = black_gbrp_color;
|
|
|
|
h->fg_color = white_gbrp_color;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
h->bg_color = black_yuva_color;
|
|
|
|
h->fg_color = white_yuva_color;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int config_output(AVFilterLink *outlink)
|
|
|
|
{
|
|
|
|
AVFilterContext *ctx = outlink->src;
|
|
|
|
HistogramContext *h = ctx->priv;
|
|
|
|
|
|
|
|
switch (h->mode) {
|
|
|
|
case MODE_LEVELS:
|
|
|
|
outlink->w = 256;
|
2013-02-18 23:12:07 +03:00
|
|
|
outlink->h = (h->level_height + h->scale_height) * FFMAX(h->ncomp * h->display_mode, 1);
|
2012-12-21 21:50:13 +03:00
|
|
|
break;
|
|
|
|
case MODE_WAVEFORM:
|
|
|
|
if (h->waveform_mode)
|
2013-02-09 19:05:28 +03:00
|
|
|
outlink->h = 256 * FFMAX(h->ncomp * h->display_mode, 1);
|
2012-12-21 21:50:13 +03:00
|
|
|
else
|
2013-02-09 19:05:28 +03:00
|
|
|
outlink->w = 256 * FFMAX(h->ncomp * h->display_mode, 1);
|
2012-12-21 21:50:13 +03:00
|
|
|
break;
|
|
|
|
case MODE_COLOR:
|
|
|
|
case MODE_COLOR2:
|
|
|
|
outlink->h = outlink->w = 256;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
av_assert0(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
outlink->sample_aspect_ratio = (AVRational){1,1};
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-10-01 22:53:57 +03:00
|
|
|
static void gen_waveform(HistogramContext *h, AVFrame *inpicref, AVFrame *outpicref,
|
|
|
|
int component, int intensity, int offset, int col_mode)
|
|
|
|
{
|
|
|
|
const int plane = h->desc->comp[component].plane;
|
2013-10-02 23:23:55 +03:00
|
|
|
const int mirror = h->waveform_mirror;
|
2013-10-02 23:23:54 +03:00
|
|
|
const int is_chroma = (component == 1 || component == 2);
|
|
|
|
const int shift_w = (is_chroma ? h->desc->log2_chroma_w : 0);
|
|
|
|
const int shift_h = (is_chroma ? h->desc->log2_chroma_h : 0);
|
2013-10-01 22:53:57 +03:00
|
|
|
const int src_linesize = inpicref->linesize[plane];
|
|
|
|
const int dst_linesize = outpicref->linesize[plane];
|
2013-10-02 23:23:55 +03:00
|
|
|
const int dst_signed_linesize = dst_linesize * (mirror == 1 ? -1 : 1);
|
2013-10-01 22:53:57 +03:00
|
|
|
uint8_t *src_data = inpicref->data[plane];
|
2013-10-02 23:23:54 +03:00
|
|
|
uint8_t *dst_data = outpicref->data[plane] + (col_mode ? (offset >> shift_h) * dst_linesize : offset >> shift_w);
|
2013-10-02 23:23:55 +03:00
|
|
|
uint8_t * const dst_bottom_line = dst_data + dst_linesize * ((256 >> shift_h) - 1);
|
|
|
|
uint8_t * const dst_line = (mirror ? dst_bottom_line : dst_data);
|
2013-10-01 22:53:57 +03:00
|
|
|
const uint8_t max = 255 - intensity;
|
2013-10-01 23:39:03 +03:00
|
|
|
const int src_h = FF_CEIL_RSHIFT(inpicref->height, shift_h);
|
|
|
|
const int src_w = FF_CEIL_RSHIFT(inpicref->width, shift_w);
|
2013-10-01 22:53:57 +03:00
|
|
|
uint8_t *dst, *p;
|
|
|
|
int y;
|
|
|
|
|
2013-10-02 23:23:55 +03:00
|
|
|
if (!col_mode && mirror)
|
|
|
|
dst_data += 256 >> shift_w;
|
2013-10-01 22:53:57 +03:00
|
|
|
for (y = 0; y < src_h; y++) {
|
|
|
|
const uint8_t *src_data_end = src_data + src_w;
|
|
|
|
dst = dst_line;
|
|
|
|
for (p = src_data; p < src_data_end; p++) {
|
|
|
|
uint8_t *target;
|
2013-10-02 23:23:55 +03:00
|
|
|
if (col_mode) {
|
|
|
|
target = dst++ + dst_signed_linesize * (*p >> shift_h);
|
|
|
|
} else {
|
|
|
|
if (mirror)
|
|
|
|
target = dst_data - (*p >> shift_w);
|
|
|
|
else
|
|
|
|
target = dst_data + (*p >> shift_w);
|
|
|
|
}
|
2013-10-01 22:53:57 +03:00
|
|
|
if (*target <= max)
|
|
|
|
*target += intensity;
|
|
|
|
else
|
|
|
|
*target = 255;
|
|
|
|
}
|
|
|
|
src_data += src_linesize;
|
|
|
|
dst_data += dst_linesize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-10 03:30:30 +03:00
|
|
|
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
2012-12-21 21:50:13 +03:00
|
|
|
{
|
|
|
|
HistogramContext *h = inlink->dst->priv;
|
|
|
|
AVFilterContext *ctx = inlink->dst;
|
|
|
|
AVFilterLink *outlink = ctx->outputs[0];
|
2013-03-10 03:30:30 +03:00
|
|
|
AVFrame *out;
|
2012-12-21 21:50:13 +03:00
|
|
|
const uint8_t *src;
|
|
|
|
uint8_t *dst;
|
2013-04-15 19:07:51 +03:00
|
|
|
int i, j, k, l;
|
2012-12-21 21:50:13 +03:00
|
|
|
|
2013-03-10 03:30:30 +03:00
|
|
|
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
|
2012-12-21 21:50:13 +03:00
|
|
|
if (!out) {
|
2013-03-10 03:30:30 +03:00
|
|
|
av_frame_free(&in);
|
2012-12-21 21:50:13 +03:00
|
|
|
return AVERROR(ENOMEM);
|
|
|
|
}
|
|
|
|
|
|
|
|
out->pts = in->pts;
|
|
|
|
|
2013-10-01 23:39:03 +03:00
|
|
|
for (k = 0; k < h->ncomp; k++) {
|
2013-10-04 19:48:19 +03:00
|
|
|
const int is_chroma = (k == 1 || k == 2);
|
|
|
|
const int dst_h = FF_CEIL_RSHIFT(outlink->h, (is_chroma ? h->desc->log2_chroma_h : 0));
|
|
|
|
const int dst_w = FF_CEIL_RSHIFT(outlink->w, (is_chroma ? h->desc->log2_chroma_w : 0));
|
2013-10-01 23:39:03 +03:00
|
|
|
for (i = 0; i < dst_h ; i++)
|
|
|
|
memset(out->data[h->desc->comp[k].plane] +
|
|
|
|
i * out->linesize[h->desc->comp[k].plane],
|
|
|
|
h->bg_color[k], dst_w);
|
|
|
|
}
|
2012-12-21 21:50:13 +03:00
|
|
|
|
|
|
|
switch (h->mode) {
|
|
|
|
case MODE_LEVELS:
|
|
|
|
for (k = 0; k < h->ncomp; k++) {
|
2013-10-02 00:22:22 +03:00
|
|
|
const int p = h->desc->comp[k].plane;
|
2013-10-04 19:48:19 +03:00
|
|
|
const int start = k * (h->level_height + h->scale_height) * h->display_mode;
|
2013-05-19 17:30:42 +03:00
|
|
|
double max_hval_log;
|
|
|
|
unsigned max_hval = 0;
|
2013-02-09 15:25:55 +03:00
|
|
|
|
2013-03-10 03:30:30 +03:00
|
|
|
for (i = 0; i < in->height; i++) {
|
2013-10-02 00:22:22 +03:00
|
|
|
src = in->data[p] + i * in->linesize[p];
|
2013-03-10 03:30:30 +03:00
|
|
|
for (j = 0; j < in->width; j++)
|
2012-12-21 21:50:13 +03:00
|
|
|
h->histogram[src[j]]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 256; i++)
|
2013-05-19 17:30:42 +03:00
|
|
|
max_hval = FFMAX(max_hval, h->histogram[i]);
|
|
|
|
max_hval_log = log2(max_hval + 1);
|
2012-12-21 21:50:13 +03:00
|
|
|
|
|
|
|
for (i = 0; i < outlink->w; i++) {
|
2013-05-15 15:36:41 +03:00
|
|
|
int col_height;
|
|
|
|
|
|
|
|
if (h->levels_mode)
|
2013-05-19 17:30:42 +03:00
|
|
|
col_height = round(h->level_height * (1. - (log2(h->histogram[i] + 1) / max_hval_log)));
|
2013-05-15 15:36:41 +03:00
|
|
|
else
|
2013-05-19 17:30:42 +03:00
|
|
|
col_height = h->level_height - (h->histogram[i] * (int64_t)h->level_height + max_hval - 1) / max_hval;
|
2012-12-21 21:50:13 +03:00
|
|
|
|
2013-02-18 23:12:07 +03:00
|
|
|
for (j = h->level_height - 1; j >= col_height; j--) {
|
|
|
|
if (h->display_mode) {
|
|
|
|
for (l = 0; l < h->ncomp; l++)
|
|
|
|
out->data[l][(j + start) * out->linesize[l] + i] = h->fg_color[l];
|
|
|
|
} else {
|
2013-10-02 00:22:22 +03:00
|
|
|
out->data[p][(j + start) * out->linesize[p] + i] = 255;
|
2013-02-18 23:12:07 +03:00
|
|
|
}
|
|
|
|
}
|
2012-12-21 21:50:13 +03:00
|
|
|
for (j = h->level_height + h->scale_height - 1; j >= h->level_height; j--)
|
2013-10-02 00:22:22 +03:00
|
|
|
out->data[p][(j + start) * out->linesize[p] + i] = i;
|
2012-12-21 21:50:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
memset(h->histogram, 0, 256 * sizeof(unsigned));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MODE_WAVEFORM:
|
2013-10-01 22:53:57 +03:00
|
|
|
for (k = 0; k < h->ncomp; k++) {
|
2013-10-04 19:48:19 +03:00
|
|
|
const int offset = k * 256 * h->display_mode;
|
2013-10-01 22:53:57 +03:00
|
|
|
gen_waveform(h, in, out, k, h->step, offset, h->waveform_mode);
|
2012-12-21 21:50:13 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MODE_COLOR:
|
|
|
|
for (i = 0; i < inlink->h; i++) {
|
2013-10-04 19:48:19 +03:00
|
|
|
const int iw1 = i * in->linesize[1];
|
|
|
|
const int iw2 = i * in->linesize[2];
|
2012-12-21 21:50:13 +03:00
|
|
|
for (j = 0; j < inlink->w; j++) {
|
2013-10-04 19:48:19 +03:00
|
|
|
const int pos = in->data[1][iw1 + j] * out->linesize[0] + in->data[2][iw2 + j];
|
2012-12-21 21:50:13 +03:00
|
|
|
if (out->data[0][pos] < 255)
|
|
|
|
out->data[0][pos]++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i = 0; i < 256; i++) {
|
|
|
|
dst = out->data[0] + i * out->linesize[0];
|
|
|
|
for (j = 0; j < 256; j++) {
|
|
|
|
if (!dst[j]) {
|
|
|
|
out->data[1][i * out->linesize[0] + j] = i;
|
|
|
|
out->data[2][i * out->linesize[0] + j] = j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MODE_COLOR2:
|
|
|
|
for (i = 0; i < inlink->h; i++) {
|
2013-10-04 19:48:19 +03:00
|
|
|
const int iw1 = i * in->linesize[1];
|
|
|
|
const int iw2 = i * in->linesize[2];
|
2012-12-21 21:50:13 +03:00
|
|
|
for (j = 0; j < inlink->w; j++) {
|
2013-10-04 19:48:19 +03:00
|
|
|
const int u = in->data[1][iw1 + j];
|
|
|
|
const int v = in->data[2][iw2 + j];
|
|
|
|
const int pos = u * out->linesize[0] + v;
|
2012-12-21 21:50:13 +03:00
|
|
|
if (!out->data[0][pos])
|
|
|
|
out->data[0][pos] = FFABS(128 - u) + FFABS(128 - v);
|
|
|
|
out->data[1][pos] = u;
|
|
|
|
out->data[2][pos] = v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
av_assert0(0);
|
|
|
|
}
|
|
|
|
|
2013-03-10 03:30:30 +03:00
|
|
|
av_frame_free(&in);
|
2013-04-15 19:07:51 +03:00
|
|
|
return ff_filter_frame(outlink, out);
|
2012-12-21 21:50:13 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static const AVFilterPad inputs[] = {
|
|
|
|
{
|
|
|
|
.name = "default",
|
|
|
|
.type = AVMEDIA_TYPE_VIDEO,
|
|
|
|
.filter_frame = filter_frame,
|
|
|
|
.config_props = config_input,
|
|
|
|
},
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const AVFilterPad outputs[] = {
|
|
|
|
{
|
|
|
|
.name = "default",
|
|
|
|
.type = AVMEDIA_TYPE_VIDEO,
|
|
|
|
.config_props = config_output,
|
|
|
|
},
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
2013-10-29 13:50:56 +03:00
|
|
|
AVFilter ff_vf_histogram = {
|
2012-12-21 21:50:13 +03:00
|
|
|
.name = "histogram",
|
|
|
|
.description = NULL_IF_CONFIG_SMALL("Compute and draw a histogram."),
|
|
|
|
.priv_size = sizeof(HistogramContext),
|
|
|
|
.query_formats = query_formats,
|
|
|
|
.inputs = inputs,
|
|
|
|
.outputs = outputs,
|
|
|
|
.priv_class = &histogram_class,
|
|
|
|
};
|