FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vf_scale.c File Reference
#include <stdio.h>
#include <string.h>
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "scale.h"
#include "video.h"
#include "libavutil/avstring.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"
#include "libswscale/swscale.h"

Go to the source code of this file.

Data Structures

struct  ScaleContext
 

Macros

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

Enumerations

enum  EvalMode {
  EVAL_MODE_ONCE, EVAL_MODE_FRAME, EVAL_MODE_NB, EVAL_MODE_INIT,
  EVAL_MODE_FRAME, EVAL_MODE_NB, EVAL_MODE_INIT, EVAL_MODE_FRAME,
  EVAL_MODE_NB, EVAL_MODE_INIT, EVAL_MODE_FRAME, EVAL_MODE_NB,
  EVAL_MODE_INIT, EVAL_MODE_FRAME, EVAL_MODE_NB, EVAL_MODE_INIT,
  EVAL_MODE_FRAME, EVAL_MODE_NB, EVAL_MODE_INIT, EVAL_MODE_FRAME,
  EVAL_MODE_NB
}
 

Functions

static av_cold int init_dict (AVFilterContext *ctx, AVDictionary **opts)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static const intparse_yuv_type (const char *s, enum AVColorSpace colorspace)
 
static int config_props (AVFilterLink *outlink)
 
static int config_props_ref (AVFilterLink *outlink)
 
static int request_frame (AVFilterLink *outlink)
 
static int request_frame_ref (AVFilterLink *outlink)
 
static int scale_slice (AVFilterLink *link, AVFrame *out_buf, AVFrame *cur_pic, struct SwsContext *sws, int y, int h, int mul, int field)
 
static int filter_frame (AVFilterLink *link, AVFrame *in)
 
static int filter_frame_ref (AVFilterLink *link, AVFrame *in)
 
static int process_command (AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
 
static const AVClasschild_class_next (const AVClass *prev)
 

Variables

AVFilter ff_vf_scale2ref
 
static const AVOption scale_options []
 
static const AVClass scale_class
 
static const AVFilterPad avfilter_vf_scale_inputs []
 
static const AVFilterPad avfilter_vf_scale_outputs []
 
AVFilter ff_vf_scale
 
static const AVClass scale2ref_class
 
static const AVFilterPad avfilter_vf_scale2ref_inputs []
 
static const AVFilterPad avfilter_vf_scale2ref_outputs []
 

Detailed Description

scale video filter

Definition in file vf_scale.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 563 of file vf_scale.c.

◆ FLAGS

Definition at line 564 of file vf_scale.c.

Enumeration Type Documentation

◆ EvalMode

enum EvalMode
Enumerator
EVAL_MODE_ONCE 
EVAL_MODE_FRAME 
EVAL_MODE_NB 
EVAL_MODE_INIT 
EVAL_MODE_FRAME 
EVAL_MODE_NB 
EVAL_MODE_INIT 
EVAL_MODE_FRAME 
EVAL_MODE_NB 
EVAL_MODE_INIT 
EVAL_MODE_FRAME 
EVAL_MODE_NB 
EVAL_MODE_INIT 
EVAL_MODE_FRAME 
EVAL_MODE_NB 
EVAL_MODE_INIT 
EVAL_MODE_FRAME 
EVAL_MODE_NB 
EVAL_MODE_INIT 
EVAL_MODE_FRAME 
EVAL_MODE_NB 

Definition at line 44 of file vf_scale.c.

Function Documentation

◆ init_dict()

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

Definition at line 98 of file vf_scale.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 148 of file vf_scale.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 158 of file vf_scale.c.

◆ parse_yuv_type()

static const int* parse_yuv_type ( const char *  s,
enum AVColorSpace  colorspace 
)
static

Definition at line 196 of file vf_scale.c.

Referenced by filter_frame().

◆ config_props()

static int config_props ( AVFilterLink outlink)
static

Definition at line 220 of file vf_scale.c.

Referenced by filter_frame(), and process_command().

◆ config_props_ref()

static int config_props_ref ( AVFilterLink outlink)
static

Definition at line 356 of file vf_scale.c.

◆ request_frame()

static int request_frame ( AVFilterLink outlink)
static

Definition at line 369 of file vf_scale.c.

◆ request_frame_ref()

static int request_frame_ref ( AVFilterLink outlink)
static

Definition at line 374 of file vf_scale.c.

◆ scale_slice()

static int scale_slice ( AVFilterLink link,
AVFrame out_buf,
AVFrame cur_pic,
struct SwsContext sws,
int  y,
int  h,
int  mul,
int  field 
)
static

Definition at line 379 of file vf_scale.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink link,
AVFrame in 
)
static

Definition at line 403 of file vf_scale.c.

◆ filter_frame_ref()

static int filter_frame_ref ( AVFilterLink link,
AVFrame in 
)
static

