From 4d251723c0a157b77fa9d3c84c74507d399f7254 Mon Sep 17 00:00:00 2001 From: Thilo Borgmann Date: Sat, 19 Mar 2016 16:28:40 +0100 Subject: [PATCH] lavfi: Add coreimage filter for GPU based image filtering on OSX. --- Changelog | 1 + MAINTAINERS | 1 + configure | 4 + doc/filters.texi | 166 +++++++++ libavfilter/Makefile | 2 + libavfilter/allfilters.c | 2 + libavfilter/version.h | 2 +- libavfilter/vf_coreimage.m | 688 +++++++++++++++++++++++++++++++++++++ 8 files changed, 865 insertions(+), 1 deletion(-) create mode 100644 libavfilter/vf_coreimage.m diff --git a/Changelog b/Changelog index d70f6f0bbd..aaf4c96ccc 100644 --- a/Changelog +++ b/Changelog @@ -15,6 +15,7 @@ version : - VC-2 HQ RTP payload format (draft v1) depacketizer - AudioToolbox audio decoders - AudioToolbox audio encoders +- coreimage filter (GPU based image filtering on OSX) version 3.0: diff --git a/MAINTAINERS b/MAINTAINERS index 531c21d74c..a993a675a2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -370,6 +370,7 @@ Filters: vf_colorbalance.c Paul B Mahol vf_colorkey.c Timo Rothenpieler vf_colorlevels.c Paul B Mahol + vf_coreimage.m Thilo Borgmann vf_deband.c Paul B Mahol vf_dejudder.c Nicholas Robbins vf_delogo.c Jean Delvare (CC ) diff --git a/configure b/configure index 0987bcd666..feb0bc287b 100755 --- a/configure +++ b/configure @@ -5287,6 +5287,8 @@ frei0r_filter_extralibs='$ldl' frei0r_src_filter_extralibs='$ldl' ladspa_filter_extralibs='$ldl' nvenc_encoder_extralibs='$ldl' +coreimage_filter_extralibs="-framework QuartzCore -framework AppKit -framework OpenGL" +coreimagesrc_filter_extralibs="-framework QuartzCore -framework AppKit -framework OpenGL" if ! disabled network; then check_func getaddrinfo $network_extralibs @@ -5516,6 +5518,8 @@ enabled avisynth && { { check_lib2 "windows.h" LoadLibrary; } || die "ERROR: LoadLibrary/dlopen not found for avisynth"; } enabled cuda && check_lib cuda.h cuInit -lcuda enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint +enabled coreimage_filter && { check_header_objcc QuartzCore/CoreImage.h || disable coreimage_filter; } +enabled coreimagesrc_filter && { check_header_objcc QuartzCore/CoreImage.h || disable coreimagesrc_filter; } enabled decklink && { check_header DeckLinkAPI.h || die "ERROR: DeckLinkAPI.h header not found"; } enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; } enabled gmp && require2 gmp gmp.h mpz_export -lgmp diff --git a/doc/filters.texi b/doc/filters.texi index e6ffbed65a..528e0f8012 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -4955,6 +4955,111 @@ convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 - Copy the input source unchanged to the output. This is mainly useful for testing purposes. +@anchor{coreimage} +@section coreimage +Video filtering on GPU using Apple's CoreImage API on OSX. + +Hardware acceleration is based on an OpenGL context. Usually, this means it is +processed by video hardware. However, software-based OpenGL implementations +exist which means there is no guarantee for hardware processing. It depends on +the respective OSX. + +There are many filters and image generators provided by Apple that come with a +large variety of options. The filter has to be referenced by its name along +with its options. + +The coreimage filter accepts the following options: +@table @option +@item list_filters +List all available filters and generators along with all their respective +options as well as possible minimum and maximum values along with the default +values. +@example +list_filters=true +@end example + +@item filter +Specify all filters by their respective name and options. +Use @var{list_filters} to determine all valid filter names and options. +Numerical options are specified by a float value and are automatically clamped +to their respective value range. Vector and color options have to be specified +by a list of space separated float values. Character escaping has to be done. +A special option name @code{default} is available to use default options for a +filter. + +It is required to specify either @code{default} or at least one of the filter options. +All omitted options are used with their default values. +The syntax of the filter string is as follows: +@example +filter=@@