FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
vf_zscale.c File Reference

zscale video filter using z.lib library More...

#include <stdio.h>
#include <string.h>
#include <zimg.h>
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
#include "libavutil/avstring.h"
#include "libavutil/eval.h"
#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
#include "libavutil/avassert.h"

Go to the source code of this file.

Data Structures

struct  ZScaleContext
 

Macros

#define OFFSET(x)   offsetof(ZScaleContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Enumerations

enum  var_name {
  VAR_CH, VAR_N, VAR_NB_IN_CHANNELS, VAR_NB_OUT_CHANNELS,
  VAR_T, VAR_S, VAR_VARS_NB, VAR_VALUE1,
  VAR_VALUE2, VAR_VARS_NB, VAR_TB, VAR_PTS,
  VAR_START_PTS, VAR_PREV_PTS, VAR_PREV_SELECTED_PTS, VAR_T,
  VAR_START_T, VAR_PREV_T, VAR_PREV_SELECTED_T, VAR_PICT_TYPE,
  VAR_I, VAR_P, VAR_B, VAR_S,
  VAR_SI, VAR_SP, VAR_BI, VAR_PICT_TYPE_I,
  VAR_PICT_TYPE_P, VAR_PICT_TYPE_B, VAR_PICT_TYPE_S, VAR_PICT_TYPE_SI,
  VAR_PICT_TYPE_SP, VAR_PICT_TYPE_BI, VAR_INTERLACE_TYPE, VAR_INTERLACE_TYPE_P,
  VAR_INTERLACE_TYPE_T, VAR_INTERLACE_TYPE_B, VAR_CONSUMED_SAMPLES_N, VAR_SAMPLES_N,
  VAR_SAMPLE_RATE, VAR_N, VAR_SELECTED_N, VAR_PREV_SELECTED_N,
  VAR_KEY, VAR_POS, VAR_SCENE, VAR_CONCATDEC_SELECT,
  VAR_VARS_NB, VAR_FRAME_RATE, VAR_INTERLACED, VAR_N,
  VAR_NB_CONSUMED_SAMPLES, VAR_NB_SAMPLES, VAR_POS, VAR_PREV_INPTS,
  VAR_PREV_INT, VAR_PREV_OUTPTS, VAR_PREV_OUTT, VAR_PTS,
  VAR_SAMPLE_RATE, VAR_STARTPTS, VAR_STARTT, VAR_T,
  VAR_TB, VAR_RTCTIME, VAR_RTCSTART, VAR_S,
  VAR_SR, VAR_VARS_NB, VAR_AVTB, VAR_INTB,
  VAR_SR, VAR_VARS_NB, VAR_W, VAR_H,
  VAR_A, VAR_DAR, VAR_SAR, VAR_HSUB,
  VAR_VSUB, VARS_NB, VAR_W, VAR_H,
  VAR_CW, VAR_CH, VAR_HSUB, VAR_VSUB,
  VARS_NB, VAR_IN_W, VAR_IW, VAR_IN_H,
  VAR_IH, VAR_OUT_W, VAR_OW, VAR_OUT_H,
  VAR_OH, VAR_A, VAR_SAR, VAR_DAR,
  VAR_HSUB, VAR_VSUB, VAR_X, VAR_Y,
  VAR_N, VAR_POS, VAR_T, VAR_VARS_NB,
  VAR_DAR, VAR_HSUB, VAR_VSUB, VAR_IN_H,
  VAR_IH, VAR_IN_W, VAR_IW, VAR_SAR,
  VAR_X, VAR_Y, VAR_H, VAR_W,
  VAR_T, VAR_MAX, VARS_NB, VAR_DAR,
  VAR_HSUB, VAR_VSUB, VAR_LINE_H, VAR_LH,
  VAR_MAIN_H, VAR_h, VAR_H, VAR_MAIN_W,
  VAR_w, VAR_W, VAR_MAX_GLYPH_A, VAR_ASCENT,
  VAR_MAX_GLYPH_D, VAR_DESCENT, VAR_MAX_GLYPH_H, VAR_MAX_GLYPH_W,
  VAR_N, VAR_SAR, VAR_T, VAR_TEXT_H,
  VAR_TH, VAR_TEXT_W, VAR_TW, VAR_X,
  VAR_Y, VAR_PICT_TYPE, VAR_VARS_NB, VAR_N,
  VAR_POS, VAR_R, VAR_T, VAR_NB,
  VAR_N, VAR_PTS, VAR_R, VAR_T,
  VAR_TB, VAR_NB, VAR_W, VAR_H,
  VAR_VAL, VAR_MAXVAL, VAR_MINVAL, VAR_NEGVAL,
  VAR_CLIPVAL, VAR_VARS_NB, VAR_MAIN_W, VAR_MW,
  VAR_MAIN_H, VAR_MH, VAR_OVERLAY_W, VAR_OW,
  VAR_OVERLAY_H, VAR_OH, VAR_HSUB, VAR_VSUB,
  VAR_X, VAR_Y, VAR_N, VAR_POS,
  VAR_T, VAR_VARS_NB, VAR_IN_W, VAR_IW,
  VAR_IN_H, VAR_IH, VAR_OUT_W, VAR_OW,
  VAR_OUT_H, VAR_OH, VAR_X, VAR_Y,
  VAR_A, VAR_SAR, VAR_DAR, VAR_HSUB,
  VAR_VSUB, VARS_NB, VAR_IN_W, VAR_IW,
  VAR_IN_H, VAR_IH, VAR_OUT_W, VAR_OW,
  VAR_OUT_H, VAR_OH, VAR_HSUB, VAR_VSUB,
  VAR_N, VAR_T, VAR_VARS_NB, VAR_IN_W,
  VAR_IW, VAR_IN_H, VAR_IH, VAR_OUT_W,
  VAR_OW, VAR_OUT_H, VAR_OH, VAR_A,
  VAR_SAR, VAR_DAR, VAR_HSUB, VAR_VSUB,
  VAR_OHSUB, VAR_OVSUB, VARS_NB, VAR_PI,
  VAR_PHI, VAR_E, VAR_IN_W, VAR_IW,
  VAR_IN_H, VAR_IH, VAR_OUT_W, VAR_OW,
  VAR_OUT_H, VAR_OH, VAR_A, VAR_DAR,
  VAR_SAR, VARS_NB, VAR_W, VAR_H,
  VAR_N, VAR_PTS, VAR_R, VAR_T,
  VAR_TB, VAR_NB, VAR_IN_W, VAR_IW,
  VAR_IN_H, VAR_IH, VAR_OUT_W, VAR_OW,
  VAR_OUT_H, VAR_OH, VAR_IN, VAR_ON,
  VAR_DURATION, VAR_PDURATION, VAR_TIME, VAR_FRAME,
  VAR_ZOOM, VAR_PZOOM, VAR_X, VAR_PX,
  VAR_Y, VAR_PY, VAR_A, VAR_SAR,
  VAR_DAR, VAR_HSUB, VAR_VSUB, VARS_NB,
  VAR_IN_W, VAR_IW, VAR_IN_H, VAR_IH,
  VAR_OUT_W, VAR_OW, VAR_OUT_H, VAR_OH,
  VAR_A, VAR_SAR, VAR_DAR, VAR_HSUB,
  VAR_VSUB, VAR_OHSUB, VAR_OVSUB, VARS_NB,
  VAR_X, VAR_Y, VAR_W, VAR_H,
  VAR_TIME, VAR_SPEED, VAR_TEMPO, VAR_ORDER,
  VAR_PATTERN, VAR_ROW, VAR_VARS_NB
}
 

