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

Pixel remap filter This filter copies pixel by pixel a source frame to a target frame. More...

#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "formats.h"
#include "framesync.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  RemapContext
 

Macros

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

Functions

 AVFILTER_DEFINE_CLASS (remap)
 
static int query_formats (AVFilterContext *ctx)
 
static void remap_planar (RemapContext *s, const AVFrame *in, const AVFrame *xin, const AVFrame *yin, AVFrame *out)
 remap_planar algorithm expects planes of same size pixels are copied from source to target using : Target_frame[y][x] = Source_frame[ ymap[y][x] ][ [xmap[y][x] ]; More...
 
static void remap_planar16 (RemapContext *s, const AVFrame *in, const AVFrame *xin, const AVFrame *yin, AVFrame *out)
 
static void remap_packed (RemapContext *s, const AVFrame *in, const AVFrame *xin, const AVFrame *yin, AVFrame *out)
 remap_packed algorithm expects pixels with both padded bits (step) and number of components correctly set. More...
 
static void remap_packed16 (RemapContext *s, const AVFrame *in, const AVFrame *xin, const AVFrame *yin, AVFrame *out)
 
static int config_input (AVFilterLink *inlink)
 
static int process_frame (FFFrameSync *fs)
 
static int config_output (AVFilterLink *outlink)
 
static int activate (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption remap_options []
 
static const AVFilterPad remap_inputs []
 
static const AVFilterPad remap_outputs []
 
AVFilter ff_vf_remap
 

Detailed Description

Pixel remap filter This filter copies pixel by pixel a source frame to a target frame.

It remaps the pixels to a new x,y destination based on two files ymap/xmap. Map files are passed as a parameter and are in PGM format (P2 or P5), where the values are y(rows)/x(cols) coordinates of the source_frame. The target frame dimension is based on mapfile dimensions: specified in the header of the mapfile and reflected in the number of datavalues. Dimensions of ymap and xmap must be equal. Datavalues must be positive or zero. Any datavalue in the ymap or xmap which value is higher then the source frame height or width is silently ignored, leaving a blank/chromakey pixel. This can safely be used as a feature to create overlays.

Algorithm digest: Target_frame[y][x] = Source_frame[ ymap[y][x] ][ [xmap[y][x] ];

Definition in file vf_remap.c.

Macro Definition Documentation

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

Definition at line 60 of file vf_remap.c.

Definition at line 61 of file vf_remap.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( remap  )
static int query_formats ( AVFilterContext ctx)
static

Definition at line 69 of file vf_remap.c.

static void remap_planar ( RemapContext s,
const AVFrame in,
const AVFrame xin,
const AVFrame yin,
AVFrame out 
)
static

remap_planar algorithm expects planes of same size pixels are copied from source to target using : Target_frame[y][x] = Source_frame[ ymap[y][x] ][ [xmap[y][x] ];

Definition at line 124 of file vf_remap.c.

Referenced by config_input().

static void remap_planar16 ( RemapContext s,
const AVFrame in,
const AVFrame xin,
const AVFrame yin,
AVFrame out 
)
static

Definition at line 155 of file vf_remap.c.

Referenced by config_input().

static void remap_packed ( RemapContext s,
const AVFrame in,
const AVFrame xin,
const AVFrame yin,
AVFrame out 
)
static

remap_packed algorithm expects pixels with both padded bits (step) and number of components correctly set.

pixels are copied from source to target using : Target_frame[y][x] = Source_frame[ ymap[y][x] ][ [xmap[y][x] ];

Definition at line 192 of file vf_remap.c.

Referenced by config_input().

static void remap_packed16 ( RemapContext s,
const AVFrame in,
const AVFrame xin,
const AVFrame yin,
AVFrame out 
)
static

Definition at line 223 of file vf_remap.c.

Referenced by config_input().

static int config_input ( AVFilterLink inlink)
static

Definition at line 254 of file vf_remap.c.

static int process_frame ( FFFrameSync fs)
static

Definition at line 281 of file vf_remap.c.

Referenced by config_output().

static int config_output ( AVFilterLink outlink)
static

Definition at line 311 of file vf_remap.c.

static int activate ( AVFilterContext ctx)
static

Definition at line 359 of file vf_remap.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 366 of file vf_remap.c.

Variable Documentation

const AVOption remap_options[]
static
Initial value:
= {
{ NULL }
}
#define NULL
Definition: coverity.c:32

Definition at line 63 of file vf_remap.c.

const AVFilterPad remap_inputs[]
static
Initial value:
= {
{
.name = "source",
.config_props = config_input,
},
{
.name = "xmap",
},
{
.name = "ymap",
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_input(AVFilterLink *inlink)
Definition: vf_remap.c:254

Definition at line 373 of file vf_remap.c.

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

Definition at line 390 of file vf_remap.c.

AVFilter ff_vf_remap
Initial value:
= {
.name = "remap",
.description = NULL_IF_CONFIG_SMALL("Remap pixels."),
.priv_size = sizeof(RemapContext),
.priv_class = &remap_class,
}
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
Definition: avfilter.h:125
static int activate(AVFilterContext *ctx)
Definition: vf_remap.c:359
static int flags
Definition: log.c:55
static int query_formats(AVFilterContext *ctx)
Definition: vf_remap.c:69
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_remap.c:366
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
static const AVFilterPad remap_outputs[]
Definition: vf_remap.c:390
static const AVFilterPad remap_inputs[]
Definition: vf_remap.c:373

Definition at line 399 of file vf_remap.c.