Libav
Data Structures | Macros | Enumerations | Functions | Variables
vf_crop.c File Reference

video crop filter More...

#include <stdio.h>
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
#include "libavutil/eval.h"
#include "libavutil/avstring.h"
#include "libavutil/internal.h"
#include "libavutil/libm.h"
#include "libavutil/imgutils.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"

Go to the source code of this file.

Data Structures

struct  CropContext
 

Macros

#define OFFSET(x)   offsetof(CropContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM
 

Enumerations

enum  var_name {
  VAR_E, VAR_INTERLACED, VAR_N, VAR_PHI,
  VAR_PI, VAR_PREV_INPTS, VAR_PREV_OUTPTS, VAR_PTS,
  VAR_STARTPTS, VAR_TB, VAR_RTCTIME, VAR_RTCSTART,
  VAR_S, VAR_SR, VAR_VARS_NB, VAR_E,
  VAR_PHI, VAR_PI, VAR_AVTB, VAR_INTB,
  VAR_SR, VAR_VARS_NB, VAR_PI, VAR_PHI,
  VAR_E, 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_E, VAR_PHI, VAR_PI, 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_N, VAR_T, VAR_VARS_NB,
  VAR_E, VAR_PHI, VAR_PI, VAR_MAIN_W,
  VAR_MW, VAR_MAIN_H, VAR_MH, VAR_TEXT_W,
  VAR_TW, VAR_TEXT_H, VAR_TH, VAR_X,
  VAR_Y, VAR_N, VAR_T, VAR_VARS_NB,
  VAR_E, VAR_PHI, VAR_PI, VAR_W,
  VAR_H, VAR_VAL, VAR_MAXVAL, VAR_MINVAL,
  VAR_NEGVAL, VAR_CLIPVAL, VAR_VARS_NB, VAR_E,
  VAR_PHI, VAR_PI, VAR_MAIN_W, VAR_MW,
  VAR_MAIN_H, VAR_MH, VAR_OVERLAY_W, VAR_OW,
  VAR_OVERLAY_H, VAR_OH, VAR_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_X, VAR_Y,
  VAR_A, VAR_HSUB, VAR_VSUB, 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, VAR_HSUB, VAR_VSUB,
  VARS_NB, VAR_E, VAR_PHI, VAR_PI,
  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_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_N, VAR_SELECTED_N, VAR_PREV_SELECTED_N,
  VAR_KEY, VAR_VARS_NB, VAR_E, VAR_PHI,
  VAR_PI, VAR_AVTB, VAR_VARS_NB
}
 

Functions

