FFmpeg
Data Structures | Macros | Functions | Variables
vf_premultiply.c File Reference
#include "config_components.h"
#include "libavutil/imgutils.h"
#include "libavutil/pixdesc.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "filters.h"
#include "formats.h"
#include "framesync.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  ThreadData
 Used for passing data between threads. More...
 
struct  PreMultiplyContext
 

Macros

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

Functions

 AVFILTER_DEFINE_CLASS_EXT (premultiply, "(un)premultiply", options)
 
static int query_formats (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
static void premultiply8 (const uint8_t *msrc, const uint8_t *asrc, uint8_t *dst, ptrdiff_t mlinesize, ptrdiff_t alinesize, ptrdiff_t dlinesize, int w, int h, int half, int shift, int offset)
 
static void premultiply8yuv (const uint8_t *msrc, const uint8_t *asrc, uint8_t *dst, ptrdiff_t mlinesize, ptrdiff_t alinesize, ptrdiff_t dlinesize, int w, int h, int half, int shift, int offset)
 
static void premultiply8offset (const uint8_t *msrc, const uint8_t *asrc, uint8_t *dst, ptrdiff_t mlinesize, ptrdiff_t alinesize, ptrdiff_t dlinesize, int w, int h, int half, int shift, int offset)
 
static void premultiply16 (const uint8_t *mmsrc, const uint8_t *aasrc, uint8_t *ddst, ptrdiff_t mlinesize, ptrdiff_t alinesize, ptrdiff_t dlinesize, int w, int h, int half, int shift, int offset)
 
static void premultiply16yuv (const uint8_t *mmsrc, const uint8_t *aasrc, uint8_t *ddst, ptrdiff_t mlinesize, ptrdiff_t alinesize, ptrdiff_t dlinesize, int w, int h, int half, int shift, int offset)
 
static void premultiply16offset (const uint8_t *mmsrc, const uint8_t *aasrc, uint8_t *ddst, ptrdiff_t mlinesize, ptrdiff_t alinesize, ptrdiff_t dlinesize, int w, int h, int half, int shift, int offset)
 
static void premultiplyf32 (const uint8_t *mmsrc, const uint8_t *aasrc, uint8_t *ddst, ptrdiff_t mlinesize, ptrdiff_t alinesize, ptrdiff_t dlinesize, int w, int h, int half, int shift, int offset)
 
static void premultiplyf32offset (const uint8_t *mmsrc, const uint8_t *aasrc, uint8_t *ddst, ptrdiff_t mlinesize, ptrdiff_t alinesize, ptrdiff_t dlinesize, int w, int h, int half, int shift, int offset)
 
static void unpremultiply8 (const uint8_t *msrc, const uint8_t *asrc, uint8_t *dst, ptrdiff_t mlinesize, ptrdiff_t alinesize, ptrdiff_t dlinesize, int w, int h, int half, int max, int offset)
 
static void unpremultiply8yuv (const uint8_t *msrc, const uint8_t *asrc, uint8_t *dst, ptrdiff_t mlinesize, ptrdiff_t alinesize, ptrdiff_t dlinesize, int w, int h, int half, int max, int offset)
 
static void unpremultiply8offset (const uint8_t *msrc, const uint8_t *asrc, uint8_t *dst, ptrdiff_t mlinesize, ptrdiff_t alinesize, ptrdiff_t dlinesize, int w, int h, int half, int max, int offset)
 
static void unpremultiply16 (const uint8_t *mmsrc, const uint8_t *aasrc, uint8_t *ddst, ptrdiff_t mlinesize, ptrdiff_t alinesize, ptrdiff_t dlinesize, int w, int h, int half, int max, int offset)
 
static void unpremultiply16yuv (const uint8_t *mmsrc, const uint8_t *aasrc, uint8_t *ddst, ptrdiff_t mlinesize, ptrdiff_t alinesize, ptrdiff_t dlinesize, int w, int h, int half, int max, int offset)
 
static void unpremultiply16offset (const uint8_t *mmsrc, const uint8_t *aasrc, uint8_t *ddst, ptrdiff_t mlinesize, ptrdiff_t alinesize, ptrdiff_t dlinesize, int w, int h, int half, int max, int offset)
 
static void unpremultiplyf32 (const uint8_t *mmsrc, const uint8_t *aasrc, uint8_t *ddst, ptrdiff_t mlinesize, ptrdiff_t alinesize, ptrdiff_t dlinesize, int w, int h, int half, int max, int offset)
 
static void unpremultiplyf32offset (const uint8_t *mmsrc, const uint8_t *aasrc, uint8_t *ddst, ptrdiff_t mlinesize, ptrdiff_t alinesize, ptrdiff_t dlinesize, int w, int h, int half, int max, int offset)
 
static int premultiply_slice (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterContext *ctx, AVFrame **out, AVFrame *base, AVFrame *alpha)
 
static int process_frame (FFFrameSync *fs)
 
static int config_input (AVFilterLink *inlink)
 
static int config_output (AVFilterLink *outlink)
 
static int activate (AVFilterContext *ctx)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption options []
 
static const AVFilterPad premultiply_outputs []
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 55 of file vf_premultiply.c.

◆ FLAGS

Definition at line 56 of file vf_premultiply.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS_EXT()

AVFILTER_DEFINE_CLASS_EXT ( premultiply  ,
"(un)premultiply"  ,
options   
)

◆ query_formats()

static int query_formats ( const AVFilterContext ctx,
AVFilterFormatsConfig **  cfg_in,
AVFilterFormatsConfig **  cfg_out 
)
static

Definition at line 66 of file vf_premultiply.c.

◆ premultiply8()

static void premultiply8 ( const uint8_t *  msrc,
const uint8_t *  asrc,
uint8_t *  dst,
ptrdiff_t  mlinesize,
ptrdiff_t  alinesize,
ptrdiff_t  dlinesize,
int  w,
int  h,
int  half,
int  shift,
int  offset 
)
static

Definition at line 95 of file vf_premultiply.c.

Referenced by filter_frame().

◆ premultiply8yuv()

static void premultiply8yuv ( const uint8_t *  msrc,
const uint8_t *  asrc,
uint8_t *  dst,
ptrdiff_t  mlinesize,
ptrdiff_t  alinesize,
ptrdiff_t  dlinesize,
int  w,
int  h,
int  half,
int  shift,
int  offset 
)
static

Definition at line 115 of file vf_premultiply.c.

Referenced by filter_frame().

◆ premultiply8offset()

static void premultiply8offset ( const uint8_t *  msrc,
const uint8_t *  asrc,
uint8_t *  dst,
ptrdiff_t  mlinesize,
ptrdiff_t  alinesize,
ptrdiff_t  dlinesize,
int  w,
int  h,
int  half,
int  shift,
int  offset 
)
static

Definition at line 135 of file vf_premultiply.c.

Referenced by filter_frame().

◆ premultiply16()

static void premultiply16 ( const uint8_t *  mmsrc,
const uint8_t *  aasrc,
uint8_t *  ddst,
ptrdiff_t  mlinesize,
ptrdiff_t  alinesize,
ptrdiff_t  dlinesize,
int  w,
int  h,
int  half,
int  shift,
int  offset 
)
static

Definition at line 155 of file vf_premultiply.c.

Referenced by filter_frame().

◆ premultiply16yuv()

static void premultiply16yuv ( const uint8_t *  mmsrc,
const uint8_t *  aasrc,
uint8_t *  ddst,
ptrdiff_t  mlinesize,
ptrdiff_t  alinesize,
ptrdiff_t  dlinesize,
int  w,
int  h,
int  half,
int  shift,
int  offset 
)
static

Definition at line 178 of file vf_premultiply.c.

Referenced by filter_frame().

◆ premultiply16offset()

static void premultiply16offset ( const uint8_t *  mmsrc,
const uint8_t *  aasrc,
uint8_t *  ddst,
ptrdiff_t  mlinesize,
ptrdiff_t  alinesize,
ptrdiff_t  dlinesize,
int  w,
int  h,
int  half,
int  shift,
int  offset 
)
static

Definition at line 201 of file vf_premultiply.c.

Referenced by filter_frame().

◆ premultiplyf32()

static void premultiplyf32 ( const uint8_t *  mmsrc,
const uint8_t *  aasrc,
uint8_t *  ddst,
ptrdiff_t  mlinesize,
ptrdiff_t  alinesize,
ptrdiff_t  dlinesize,
int  w,
int  h,
int  half,
int  shift,
int  offset 
)
static

Definition at line 224 of file vf_premultiply.c.

Referenced by filter_frame().

◆ premultiplyf32offset()

static void premultiplyf32offset ( const uint8_t *  mmsrc,
const uint8_t *  aasrc,
uint8_t *  ddst,
ptrdiff_t  mlinesize,
ptrdiff_t  alinesize,
ptrdiff_t  dlinesize,
int  w,
int  h,
int  half,
int  shift,
int  offset 
)
static

Definition at line 247 of file vf_premultiply.c.

Referenced by filter_frame().

◆ unpremultiply8()

static void unpremultiply8 ( const uint8_t *  msrc,
const uint8_t *  asrc,
uint8_t *  dst,
ptrdiff_t  mlinesize,
ptrdiff_t  alinesize,
ptrdiff_t  dlinesize,
int  w,
int  h,
int  half,
int  max,
int  offset 
)
static

Definition at line 272 of file vf_premultiply.c.

Referenced by filter_frame().

◆ unpremultiply8yuv()

static void unpremultiply8yuv ( const uint8_t *  msrc,
const uint8_t *  asrc,
uint8_t *  dst,
ptrdiff_t  mlinesize,
ptrdiff_t  alinesize,
ptrdiff_t  dlinesize,
int  w,
int  h,
int  half,
int  max,
int  offset 
)
static

Definition at line 295 of file vf_premultiply.c.

Referenced by filter_frame().

◆ unpremultiply8offset()

static void unpremultiply8offset ( const uint8_t *  msrc,
const uint8_t *  asrc,
uint8_t *  dst,
ptrdiff_t  mlinesize,
ptrdiff_t  alinesize,
ptrdiff_t  dlinesize,
int  w,
int  h,
int  half,
int  max,
int  offset 
)
static

Definition at line 318 of file vf_premultiply.c.

Referenced by filter_frame().

◆ unpremultiply16()

static void unpremultiply16 ( const uint8_t *  mmsrc,
const uint8_t *  aasrc,
uint8_t *  ddst,
ptrdiff_t  mlinesize,
ptrdiff_t  alinesize,
ptrdiff_t  dlinesize,
int  w,
int  h,
int  half,
int  max,
int  offset 
)
static

Definition at line 341 of file vf_premultiply.c.

Referenced by filter_frame().

◆ unpremultiply16yuv()

static void unpremultiply16yuv ( const uint8_t *  mmsrc,
const uint8_t *  aasrc,
uint8_t *  ddst,
ptrdiff_t  mlinesize,
ptrdiff_t  alinesize,
ptrdiff_t  dlinesize,
int  w,
int  h,
int  half,
int  max,
int  offset 
)
static

Definition at line 367 of file vf_premultiply.c.

Referenced by filter_frame().

◆ unpremultiply16offset()

static void unpremultiply16offset ( const uint8_t *  mmsrc,
const uint8_t *  aasrc,
uint8_t *  ddst,
ptrdiff_t  mlinesize,
ptrdiff_t  alinesize,
ptrdiff_t  dlinesize,
int  w,
int  h,
int  half,
int  max,
int  offset 
)
static

Definition at line 393 of file vf_premultiply.c.

Referenced by filter_frame().

◆ unpremultiplyf32()

static void unpremultiplyf32 ( const uint8_t *  mmsrc,
const uint8_t *  aasrc,
uint8_t *  ddst,
ptrdiff_t  mlinesize,
ptrdiff_t  alinesize,
ptrdiff_t  dlinesize,
int  w,
int  h,
int  half,
int  max,
int  offset 
)
static

Definition at line 419 of file vf_premultiply.c.

Referenced by filter_frame().

◆ unpremultiplyf32offset()

static void unpremultiplyf32offset ( const uint8_t *  mmsrc,
const uint8_t *  aasrc,
uint8_t *  ddst,
ptrdiff_t  mlinesize,
ptrdiff_t  alinesize,
ptrdiff_t  dlinesize,
int  w,
int  h,
int  half,
int  max,
int  offset 
)
static

Definition at line 446 of file vf_premultiply.c.

Referenced by filter_frame().

◆ premultiply_slice()

static int premultiply_slice ( AVFilterContext ctx,
void *  arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 475 of file vf_premultiply.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterContext ctx,
AVFrame **  out,
AVFrame base,
AVFrame alpha 
)
static

Definition at line 510 of file vf_premultiply.c.

Referenced by activate(), and process_frame().

◆ process_frame()

static int process_frame ( FFFrameSync fs)
static

Definition at line 648 of file vf_premultiply.c.

Referenced by config_output().

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 668 of file vf_premultiply.c.

Referenced by init().

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 695 of file vf_premultiply.c.

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 747 of file vf_premultiply.c.

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 781 of file vf_premultiply.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 809 of file vf_premultiply.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "planes", "set planes", OFFSET(planes), AV_OPT_TYPE_INT, {.i64=0xF}, 0, 0xF, FLAGS },
{ "inplace","enable inplace mode", OFFSET(inplace), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS },
{ NULL }
}

Definition at line 58 of file vf_premultiply.c.

◆ premultiply_outputs

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

Definition at line 817 of file vf_premultiply.c.

FLAGS
#define FLAGS
Definition: vf_premultiply.c:56
planes
static const struct @465 planes[]
NULL
#define NULL
Definition: coverity.c:32
OFFSET
#define OFFSET(x)
Definition: vf_premultiply.c:55
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_premultiply.c:695
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327