FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vf_scale_vulkan.c File Reference
#include "libavutil/opt.h"
#include "vulkan.h"
#include "scale_eval.h"
#include "internal.h"
#include "colorspace.h"

Go to the source code of this file.

Data Structures

struct  ScaleVulkanContext
 

Macros

#define CGROUPS   (int [3]){ 32, 32, 1 }
 
#define OFFSET(x)   offsetof(ScaleVulkanContext, x)
 
#define FLAGS   (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
 

Enumerations

enum  ScalerFunc { F_BILINEAR = 0, F_NEAREST, F_NB }
 

Functions

static av_cold int init_filter (AVFilterContext *ctx, AVFrame *in)
 
static int process_frames (AVFilterContext *avctx, AVFrame *out_f, AVFrame *in_f)
 
static int scale_vulkan_filter_frame (AVFilterLink *link, AVFrame *in)
 
static int scale_vulkan_config_output (AVFilterLink *outlink)
 
static void scale_vulkan_uninit (AVFilterContext *avctx)
 
 AVFILTER_DEFINE_CLASS (scale_vulkan)
 

Variables

static const char scale_bilinear []
 
static const char rgb2yuv []
 
static const char write_nv12 []
 
static const char write_420 []
 
static const char write_444 []
 
static const AVOption scale_vulkan_options []
 
static const AVFilterPad scale_vulkan_inputs []
 
static const AVFilterPad scale_vulkan_outputs []
 
AVFilter ff_vf_scale_vulkan
 

Macro Definition Documentation

#define CGROUPS   (int [3]){ 32, 32, 1 }

Definition at line 25 of file vf_scale_vulkan.c.

Referenced by init_filter(), and process_frames().

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

Definition at line 486 of file vf_scale_vulkan.c.

Definition at line 487 of file vf_scale_vulkan.c.

Enumeration Type Documentation

enum ScalerFunc
Enumerator
F_BILINEAR 
F_NEAREST 
F_NB 

Definition at line 27 of file vf_scale_vulkan.c.

Function Documentation

static av_cold int init_filter ( AVFilterContext ctx,
AVFrame in 
)
static

Definition at line 106 of file vf_scale_vulkan.c.

Referenced by scale_vulkan_filter_frame().

static int process_frames ( AVFilterContext avctx,
AVFrame out_f,
AVFrame in_f 
)
static

Definition at line 293 of file vf_scale_vulkan.c.

Referenced by scale_vulkan_filter_frame().

static int scale_vulkan_filter_frame ( AVFilterLink link,
AVFrame in 
)
static

Definition at line 393 of file vf_scale_vulkan.c.

static int scale_vulkan_config_output ( AVFilterLink outlink)
static

Definition at line 430 of file vf_scale_vulkan.c.

static void scale_vulkan_uninit ( AVFilterContext avctx)
static

Definition at line 476 of file vf_scale_vulkan.c.

AVFILTER_DEFINE_CLASS ( scale_vulkan  )

Variable Documentation

const char scale_bilinear[]
static
Initial value:
= {
C(0, vec4 scale_bilinear(int idx, ivec2 pos, vec2 crop_range, vec2 crop_off))
C(0, { )
C(1, vec2 npos = (vec2(pos) + 0.5f) / imageSize(output_img[idx]); )
C(1, npos *= crop_range; )
C(1, npos += crop_off; )
C(1, return texture(input_img[idx], npos); )
C(0, } )
}
#define f(width, name)
Definition: cbs_vp9.c:255
static const char scale_bilinear[]
unsigned int pos
Definition: spdifenc.c:410
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C

Definition at line 54 of file vf_scale_vulkan.c.

Referenced by init_filter().

const char rgb2yuv[]
static
Initial value:
= {
C(0, vec4 rgb2yuv(vec4 src, int fullrange) )
C(0, { )
C(1, src *= yuv_matrix; )
C(1, if (fullrange == 1) { )
C(2, src += vec4(0.0, 0.5, 0.5, 0.0); )
C(1, } else { )
C(2, src *= vec4(219.0 / 255.0, 224.0 / 255.0, 224.0 / 255.0, 1.0); )
C(2, src += vec4(16.0 / 255.0, 128.0 / 255.0, 128.0 / 255.0, 0.0); )
C(1, } )
C(1, return src; )
C(0, } )
}
static const char rgb2yuv[]
#define src
Definition: vp8dsp.c:254
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C
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 the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a it should return

Definition at line 64 of file vf_scale_vulkan.c.

Referenced by bayer_to_yv12_wrapper(), create_filtergraph(), init_filter(), tonemap_opencl_init(), uyvytoyv12_TMPL(), yv12_copy(), and yv12_interpolate().

const char write_nv12[]
static
Initial value:
= {
C(0, void write_nv12(vec4 src, ivec2 pos) )
C(0, { )
C(1, imageStore(output_img[0], pos, vec4(src.r, 0.0, 0.0, 0.0)); )
C(1, pos /= ivec2(2); )
C(1, imageStore(output_img[1], pos, vec4(src.g, src.b, 0.0, 0.0)); )
C(0, } )
}
const char * g
Definition: vf_curves.c:115
#define src
Definition: vp8dsp.c:254
unsigned int pos
Definition: spdifenc.c:410
#define b
Definition: input.c:41
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C
static const char write_nv12[]