static int query_formats (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int normalize_double (int *n, double d)
 
static int config_input (AVFilterLink *link)
 
static int config_output (AVFilterLink *link)
 
static int filter_frame (AVFilterLink *link, AVFrame *frame)
 

Variables

static const char *const var_names []
 
static const AVOption options []
 
static const AVClass crop_class
 
static const AVFilterPad avfilter_vf_crop_inputs []
 
static const AVFilterPad avfilter_vf_crop_outputs []
 
AVFilter ff_vf_crop
 

Detailed Description

video crop filter

Definition in file vf_crop.c.

Macro Definition Documentation

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

Definition at line 295 of file vf_crop.c.

#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM

Definition at line 296 of file vf_crop.c.

Enumeration Type Documentation

enum var_name
Enumerator
VAR_E 
VAR_INTERLACED 
VAR_N 
VAR_PHI 
VAR_PI 
VAR_PREV_INPTS 
VAR_PREV_OUTPTS 
VAR_PTS 
VAR_STARTPTS 
VAR_TB 
VAR_RTCTIME 
VAR_RTCSTART 
VAR_S 
VAR_SR 
VAR_VARS_NB 
VAR_E 
VAR_PHI 
VAR_PI 
VAR_AVTB 
VAR_INTB 
VAR_SR 
VAR_VARS_NB 
VAR_PI 
VAR_PHI 
VAR_E 
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_E 
VAR_PHI 
VAR_PI 
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_N 
VAR_T 
VAR_VARS_NB 
VAR_E 
VAR_PHI 
VAR_PI 
VAR_MAIN_W 
VAR_MW 
VAR_MAIN_H 
VAR_MH 
VAR_TEXT_W 
VAR_TW 
VAR_TEXT_H 
VAR_TH 
VAR_X 
VAR_Y 
VAR_N 
VAR_T 
VAR_VARS_NB 
VAR_E 
VAR_PHI 
VAR_PI 
VAR_W 
VAR_H 
VAR_VAL 
VAR_MAXVAL 
VAR_MINVAL 
VAR_NEGVAL 
VAR_CLIPVAL 
VAR_VARS_NB 
VAR_E 
VAR_PHI 
VAR_PI 
VAR_MAIN_W 
VAR_MW 
VAR_MAIN_H 
VAR_MH 
VAR_OVERLAY_W 
VAR_OW 
VAR_OVERLAY_H 
VAR_OH 
VAR_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_X 
VAR_Y 
VAR_A 
VAR_HSUB 
VAR_VSUB 
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 
VAR_HSUB 
VAR_VSUB 
VARS_NB 
VAR_E 
VAR_PHI 
VAR_PI 
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_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_N 
VAR_SELECTED_N 
VAR_PREV_SELECTED_N 
VAR_KEY 
VAR_VARS_NB 
VAR_E 
VAR_PHI 
VAR_PI 
VAR_AVTB 
VAR_VARS_NB 

Definition at line 56 of file vf_crop.c.

Function Documentation

static int query_formats ( AVFilterContext ctx)
static

Definition at line 85 of file vf_crop.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 118 of file vf_crop.c.

static int normalize_double ( int *  n,
double  d 
)
inlinestatic

Definition at line 128 of file vf_crop.c.

Referenced by config_input(), and filter_frame().

static int config_input ( AVFilterLink link)
static

Definition at line 143 of file vf_crop.c.

static int config_output ( AVFilterLink link)
static

Definition at line 228 of file vf_crop.c.

static int filter_frame ( AVFilterLink link,
AVFrame frame 
)
static

Definition at line 238 of file vf_crop.c.

Variable Documentation

const char* const var_names[]
static
Initial value:
= {
"E",
"PHI",
"PI",
"in_w", "iw",
"in_h", "ih",
"out_w", "ow",
"out_h", "oh",
"x",
"y",
"n",
"pos",
"t",
}
NULL
Definition: eval.c:55

Definition at line 40 of file vf_crop.c.

Referenced by config_input().

const AVOption options[]
static
Initial value:
= {
{ "out_w", "Output video width", OFFSET(ow_expr), AV_OPT_TYPE_STRING, { .str = "iw" }, .flags = FLAGS },
{ "out_h", "Output video height", OFFSET(oh_expr), AV_OPT_TYPE_STRING, { .str = "ih" }, .flags = FLAGS },
{ "x", "Horizontal position in the input video of the left edge of the cropped output video",
OFFSET(x_expr), AV_OPT_TYPE_STRING, { .str = "(in_w - out_w) / 2" }, .flags = FLAGS },
{ "y", "Vertical position in the input video of the top edge of the cropped output video",
OFFSET(y_expr), AV_OPT_TYPE_STRING, { .str = "(in_h - out_h) / 2" }, .flags = FLAGS },
{ NULL },
}
#define FLAGS
Definition: vf_crop.c:296
#define OFFSET(x)
Definition: vf_crop.c:295
NULL
Definition: eval.c:55

Definition at line 297 of file vf_crop.c.

const AVClass crop_class
static
Initial value:
= {
.class_name = "crop",
.item_name = av_default_item_name,
.option = options,
}
LIBAVUTIL_VERSION_INT
Definition: eval.c:55
static const AVOption options[]
Definition: vf_crop.c:297
av_default_item_name
Return the context name.
Definition: dnxhdenc.c:52

Definition at line 307 of file vf_crop.c.

const AVFilterPad avfilter_vf_crop_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
.get_video_buffer = ff_null_get_video_buffer,
.config_props = config_input,
},
{ NULL }
}
static int config_input(AVFilterLink *link)
Definition: vf_crop.c:143
AVFrame * ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
Definition: video.c:30
NULL
Definition: eval.c:55
static int filter_frame(AVFilterLink *link, AVFrame *frame)
Definition: vf_crop.c:238

Definition at line 314 of file vf_crop.c.

const AVFilterPad avfilter_vf_crop_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
},
{ NULL }
}
NULL
Definition: eval.c:55
static int config_output(AVFilterLink *link)
Definition: vf_crop.c:228

Definition at line 325 of file vf_crop.c.

AVFilter ff_vf_crop
Initial value:
= {
.name = "crop",
.description = NULL_IF_CONFIG_SMALL("Crop the input video to width:height:x:y."),
.priv_size = sizeof(CropContext),
.priv_class = &crop_class,
}
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:232
static const AVFilterPad avfilter_vf_crop_outputs[]
Definition: vf_crop.c:325
static const AVFilterPad avfilter_vf_crop_inputs[]
Definition: vf_crop.c:314
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:150
static const AVClass crop_class
Definition: vf_crop.c:307
static int query_formats(AVFilterContext *ctx)
Definition: vf_crop.c:85
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_crop.c:118
static const AVFilterPad inputs[]
Definition: af_ashowinfo.c:221

Definition at line 334 of file vf_crop.c.