80 "required to associate the processing device.\n");
124 vas = vaCreateConfig(ctx->
hwctx->
display, VAProfileNone,
126 if (vas != VA_STATUS_SUCCESS) {
128 "config: %d (%s).\n", vas, vaErrorStr(vas));
167 "size %dx%d (constraints: width %d-%d height %d-%d).\n",
199 "context for output: %d\n", err);
203 va_frames = output_frames->
hwctx;
211 if (vas != VA_STATUS_SUCCESS) {
213 "context: %d (%s).\n", vas, vaErrorStr(vas));
252 { VAProcColorStandardBT601, 5, 6, 5 },
253 { VAProcColorStandardBT601, 6, 6, 6 },
254 { VAProcColorStandardBT709, 1, 1, 1 },
255 { VAProcColorStandardBT470M, 4, 4, 4 },
256 { VAProcColorStandardBT470BG, 5, 5, 5 },
257 { VAProcColorStandardSMPTE170M, 6, 6, 6 },
258 { VAProcColorStandardSMPTE240M, 7, 7, 7 },
259 { VAProcColorStandardGenericFilm, 8, 1, 1 },
260 #if VA_CHECK_VERSION(1, 1, 0) 261 { VAProcColorStandardSRGB, 1, 13, 0 },
262 { VAProcColorStandardXVYCC601, 1, 11, 5 },
263 { VAProcColorStandardXVYCC709, 1, 11, 1 },
264 { VAProcColorStandardBT2020, 9, 14, 9 },
269 VAProcColorStandardType *vacs,
273 int i, j, score, best_score, worst_score;
274 VAProcColorStandardType best_standard;
276 #if VA_CHECK_VERSION(1, 3, 0) 281 for (i = 0; i < nb_vacs; i++) {
282 if (vacs[i] == VAProcColorStandardExplicit) {
294 best_standard = VAProcColorStandardNone;
301 if (worst_score == 0) {
308 for (i = 0; i < nb_vacs; i++) {
310 t = &vaapi_colour_standard_map[j];
324 if (score < worst_score &&
325 (best_score == -1 || score < best_score)) {
336 #if VA_CHECK_VERSION(1, 1, 0) 337 static const struct {
343 VA_CHROMA_SITING_HORIZONTAL_LEFT },
345 VA_CHROMA_SITING_HORIZONTAL_CENTER },
347 VA_CHROMA_SITING_HORIZONTAL_LEFT },
349 VA_CHROMA_SITING_HORIZONTAL_CENTER },
351 VA_CHROMA_SITING_HORIZONTAL_LEFT },
353 VA_CHROMA_SITING_HORIZONTAL_CENTER },
371 #if VA_CHECK_VERSION(1, 1, 0) 390 VAProcColorStandardType *vacs,
398 "to VA standard %d chroma siting %#x range %#x.\n",
421 VAProcPipelineParameterBuffer *
params,
427 VAProcPipelineCaps caps;
433 if (vas != VA_STATUS_SUCCESS) {
435 "colour standard support: %d (%s).\n", vas, vaErrorStr(vas));
449 caps.input_color_standards,
450 caps.num_input_color_standards);
461 caps.output_color_standards,
462 caps.num_output_color_standards);
466 #if VA_CHECK_VERSION(1, 3, 0) 476 output_standard = &vaapi_colour_standard_map[
i];
480 if (output_standard) {
491 #if VA_CHECK_VERSION(1, 1, 0) 492 params->input_color_properties = (VAProcColorProperties) {
495 #if VA_CHECK_VERSION(1, 3, 0) 497 .transfer_characteristics = input_props.
color_trc,
498 .matrix_coefficients = input_props.
colorspace,
501 params->output_color_properties = (VAProcColorProperties) {
504 #if VA_CHECK_VERSION(1, 3, 0) 506 .transfer_characteristics = output_props.
color_trc,
507 .matrix_coefficients = output_props.
colorspace,
516 VAProcPipelineParameterBuffer *
params,
521 VASurfaceID input_surface;
527 .width = input_frame->
width -
537 input_surface = (VASurfaceID)(uintptr_t)input_frame->
data[3],
539 *params = (VAProcPipelineParameterBuffer) {
540 .surface = input_surface,
542 .output_region =
NULL,
545 .filter_flags = VA_FRAME_PICTURE,
549 #if VA_CHECK_VERSION(1, 1, 0) 550 .rotation_state = VA_ROTATION_NONE,
551 .mirror_state = VA_MIRROR_NONE,
556 input_frame, output_frame);
576 type, size, count, (
void*)data, &buffer);
577 if (vas != VA_STATUS_SUCCESS) {
579 "buffer (type %d): %d (%s).\n",
580 type, vas, vaErrorStr(vas));
587 "is %#x.\n", type, size, count, buffer);
593 VAProcPipelineParameterBuffer *
params,
597 VASurfaceID output_surface;
598 VABufferID params_id;
602 output_surface = (VASurfaceID)(uintptr_t)output_frame->
data[3];
606 if (vas != VA_STATUS_SUCCESS) {
608 "%d (%s).\n", vas, vaErrorStr(vas));
614 VAProcPipelineParameterBufferType,
615 sizeof(*params), 1, params, ¶ms_id);
616 if (vas != VA_STATUS_SUCCESS) {
618 "%d (%s).\n", vas, vaErrorStr(vas));
620 goto fail_after_begin;
627 if (vas != VA_STATUS_SUCCESS) {
629 "%d (%s).\n", vas, vaErrorStr(vas));
631 goto fail_after_begin;
635 if (vas != VA_STATUS_SUCCESS) {
637 "%d (%s).\n", vas, vaErrorStr(vas));
639 goto fail_after_render;
645 if (vas != VA_STATUS_SUCCESS) {
647 "%d (%s).\n", vas, vaErrorStr(vas));
675 for (i = 0; i < VAProcFilterCount; i++)
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
static int vaapi_vpp_colour_properties(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, const AVFrame *input_frame, AVFrame *output_frame)
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
MPEG-2/4 4:2:0, H.264 default for 4:2:0.
VAAPI-specific data associated with a frame pool.
This structure describes decoded (raw) audio or video data.
int ff_vaapi_vpp_config_input(AVFilterLink *inlink)
ptrdiff_t const GLvoid * data
int ff_vaapi_vpp_config_output(AVFilterLink *outlink)
int h
agreed upon image height
int width
The allocated dimensions of the frames in this pool.
void * av_hwdevice_hwconfig_alloc(AVBufferRef *ref)
Allocate a HW-specific configuration structure for a given HW device.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
AVFilterFormatsConfig outcfg
Lists of supported formats / etc.
order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
int max_width
The maximum size of frames in this hw_frames_ctx.
AVColorTransferCharacteristic
Color Transfer Characteristic.
const char * av_color_space_name(enum AVColorSpace space)
void av_hwframe_constraints_free(AVHWFramesConstraints **constraints)
Free an AVHWFrameConstraints structure.
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame...
AVFilterLink ** inputs
array of pointers to input links
#define av_assert0(cond)
assert() equivalent, that is always enabled.
enum AVColorRange color_range
AVColorSpace
YUV colorspace type.
const char * av_color_range_name(enum AVColorRange range)
AVColorRange
Visual content value range.
AVColorPrimaries
Chromaticity coordinates of the source primaries.
A link between two filters.
const char * av_chroma_location_name(enum AVChromaLocation location)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
VAAPI hardware pipeline configuration details.
static void vaapi_vpp_fill_chroma_sample_location(VAAPIColourProperties *props)
AVBufferRef * input_frames_ref
#define AV_PIX_FMT_FLAG_RGB
The pixel format contains RGB-like data (as opposed to YUV/grayscale).
static void vaapi_vpp_fill_colour_properties(AVFilterContext *avctx, VAAPIColourProperties *props, VAProcColorStandardType *vacs, int nb_vacs)
void * priv
private data for use by the filter
enum AVColorRange color_range
MPEG vs JPEG YUV range.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
enum AVColorSpace colorspace
YUV colorspace type.
simple assert() macros that are a bit more flexible than ISO C assert().
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
int ff_vaapi_vpp_make_param_buffers(AVFilterContext *avctx, int type, const void *data, size_t size, int count)
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
enum AVColorSpace colorspace
int w
agreed upon image width
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
int initial_pool_size
Initial size of the frame pool.
enum AVChromaLocation chroma_sample_location
AVBufferRef * hw_frames_ctx
For hwaccel pixel formats, this should be a reference to the AVHWFramesContext describing the frames...
void ff_vaapi_vpp_pipeline_uninit(AVFilterContext *avctx)
ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2.
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
enum AVColorPrimaries color_primaries
AVFilterContext * src
source filter
#define FF_ARRAY_ELEMS(a)
VADisplay display
The VADisplay handle, to be filled by the user.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
int min_width
The minimum size of frames in this hw_frames_ctx.
enum AVColorTransferCharacteristic color_trc
This struct describes the constraints on hardware frames attached to a given device with a hardware-s...
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
static int vaapi_vpp_frame_is_rgb(const AVFrame *frame)
AVHWFramesConstraints * av_hwdevice_get_hwframe_constraints(AVBufferRef *ref, const void *hwconfig)
Get the constraints on HW frames given a device and the HW-specific configuration to be used with tha...
static const VAAPIColourProperties vaapi_colour_standard_map[]
uint8_t * data
The data buffer.
VABufferID filter_buffers[VAProcFilterCount]
void * hwctx
The format-specific data, allocated and freed automatically along with this context.
unsigned int driver_quirks
Driver quirks to apply - this is filled by av_hwdevice_ctx_init(), with reference to a table of known...
static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
This struct describes a set or pool of "hardware" frames (i.e.
enum AVChromaLocation chroma_location
AVFilterLink ** outputs
array of pointers to output links
static enum AVPixelFormat pix_fmts[]
enum AVPixelFormat output_format
AVVAAPIDeviceContext * hwctx
uint8_t va_chroma_sample_location
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVBufferRef * device_ref
A reference to the parent AVHWDeviceContext.
int ff_vaapi_vpp_render_picture(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, AVFrame *output_frame)
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
Narrow or limited range content.
static void vaapi_vpp_fill_colour_standard(VAAPIColourProperties *props, VAProcColorStandardType *vacs, int nb_vacs)
int ff_vaapi_vpp_query_formats(AVFilterContext *avctx)
void ff_vaapi_vpp_ctx_init(AVFilterContext *avctx)
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
int ff_filter_init_hw_frames(AVFilterContext *avctx, AVFilterLink *link, int default_pool_size)
Perform any additional setup required for hardware frames.
AVFilterFormatsConfig incfg
Lists of supported formats / etc.
static void vaapi_vpp_fill_colour_range(VAAPIColourProperties *props)
The driver does not destroy parameter buffers when they are used by vaRenderPicture().
AVHWFramesContext * input_frames
AVFilterContext * dst
dest filter
enum AVPixelFormat * valid_sw_formats
A list of possible values for sw_format in the hw_frames_ctx, terminated by AV_PIX_FMT_NONE.
#define VAAPI_VPP_BACKGROUND_BLACK
enum AVColorPrimaries color_primaries
VAConfigID config_id
ID of a VAAPI pipeline configuration.
VASurfaceID * surface_ids
The surfaces IDs of all surfaces in the pool after creation.
AVChromaLocation
Location of chroma samples.
enum AVColorTransferCharacteristic color_trc
MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0.
int ff_vaapi_vpp_init_params(AVFilterContext *avctx, VAProcPipelineParameterBuffer *params, const AVFrame *input_frame, AVFrame *output_frame)
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.
int(* build_filter_params)(AVFilterContext *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
VAProcColorStandardType va_color_standard
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
#define AVERROR_EXTERNAL
Generic error in an external library.
AVPixelFormat
Pixel format.
void(* pipeline_uninit)(AVFilterContext *avctx)
void ff_vaapi_vpp_ctx_uninit(AVFilterContext *avctx)