Definition at line 78 of file vf_scale_vulkan.c.

Referenced by init_filter().

const char write_420[]
static
Initial value:
= {
C(0, void write_420(vec4 src, ivec2 pos) )
C(0, { )
C(1, imageStore(output_img[0], pos, vec4(src.r, 0.0, 0.0, 0.0)); )
C(1, pos /= ivec2(2); )
C(1, imageStore(output_img[1], pos, vec4(src.g, 0.0, 0.0, 0.0)); )
C(1, imageStore(output_img[2], pos, vec4(src.b, 0.0, 0.0, 0.0)); )
C(0, } )
}
const char * g
Definition: vf_curves.c:115
static const char write_420[]
#define src
Definition: vp8dsp.c:254
unsigned int pos
Definition: spdifenc.c:410
#define b
Definition: input.c:41
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C

Definition at line 87 of file vf_scale_vulkan.c.

Referenced by init_filter().

const char write_444[]
static
Initial value:
= {
C(0, void write_444(vec4 src, ivec2 pos) )
C(0, { )
C(1, imageStore(output_img[0], pos, vec4(src.r, 0.0, 0.0, 0.0)); )
C(1, imageStore(output_img[1], pos, vec4(src.g, 0.0, 0.0, 0.0)); )
C(1, imageStore(output_img[2], pos, vec4(src.b, 0.0, 0.0, 0.0)); )
C(0, } )
}
const char * g
Definition: vf_curves.c:115
static const char write_444[]
#define src
Definition: vp8dsp.c:254
unsigned int pos
Definition: spdifenc.c:410
#define b
Definition: input.c:41
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C

Definition at line 97 of file vf_scale_vulkan.c.

Referenced by init_filter().

const AVOption scale_vulkan_options[]
static
Initial value:
= {
{ "w", "Output video width", OFFSET(w_expr), AV_OPT_TYPE_STRING, {.str = "iw"}, .flags = FLAGS },
{ "h", "Output video height", OFFSET(h_expr), AV_OPT_TYPE_STRING, {.str = "ih"}, .flags = FLAGS },
{ "scaler", "Scaler function", OFFSET(scaler), AV_OPT_TYPE_INT, {.i64 = F_BILINEAR}, 0, F_NB, .flags = FLAGS, "scaler" },
{ "bilinear", "Bilinear interpolation (fastest)", 0, AV_OPT_TYPE_CONST, {.i64 = F_BILINEAR}, 0, 0, .flags = FLAGS, "scaler" },
{ "nearest", "Nearest (useful for pixel art)", 0, AV_OPT_TYPE_CONST, {.i64 = F_NEAREST}, 0, 0, .flags = FLAGS, "scaler" },
{ "format", "Output video format (software format of hardware frames)", OFFSET(out_format_string), AV_OPT_TYPE_STRING, .flags = FLAGS },
{ "out_range", "Output colour range (from 0 to 2) (default 0)", OFFSET(out_range), AV_OPT_TYPE_INT, {.i64 = AVCOL_RANGE_UNSPECIFIED}, AVCOL_RANGE_UNSPECIFIED, AVCOL_RANGE_JPEG, .flags = FLAGS, "range" },
{ "full", "Full range", 0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_JPEG }, 0, 0, FLAGS, "range" },
{ "limited", "Limited range", 0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_MPEG }, 0, 0, FLAGS, "range" },
{ "jpeg", "Full range", 0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_JPEG }, 0, 0, FLAGS, "range" },
{ "mpeg", "Limited range", 0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_MPEG }, 0, 0, FLAGS, "range" },
{ "tv", "Limited range", 0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_MPEG }, 0, 0, FLAGS, "range" },
{ "pc", "Full range", 0, AV_OPT_TYPE_CONST, { .i64 = AVCOL_RANGE_JPEG }, 0, 0, FLAGS, "range" },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define FLAGS
the normal 2^n-1 "JPEG" YUV ranges
Definition: pixfmt.h:535
the normal 219*2^(n-8) "MPEG" YUV ranges
Definition: pixfmt.h:534
#define OFFSET(x)

Definition at line 488 of file vf_scale_vulkan.c.

const AVFilterPad scale_vulkan_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = &scale_vulkan_filter_frame,
.config_props = &ff_vk_filter_config_input,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int scale_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
int ff_vk_filter_config_input(AVFilterLink *inlink)
Definition: vulkan.c:610

Definition at line 507 of file vf_scale_vulkan.c.

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

Definition at line 517 of file vf_scale_vulkan.c.

AVFilter ff_vf_scale_vulkan
Initial value:
= {
.name = "scale_vulkan",
.description = NULL_IF_CONFIG_SMALL("Scale Vulkan frames"),
.priv_size = sizeof(ScaleVulkanContext),
.priv_class = &scale_vulkan_class,
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
Definition: internal.h:365
static const AVFilterPad scale_vulkan_outputs[]
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:279
int ff_vk_filter_init(AVFilterContext *avctx)
Definition: vulkan.c:731
int ff_vk_filter_query_formats(AVFilterContext *avctx)
General lavfi IO functions.
Definition: vulkan.c:567
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
static const AVFilterPad scale_vulkan_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
static int query_formats(AVFilterContext *ctx)
Definition: aeval.c:244
static void scale_vulkan_uninit(AVFilterContext *avctx)

Definition at line 526 of file vf_scale_vulkan.c.