Definition at line 527 of file vf_scale.c.

◆ process_command()

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

Definition at line 534 of file vf_scale.c.

◆ child_class_next()

static const AVClass* child_class_next ( const AVClass prev)
static

Definition at line 558 of file vf_scale.c.

Variable Documentation

◆ ff_vf_scale2ref

AVFilter ff_vf_scale2ref
Initial value:
= {
.name = "scale2ref",
.description = NULL_IF_CONFIG_SMALL("Scale the input video size and/or convert the image format to the given reference."),
.init_dict = init_dict,
.uninit = uninit,
.query_formats = query_formats,
.priv_size = sizeof(ScaleContext),
.priv_class = &scale2ref_class,
}

Definition at line 96 of file vf_scale.c.

Referenced by config_props().

◆ scale_options

const AVOption scale_options[]
static

Definition at line 566 of file vf_scale.c.

◆ scale_class

const AVClass scale_class
static
Initial value:
= {
.class_name = "scale",
.item_name = av_default_item_name,
.option = scale_options,
.child_class_next = child_class_next,
}

Definition at line 612 of file vf_scale.c.

◆ avfilter_vf_scale_inputs

const AVFilterPad avfilter_vf_scale_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
{ NULL }
}

Definition at line 621 of file vf_scale.c.

◆ avfilter_vf_scale_outputs

const AVFilterPad avfilter_vf_scale_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_props,
},
{ NULL }
}

Definition at line 630 of file vf_scale.c.

◆ ff_vf_scale

AVFilter ff_vf_scale
Initial value:
= {
.name = "scale",
.description = NULL_IF_CONFIG_SMALL("Scale the input video size and/or convert the image format."),
.init_dict = init_dict,
.uninit = uninit,
.query_formats = query_formats,
.priv_size = sizeof(ScaleContext),
.priv_class = &scale_class,
}

Definition at line 639 of file vf_scale.c.

◆ scale2ref_class

const AVClass scale2ref_class
static
Initial value:
= {
.class_name = "scale2ref",
.item_name = av_default_item_name,
.option = scale_options,
.child_class_next = child_class_next,
}

Definition at line 652 of file vf_scale.c.

◆ avfilter_vf_scale2ref_inputs

const AVFilterPad avfilter_vf_scale2ref_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
{
.name = "ref",
.filter_frame = filter_frame_ref,
},
{ NULL }
}

Definition at line 661 of file vf_scale.c.

◆ avfilter_vf_scale2ref_outputs

const AVFilterPad avfilter_vf_scale2ref_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_props,
.request_frame= request_frame,
},
{
.name = "ref",
.config_props = config_props_ref,
.request_frame= request_frame_ref,
},
{ NULL }
}

Definition at line 675 of file vf_scale.c.

filter_frame_ref
static int filter_frame_ref(AVFilterLink *link, AVFrame *in)
Definition: vf_scale.c:527
config_props_ref
static int config_props_ref(AVFilterLink *outlink)
Definition: vf_scale.c:356
ScaleContext
Definition: vf_scale.c:50
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_scale.c:158
avfilter_vf_scale2ref_outputs
static const AVFilterPad avfilter_vf_scale2ref_outputs[]
Definition: vf_scale.c:675
request_frame_ref
static int request_frame_ref(AVFilterLink *outlink)
Definition: vf_scale.c:374
scale2ref_class
static const AVClass scale2ref_class
Definition: vf_scale.c:652
request_frame
static int request_frame(AVFilterLink *outlink)
Definition: vf_scale.c:369
avfilter_vf_scale_inputs
static const AVFilterPad avfilter_vf_scale_inputs[]
Definition: vf_scale.c:621
init_dict
static av_cold int init_dict(AVFilterContext *ctx, AVDictionary **opts)
Definition: vf_scale.c:98
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
process_command
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
Definition: vf_scale.c:534
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
AV_CLASS_CATEGORY_FILTER
@ AV_CLASS_CATEGORY_FILTER
Definition: log.h:37
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:188
filter_frame
static int filter_frame(AVFilterLink *link, AVFrame *in)
Definition: vf_scale.c:403
config_props
static int config_props(AVFilterLink *outlink)
Definition: vf_scale.c:220
avfilter_vf_scale_outputs
static const AVFilterPad avfilter_vf_scale_outputs[]
Definition: vf_scale.c:630
child_class_next
static const AVClass * child_class_next(const AVClass *prev)
Definition: vf_scale.c:558
scale_options
static const AVOption scale_options[]
Definition: vf_scale.c:566
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_scale.c:148
avfilter_vf_scale2ref_inputs
static const AVFilterPad avfilter_vf_scale2ref_inputs[]
Definition: vf_scale.c:661
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
scale_class
static const AVClass scale_class
Definition: vf_scale.c:612