FFmpeg  4.3
Data Structures | Macros | Functions | Variables
vf_coreimage.m File Reference
#import <CoreImage/CoreImage.h>
#import <AppKit/AppKit.h>
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"

Go to the source code of this file.

Data Structures

struct  CoreImageContext
 

Macros

#define CLAMP_WARNING
 
#define SafeCFRelease(ptr)
 
#define OFFSET(x)   offsetof(CoreImageContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define GENERATOR_OPTIONS
 
#define FILTER_OPTIONS
 

Functions

static int config_output (AVFilterLink *link)
 
static int config_input (AVFilterLink *link)
 Determine image properties from input link of filter chain. More...
 
static void list_filters (CoreImageContext *ctx)
 Print a list of all available filters including options and respective value ranges and defaults. More...
 
static int query_formats (AVFilterContext *fctx)
 
static int query_formats_src (AVFilterContext *fctx)
 
static int apply_filter (CoreImageContext *ctx, AVFilterLink *link, AVFrame *frame)
 
static int filter_frame (AVFilterLink *link, AVFrame *frame)
 Apply all valid filters successively to the input image. More...
 
static int request_frame (AVFilterLink *link)
 
static void set_option (CoreImageContext *ctx, CIFilter *filter, const char *key, const char *value)
 Set an option of the given filter to the provided key-value pair. More...
 
static CIFilter * create_filter (CoreImageContext *ctx, const char *filter_name, AVDictionary *filter_options)
 Create a filter object by a given name and set all options to defaults. More...
 
static av_cold int init (AVFilterContext *fctx)
 
static av_cold int init_src (AVFilterContext *fctx)
 
static av_cold void uninit (AVFilterContext *fctx)
 
 AVFILTER_DEFINE_CLASS (coreimage)
 
 AVFILTER_DEFINE_CLASS (coreimagesrc)
 

Variables

static const AVFilterPad vf_coreimage_inputs []
 
static const AVFilterPad vf_coreimage_outputs []
 
static const AVFilterPad vsrc_coreimagesrc_outputs []
 
static const AVOption coreimage_options []
 
AVFilter ff_vf_coreimage
 
static const AVOption coreimagesrc_options []
 
AVFilter ff_vsrc_coreimagesrc
 

Detailed Description

Video processing based on Apple's CoreImage API

Definition in file vf_coreimage.m.

Macro Definition Documentation

◆ CLAMP_WARNING

#define CLAMP_WARNING
Value:
do { \
av_log(ctx, AV_LOG_WARNING, "Value of \"%f\" for option \"%s\" is out of range [%f %f], clamping to \"%f\".\n", \
input, \
[input_key UTF8String], \
min_value.floatValue, \
max_value.floatValue, \
used_value.floatValue); \
} while(0)

◆ SafeCFRelease

#define SafeCFRelease (   ptr)
Value:
do { \
if (ptr) { \
CFRelease(ptr); \
ptr = NULL; \
} \
} while (0)

◆ OFFSET

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

Definition at line 632 of file vf_coreimage.m.

◆ FLAGS

Definition at line 633 of file vf_coreimage.m.

◆ GENERATOR_OPTIONS

#define GENERATOR_OPTIONS
Value:
{"size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS}, \
{"s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "320x240"}, 0, 0, FLAGS}, \
{"rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, FLAGS}, \
{"r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, FLAGS}, \
{"duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS}, \
{"d", "set video duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = -1}, -1, INT64_MAX, FLAGS}, \
{"sar", "set video sample aspect ratio", OFFSET(sar), AV_OPT_TYPE_RATIONAL, {.dbl = 1}, 0, INT_MAX, FLAGS},

Definition at line 635 of file vf_coreimage.m.

◆ FILTER_OPTIONS

#define FILTER_OPTIONS
Value:
{"list_filters", "list available filters", OFFSET(list_filters), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, .flags = FLAGS}, \
{"list_generators", "list available generators", OFFSET(list_generators), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, .flags = FLAGS}, \
{"filter", "names and options of filters to apply", OFFSET(filter_string), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = FLAGS}, \
{"output_rect", "output rectangle within output image", OFFSET(output_rect), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = FLAGS},

Definition at line 644 of file vf_coreimage.m.

Function Documentation

◆ config_output()

static int config_output ( AVFilterLink link)
static

Definition at line 65 of file vf_coreimage.m.

◆ config_input()

static int config_input ( AVFilterLink link)
static

Determine image properties from input link of filter chain.

Definition at line 83 of file vf_coreimage.m.

◆ list_filters()

static void list_filters ( CoreImageContext ctx)
static

Print a list of all available filters including options and respective value ranges and defaults.

Definition at line 94 of file vf_coreimage.m.

Referenced by init().

◆ query_formats()

static int query_formats ( AVFilterContext fctx)
static

Definition at line 138 of file vf_coreimage.m.

◆ query_formats_src()

static int query_formats_src ( AVFilterContext fctx)
static

Definition at line 160 of file vf_coreimage.m.

◆ apply_filter()

static int apply_filter ( CoreImageContext ctx,
AVFilterLink link,
AVFrame frame 
)
static

Definition at line 181 of file vf_coreimage.m.

Referenced by filter_frame(), and request_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink link,
AVFrame frame 
)
static

Apply all valid filters successively to the input image.

The final output image is copied from the GPU by "drawing" using a bitmap context.

Definition at line 318 of file vf_coreimage.m.

◆ request_frame()

