Go to the documentation of this file.
55 ctx->hwctx =
ctx->device->hwctx;
67 if (!
inlink->hw_frames_ctx) {
69 "hardware frames context on the input.\n");
88 if (!
ctx->output_width)
90 if (!
ctx->output_height)
106 if (!
ctx->device_ref) {
119 if (!output_frames_ref) {
127 output_frames->
width =
ctx->output_width;
128 output_frames->
height =
ctx->output_height;
133 "frames: %d.\n", err);
138 outlink->
w =
ctx->output_width;
139 outlink->
h =
ctx->output_height;
162 cle = clReleaseProgram(
ctx->program);
163 if (cle != CL_SUCCESS)
165 "program: %d.\n", cle);
172 const char **program_source_array,
178 ctx->program = clCreateProgramWithSource(
ctx->hwctx->context, nb_strings,
179 program_source_array,
186 cle = clBuildProgram(
ctx->program, 1, &
ctx->hwctx->device_id,
188 if (cle != CL_SUCCESS) {
191 if (cle == CL_BUILD_PROGRAM_FAILURE) {
195 clGetProgramBuildInfo(
ctx->program,
ctx->hwctx->device_id,
196 CL_PROGRAM_BUILD_LOG, 0,
NULL, &log_length);
200 cle = clGetProgramBuildInfo(
ctx->program,
201 ctx->hwctx->device_id,
202 CL_PROGRAM_BUILD_LOG,
203 log_length, log,
NULL);
204 if (cle == CL_SUCCESS)
211 clReleaseProgram(
ctx->program);
220 const char *filename)
225 const char *src_const;
231 "source file \"%s\".\n", filename);
255 if (rb == 0 && ferror(
file)) {
284 cl_mem_object_type
type;
294 image = (cl_mem)
frame->data[plane];
301 cle = clGetMemObjectInfo(image, CL_MEM_TYPE,
sizeof(
type),
303 if (cle != CL_SUCCESS) {
305 "plane %d: %d.\n", plane, cle);
308 if (
type != CL_MEM_OBJECT_IMAGE2D) {
314 cle = clGetImageInfo(image, CL_IMAGE_WIDTH,
sizeof(
size_t),
316 if (cle != CL_SUCCESS) {
322 cle = clGetImageInfo(image, CL_IMAGE_HEIGHT,
sizeof(
size_t),
324 if (cle != CL_SUCCESS) {
330 if (block_alignment) {
335 work_size[0] =
width;
345 av_bprintf(buf,
"__constant float %s[9] = {\n", name_str);
346 for (
i = 0;
i < 3;
i++) {
347 for (j = 0; j < 3; j++)
358 clGetEventProfilingInfo(event, CL_PROFILING_COMMAND_START,
sizeof(time_start), &time_start,
NULL);
359 clGetEventProfilingInfo(event, CL_PROFILING_COMMAND_END,
sizeof(time_end), &time_end,
NULL);
361 return time_end - time_start;
AVPixelFormat
Pixel format.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
uint8_t * data
The data buffer.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
This structure describes decoded (raw) audio or video data.
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
AVBufferRef * hw_device_ctx
For filters which will create hardware frames, sets the device the filter should create them in.
int ff_opencl_filter_load_program(AVFilterContext *avctx, const char **program_source_array, int nb_strings)
Load a new OpenCL program from strings in memory.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
int width
The allocated dimensions of the frames in this pool.
A link between two filters.
int ff_opencl_filter_work_size_from_image(AVFilterContext *avctx, size_t *work_size, AVFrame *frame, int plane, int block_alignment)
Find the work size needed needed for a given plane of an image.
void * priv
private data for use by the filter
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
int ff_opencl_filter_config_output(AVFilterLink *outlink)
Create a suitable hardware frames context for the output.
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
FILE * av_fopen_utf8(const char *path, const char *mode)
Open a file using a UTF-8 filename.
static enum AVPixelFormat pix_fmts[]
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
AVBufferRef * device_ref
A reference to the parent AVHWDeviceContext.
AVFilterLink ** inputs
array of pointers to input links
static int opencl_filter_set_device(AVFilterContext *avctx, AVBufferRef *device)
@ AV_PIX_FMT_OPENCL
Hardware surfaces for OpenCL.
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
AVFilterContext * src
source filter
int ff_opencl_filter_config_input(AVFilterLink *inlink)
Check that the input link contains a suitable hardware frames context and extract the device from it.
#define i(width, name, range_min, range_max)
int w
agreed upon image width
AVBufferRef * hw_frames_ctx
For hwaccel pixel formats, this should be a reference to the AVHWFramesContext describing the frames.
void ff_opencl_print_const_matrix_3x3(AVBPrint *buf, const char *name_str, double mat[3][3])
Print a 3x3 matrix into a buffer as __constant array, which could be included in an OpenCL program.
This struct describes a set or pool of "hardware" frames (i.e.
int ff_opencl_filter_init(AVFilterContext *avctx)
Initialise an OpenCL filter context.
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 frame
void av_bprintf(AVBPrint *buf, const char *fmt,...)
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 file
int h
agreed upon image height
int ff_opencl_filter_load_program_from_file(AVFilterContext *avctx, const char *filename)
Load a new OpenCL program from a file.
void ff_opencl_filter_uninit(AVFilterContext *avctx)
Uninitialise an OpenCL filter context.
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
A reference to a data buffer.
cl_ulong ff_opencl_get_event_time(cl_event event)
Gets the command start and end times for the given event and returns the difference (the time that th...
int ff_opencl_filter_query_formats(AVFilterContext *avctx)
Return that all inputs and outputs support only AV_PIX_FMT_OPENCL.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.