Functions

static av_cold int init_dict (AVFilterContext *ctx, AVDictionary **opts)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_props (AVFilterLink *outlink)
 
static int print_zimg_error (AVFilterContext *ctx)
 
static int convert_matrix (enum AVColorSpace colorspace)
 
static int convert_trc (enum AVColorTransferCharacteristic color_trc)
 
static int convert_primaries (enum AVColorPrimaries color_primaries)
 
static int convert_range (enum AVColorRange color_range)
 
static int filter_frame (AVFilterLink *link, AVFrame *in)
 
static void uninit (AVFilterContext *ctx)
 
static int process_command (AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
 

Variables

static const char *const var_names []
 
static const AVOption zscale_options []
 
static const AVClass zscale_class
 
static const AVFilterPad avfilter_vf_zscale_inputs []
 
static const AVFilterPad avfilter_vf_zscale_outputs []
 
AVFilter ff_vf_zscale
 

Detailed Description

zscale video filter using z.lib library

Definition in file vf_zscale.c.

Macro Definition Documentation

#define OFFSET (   x)    offsetof(ZScaleContext, x)

Definition at line 644 of file vf_zscale.c.

Definition at line 645 of file vf_zscale.c.

Enumeration Type Documentation

enum var_name
Enumerator
VAR_CH 
VAR_N 
VAR_NB_IN_CHANNELS 
VAR_NB_OUT_CHANNELS 
VAR_T 
VAR_S 
VAR_VARS_NB 
VAR_VALUE1 
VAR_VALUE2 
VAR_VARS_NB 
VAR_TB 
VAR_PTS 
VAR_START_PTS 
VAR_PREV_PTS 
VAR_PREV_SELECTED_PTS 
VAR_T 
VAR_START_T 
VAR_PREV_T 
VAR_PREV_SELECTED_T 
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AR_OH 
VAR_A 
VAR_SAR 
VAR_DAR 
VAR_HSUB 
VAR_VSUB 
VAR_OHSUB 
VAR_OVSUB 
VARS_NB 
VAR_PI 
VAR_PHI 
VAR_E 
VAR_IN_W 
VAR_IW 
VAR_IN_H 
VAR_IH 
VAR_OUT_W 
VAR_OW 
VAR_OUT_H 
VAR_OH 
VAR_A 
VAR_DAR 
VAR_SAR 
VARS_NB 
VAR_W 
VAR_H 
VAR_N 
VAR_PTS 
VAR_R 
VAR_T 
VAR_TB 
VAR_NB 
VAR_IN_W 
VAR_IW 
VAR_IN_H 
VAR_IH 
VAR_OUT_W 
VAR_OW 
VAR_OUT_H 
VAR_OH 
VAR_IN 
VAR_ON 
VAR_DURATION 
VAR_PDURATION 
VAR_TIME 
VAR_FRAME 
VAR_ZOOM 
VAR_PZOOM 
VAR_X 
VAR_PX 
VAR_Y 
VAR_PY 
VAR_A 
VAR_SAR 
VAR_DAR 
VAR_HSUB 
VAR_VSUB 
VARS_NB 
VAR_IN_W 
VAR_IW 
VAR_IN_H 
VAR_IH 
VAR_OUT_W 
VAR_OW 
VAR_OUT_H 
VAR_OH 
VAR_A 
VAR_SAR 
VAR_DAR 
VAR_HSUB 
VAR_VSUB 
VAR_OHSUB 
VAR_OVSUB 
VARS_NB 
VAR_X 
VAR_Y 
VAR_W 
VAR_H 
VAR_TIME 
VAR_SPEED 
VAR_TEMPO 
VAR_ORDER 
VAR_PATTERN 
VAR_ROW 
VAR_VARS_NB 

Definition at line 60 of file vf_zscale.c.

Function Documentation

static av_cold int init_dict ( AVFilterContext ctx,
AVDictionary **  opts 
)
static

Definition at line 121 of file vf_zscale.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 155 of file vf_zscale.c.

static int config_props ( AVFilterLink outlink)
static

Definition at line 186 of file vf_zscale.c.

Referenced by filter_frame(), and process_command().

static int print_zimg_error ( AVFilterContext ctx)
static

Definition at line 309 of file vf_zscale.c.

Referenced by filter_frame().

static int convert_matrix ( enum AVColorSpace  colorspace)
static

Definition at line 319 of file vf_zscale.c.

Referenced by filter_frame().

static int convert_trc ( enum AVColorTransferCharacteristic  color_trc)
static

Definition at line 342 of file vf_zscale.c.

Referenced by filter_frame().

static int convert_primaries ( enum AVColorPrimaries  color_primaries)
static

Definition at line 361 of file vf_zscale.c.

Referenced by filter_frame().

static int convert_range ( enum AVColorRange  color_range)
static

Definition at line 378 of file vf_zscale.c.

Referenced by filter_frame().

static int filter_frame ( AVFilterLink link,
AVFrame in 
)
static

Definition at line 390 of file vf_zscale.c.

static void uninit ( AVFilterContext ctx)
static

Definition at line 611 of file vf_zscale.c.

static int process_command ( AVFilterContext ctx,
const char *  cmd,
const char *  args,
char *  res,
int  res_len,
int  flags 
)
static

Definition at line 620 of file vf_zscale.c.

Variable Documentation

const char* const var_names[]
static
Initial value:
= {
"in_w", "iw",
"in_h", "ih",
"out_w", "ow",
"out_h", "oh",
"a",
"sar",
"dar",
"hsub",
"vsub",
"ohsub",
"ovsub",
}
#define NULL
Definition: coverity.c:32

Definition at line 45 of file vf_zscale.c.

Referenced by config_props().

const AVOption zscale_options[]
static

Definition at line 647 of file vf_zscale.c.

const AVClass zscale_class
static
Initial value:
= {
.class_name = "zscale",
.item_name = av_default_item_name,
.option = zscale_options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:70
av_default_item_name
static const AVOption zscale_options[]
Definition: vf_zscale.c:647

Definition at line 711 of file vf_zscale.c.

const AVFilterPad avfilter_vf_zscale_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int filter_frame(AVFilterLink *link, AVFrame *in)
Definition: vf_zscale.c:390

Definition at line 719 of file vf_zscale.c.

const AVFilterPad avfilter_vf_zscale_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_props,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_props(AVFilterLink *outlink)
Definition: vf_zscale.c:186

Definition at line 728 of file vf_zscale.c.

AVFilter ff_vf_zscale
Initial value:
= {
.name = "zscale",
.description = NULL_IF_CONFIG_SMALL("Apply resizing, colorspace and bit depth conversion."),
.init_dict = init_dict,
.query_formats = query_formats,
.priv_size = sizeof(ZScaleContext),
.priv_class = &zscale_class,
}
static const AVFilterPad avfilter_vf_zscale_outputs[]
Definition: vf_zscale.c:728
static const AVFilterPad avfilter_vf_zscale_inputs[]
Definition: vf_zscale.c:719
static int query_formats(AVFilterContext *ctx)
Definition: vf_zscale.c:155
static av_cold int init_dict(AVFilterContext *ctx, AVDictionary **opts)
Definition: vf_zscale.c:121
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static void uninit(AVFilterContext *ctx)
Definition: vf_zscale.c:611
static const AVFilterPad outputs[]
Definition: af_afftfilt.c:386
static const AVFilterPad inputs[]
Definition: af_afftfilt.c:376
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: vf_zscale.c:620
static const AVClass zscale_class
Definition: vf_zscale.c:711

Definition at line 737 of file vf_zscale.c.