static int request_frame ( AVFilterLink link)
static

Definition at line 323 of file vf_coreimage.m.

◆ set_option()

static void set_option ( CoreImageContext ctx,
CIFilter *  filter,
const char *  key,
const char *  value 
)
static

Set an option of the given filter to the provided key-value pair.

Definition at line 358 of file vf_coreimage.m.

Referenced by create_filter().

◆ create_filter()

static CIFilter* create_filter ( CoreImageContext ctx,
const char *  filter_name,
AVDictionary filter_options 
)
static

Create a filter object by a given name and set all options to defaults.

Overwrite any option given by the user to the provided value in filter_options.

Definition at line 451 of file vf_coreimage.m.

Referenced by init().

◆ init()

static av_cold int init ( AVFilterContext fctx)
static

Definition at line 470 of file vf_coreimage.m.

Referenced by init_src().

◆ init_src()

static av_cold int init_src ( AVFilterContext fctx)
static

Definition at line 567 of file vf_coreimage.m.

◆ uninit()

static av_cold void uninit ( AVFilterContext fctx)
static

Definition at line 578 of file vf_coreimage.m.

◆ AVFILTER_DEFINE_CLASS() [1/2]

AVFILTER_DEFINE_CLASS ( coreimage  )

◆ AVFILTER_DEFINE_CLASS() [2/2]

AVFILTER_DEFINE_CLASS ( coreimagesrc  )

Variable Documentation

◆ vf_coreimage_inputs

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

Definition at line 604 of file vf_coreimage.m.

◆ vf_coreimage_outputs

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

Definition at line 614 of file vf_coreimage.m.

◆ vsrc_coreimagesrc_outputs

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

Definition at line 622 of file vf_coreimage.m.

◆ coreimage_options

const AVOption coreimage_options[]
static
Initial value:
= {
{ NULL }
}

Definition at line 652 of file vf_coreimage.m.

◆ ff_vf_coreimage

AVFilter ff_vf_coreimage
Initial value:
= {
.name = "coreimage",
.description = NULL_IF_CONFIG_SMALL("Video filtering using CoreImage API."),
.init = init,
.uninit = uninit,
.priv_size = sizeof(CoreImageContext),
.priv_class = &coreimage_class,
}

Definition at line 659 of file vf_coreimage.m.

◆ coreimagesrc_options

const AVOption coreimagesrc_options[]
static
Initial value:

Definition at line 672 of file vf_coreimage.m.

◆ ff_vsrc_coreimagesrc

AVFilter ff_vsrc_coreimagesrc
Initial value:
= {
.name = "coreimagesrc",
.description = NULL_IF_CONFIG_SMALL("Video source using image generators of CoreImage API."),
.init = init_src,
.uninit = uninit,
.priv_size = sizeof(CoreImageContext),
.priv_class = &coreimagesrc_class,
}

Definition at line 680 of file vf_coreimage.m.

AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
Definition: opt.h:236
OFFSET
#define OFFSET(x)
Definition: vf_coreimage.m:632
AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Definition: opt.h:237
vf_coreimage_outputs
static const AVFilterPad vf_coreimage_outputs[]
Definition: vf_coreimage.m:614
AV_OPT_TYPE_RATIONAL
@ AV_OPT_TYPE_RATIONAL
Definition: opt.h:228
CoreImageContext
Definition: vf_coreimage.m:37
filter_frame
static int filter_frame(AVFilterLink *link, AVFrame *frame)
Apply all valid filters successively to the input image.
Definition: vf_coreimage.m:318
vsrc_coreimagesrc_outputs
static const AVFilterPad vsrc_coreimagesrc_outputs[]
Definition: vf_coreimage.m:622
request_frame
static int request_frame(AVFilterLink *link)
Definition: vf_coreimage.m:323
init
static av_cold int init(AVFilterContext *fctx)
Definition: vf_coreimage.m:470
query_formats
static int query_formats(AVFilterContext *fctx)
Definition: vf_coreimage.m:138
config_output
static int config_output(AVFilterLink *link)
Definition: vf_coreimage.m:65
duration
int64_t duration
Definition: movenc.c:63
FILTER_OPTIONS
#define FILTER_OPTIONS
Definition: vf_coreimage.m:644
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
ctx
AVFormatContext * ctx
Definition: movenc.c:48
config_input
static int config_input(AVFilterLink *link)
Determine image properties from input link of filter chain.
Definition: vf_coreimage.m:83
NULL
#define NULL
Definition: coverity.c:32
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:233
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
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:186
input
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
Definition: filter_design.txt:172
list_filters
static void list_filters(CoreImageContext *ctx)
Print a list of all available filters including options and respective value ranges and defaults.
Definition: vf_coreimage.m:94
FLAGS
#define FLAGS
Definition: vf_coreimage.m:633
w
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo ug o o w
Definition: fate.txt:150
init_src
static av_cold int init_src(AVFilterContext *fctx)
Definition: vf_coreimage.m:567
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
query_formats_src
static int query_formats_src(AVFilterContext *fctx)
Definition: vf_coreimage.m:160
uninit
static av_cold void uninit(AVFilterContext *fctx)
Definition: vf_coreimage.m:578
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:240
vf_coreimage_inputs
static const AVFilterPad vf_coreimage_inputs[]
Definition: vf_coreimage.m:604
GENERATOR_OPTIONS
#define GENERATOR_OPTIONS
Definition: vf_coreimage.m:635
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:227