Go to the documentation of this file.
53 ctx->command_queue = clCreateCommandQueue(
ctx->ocf.hwctx->context,
54 ctx->ocf.hwctx->device_id,
57 "command queue %d.\n", cle);
59 ctx->kernel = clCreateKernel(
ctx->ocf.program,
"transpose", &cle);
67 if (
ctx->command_queue)
68 clReleaseCommandQueue(
ctx->command_queue);
70 clReleaseKernel(
ctx->kernel);
86 if (
inlink->hw_frames_ctx) {
92 "w:%d h:%d -> w:%d h:%d (passthrough mode)\n",
106 s->ocf.output_width =
inlink->h;
107 s->ocf.output_height =
inlink->w;
112 if (
inlink->sample_aspect_ratio.num)
114 inlink->sample_aspect_ratio);
119 "w:%d h:%d dir:%d -> w:%d h:%d rotation:%s vflip:%d\n",
121 s->dir == 1 ||
s->dir == 3 ?
"clockwise" :
"counterclockwise",
122 s->dir == 0 ||
s->dir == 3);
130 return s->passthrough ?
141 size_t global_work[2];
150 if (!
input->hw_frames_ctx)
153 if (
ctx->passthrough)
166 if (
input->sample_aspect_ratio.num == 0) {
167 output->sample_aspect_ratio =
input->sample_aspect_ratio;
169 output->sample_aspect_ratio.num =
input->sample_aspect_ratio.den;
170 output->sample_aspect_ratio.den =
input->sample_aspect_ratio.num;
173 if (!
ctx->initialised) {
181 dst = (cl_mem)
output->data[p];
192 cle = clEnqueueNDRangeKernel(
ctx->command_queue,
ctx->kernel, 2,
NULL,
197 cle = clFinish(
ctx->command_queue);
209 clFinish(
ctx->command_queue);
221 cle = clReleaseKernel(
ctx->kernel);
222 if (cle != CL_SUCCESS)
224 "kernel: %d.\n", cle);
227 if (
ctx->command_queue) {
228 cle = clReleaseCommandQueue(
ctx->command_queue);
229 if (cle != CL_SUCCESS)
231 "command queue: %d.\n", cle);
237 #define OFFSET(x) offsetof(TransposeOpenCLContext, x)
238 #define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
246 {
"passthrough",
"do not apply transposition if the input matches the specified geometry",
278 .
name =
"transpose_opencl",
281 .priv_class = &transpose_opencl_class,
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
static av_cold int init(AVCodecContext *avctx)
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
#define CL_SET_KERNEL_ARG(kernel, arg_num, type, arg)
set argument to specific Kernel.
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
static const AVFilterPad transpose_opencl_outputs[]
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another.
AVFilter ff_vf_transpose_opencl
static int transpose_opencl_init(AVFilterContext *avctx)
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
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
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
#define AV_LOG_VERBOSE
Detailed information.
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.
const char * name
Filter name.
A link between two filters.
static int transpose_opencl_config_output(AVFilterLink *outlink)
AVFrame * ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
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
static AVFrame * get_video_buffer(AVFilterLink *inlink, int w, int h)
int ff_opencl_filter_config_output(AVFilterLink *outlink)
Create a suitable hardware frames context for the output.
A filter pad used for either input or output.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
static const AVFilterPad outputs[]
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Rational number (pair of numerator and denominator).
AVFilterLink ** inputs
array of pointers to input links
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
const char * ff_opencl_source_transpose
@ TRANSPOSE_PT_TYPE_PORTRAIT
static const AVFilterPad transpose_opencl_inputs[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
AVFilterContext * src
source filter
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
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.
AVFrame * ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
cl_command_queue command_queue
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.
static int transpose_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
const char * name
Pad name.
int ff_opencl_filter_init(AVFilterContext *avctx)
Initialise an OpenCL filter context.
int passthrough
PassthroughType, landscape passthrough mode enabled.
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
#define FF_ARRAY_ELEMS(a)
int h
agreed upon image height
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.
@ TRANSPOSE_PT_TYPE_LANDSCAPE
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
AVFILTER_DEFINE_CLASS(transpose_opencl)
static int query_formats(AVFilterContext *ctx)
#define CL_FAIL_ON_ERROR(errcode,...)
A helper macro to handle OpenCL errors.
static av_cold int uninit(AVCodecContext *avctx)
static av_cold void transpose_opencl_uninit(AVFilterContext *avctx)
static const AVOption transpose_opencl_options[]
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
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.
AVFilterLink ** outputs
array of pointers to output links