41 type, size, 1, (
void*)data, &buffer);
42 if (vas != VA_STATUS_SUCCESS) {
44 "buffer (type %d): %d (%s).\n",
45 type, vas, vaErrorStr(vas));
52 "is %#x.\n", type, size, buffer);
59 const void *params_data,
61 const void *slice_data,
87 VASliceParameterBufferType,
88 params_size, 1, (
void*)params_data,
90 if (vas != VA_STATUS_SUCCESS) {
92 "parameter buffer: %d (%s).\n", vas, vaErrorStr(vas));
101 VASliceDataBufferType,
102 slice_size, 1, (
void*)slice_data,
104 if (vas != VA_STATUS_SUCCESS) {
106 "data buffer (size %zu): %d (%s).\n",
107 slice_size, vas, vaErrorStr(vas));
131 if (vas != VA_STATUS_SUCCESS) {
133 "parameter buffer %#x: %d (%s).\n",
138 for (i = 0; i < 2 * pic->
nb_slices; i++) {
141 if (vas != VA_STATUS_SUCCESS) {
143 "slice buffer %#x: %d (%s).\n",
161 if (vas != VA_STATUS_SUCCESS) {
163 "issue: %d (%s).\n", vas, vaErrorStr(vas));
165 goto fail_with_picture;
170 if (vas != VA_STATUS_SUCCESS) {
172 "parameters: %d (%s).\n", vas, vaErrorStr(vas));
174 goto fail_with_picture;
179 if (vas != VA_STATUS_SUCCESS) {
181 "%d (%s).\n", vas, vaErrorStr(vas));
183 goto fail_with_picture;
187 if (vas != VA_STATUS_SUCCESS) {
189 "issue: %d (%s).\n", vas, vaErrorStr(vas));
211 if (vas != VA_STATUS_SUCCESS) {
213 "after error: %d (%s).\n", vas, vaErrorStr(vas));
234 static const struct {
239 #define MAP(c, p, v) { AV_CODEC_ID_ ## c, FF_PROFILE_ ## p, VAProfile ## v }
240 MAP(MPEG2VIDEO, MPEG2_SIMPLE, MPEG2Simple ),
241 MAP(MPEG2VIDEO, MPEG2_MAIN, MPEG2Main ),
243 MAP(MPEG4, MPEG4_SIMPLE, MPEG4Simple ),
244 MAP(MPEG4, MPEG4_ADVANCED_SIMPLE,
245 MPEG4AdvancedSimple),
246 MAP(MPEG4, MPEG4_MAIN, MPEG4Main ),
247 MAP(H264, H264_CONSTRAINED_BASELINE,
248 H264ConstrainedBaseline),
249 MAP(H264, H264_BASELINE, H264Baseline),
250 MAP(H264, H264_MAIN, H264Main ),
251 MAP(H264, H264_HIGH, H264High ),
252 #if VA_CHECK_VERSION(0, 37, 0)
253 MAP(HEVC, HEVC_MAIN, HEVCMain ),
254 MAP(HEVC, HEVC_MAIN_10, HEVCMain10 ),
256 MAP(WMV3, VC1_SIMPLE, VC1Simple ),
257 MAP(WMV3, VC1_MAIN, VC1Main ),
258 MAP(WMV3, VC1_COMPLEX, VC1Advanced ),
259 MAP(WMV3, VC1_ADVANCED, VC1Advanced ),
260 MAP(VC1, VC1_SIMPLE, VC1Simple ),
261 MAP(VC1, VC1_MAIN, VC1Main ),
262 MAP(VC1, VC1_COMPLEX, VC1Advanced ),
263 MAP(VC1, VC1_ADVANCED, VC1Advanced ),
264 #if VA_CHECK_VERSION(0, 35, 0)
267 #if VA_CHECK_VERSION(0, 38, 0)
268 MAP(VP9, VP9_0, VP9Profile0 ),
270 #if VA_CHECK_VERSION(0, 39, 0)
271 MAP(VP9, VP9_2, VP9Profile2 ),
286 int profile_count, exact_match, alt_profile;
295 int allow_profile_mismatch = 0;
312 profile_list, &profile_count);
313 if (vas != VA_STATUS_SUCCESS) {
315 "%d (%s).\n", vas, vaErrorStr(vas));
320 profile = VAProfileNone;
324 int profile_match = 0;
330 for (j = 0; j < profile_count; j++) {
331 if (profile == profile_list[j]) {
332 exact_match = profile_match;
336 if (j < profile_count) {
344 if (profile == VAProfileNone) {
346 "profile %d.\n", codec_desc->
name, avctx->
profile);
351 if (allow_profile_mismatch) {
353 "supported for hardware decode.\n",
356 "incompatible profile %d instead.\n",
360 "supported for hardware decode.\n",
373 if (vas != VA_STATUS_SUCCESS) {
375 "configuration: %d (%s).\n", vas, vaErrorStr(vas));
404 "size %dx%d (constraints: width %d-%d height %d-%d).\n",
414 "usable surface formats.\n");
435 if (j < desc->nb_components)
487 #if FF_API_STRUCT_VAAPI_CONTEXT
490 "vaapi_context in decode.\n");
532 "decoding must be a VAAPI device (not %d).\n",
540 "is required for VAAPI decoding.\n");
545 #if FF_API_STRUCT_VAAPI_CONTEXT
577 "frames context: %d.\n", err);
590 if (vas != VA_STATUS_SUCCESS) {
592 "context: %d (%s).\n", vas, vaErrorStr(vas));
599 #if FF_API_STRUCT_VAAPI_CONTEXT
615 #if FF_API_STRUCT_VAAPI_CONTEXT
623 if (vas != VA_STATUS_SUCCESS) {
625 "context %#x: %d (%s).\n",
631 if (vas != VA_STATUS_SUCCESS) {
633 "configuration %#x: %d (%s).\n",
638 #if FF_API_STRUCT_VAAPI_CONTEXT
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
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)
ptrdiff_t const GLvoid * data
int coded_width
Bitstream width / height, may be different from width/height e.g.
#define AV_LOG_WARNING
Something somehow does not look correct.
static void ff_vaapi_decode_destroy_buffers(AVCodecContext *avctx, VAAPIDecodePicture *pic)
int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, int type, const void *data, size_t size)
uint32_t context_id
Context ID (video decode pipeline)
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.
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
int max_width
The maximum size of frames in this hw_frames_ctx.
void av_hwframe_constraints_free(AVHWFramesConstraints **constraints)
Free an AVHWFrameConstraints structure.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_vaapi_decode_uninit(AVCodecContext *avctx)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
void * hwaccel_context
Hardware accelerator context.
int ff_vaapi_decode_issue(AVCodecContext *avctx, VAAPIDecodePicture *pic)
static int vaapi_decode_make_config(AVCodecContext *avctx)
AVHWFramesContext * frames
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
AVVAAPIDeviceContext * hwctx
#define AV_LOG_VERBOSE
Detailed information.
enum AVPixelFormat surface_format
VAEntrypoint va_entrypoint
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVVAAPIFramesContext * hwfc
VAAPI hardware pipeline configuration details.
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
int active_thread_type
Which multithreading methods are in use by the codec.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
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.
enum AVHWDeviceType type
This field identifies the underlying API used for hardware access.
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
int initial_pool_size
Initial size of the frame pool.
uint8_t nb_components
The number of components each pixel has, (1-4)
#define FF_THREAD_FRAME
Decode more than one frame at once.
AVHWDeviceContext * device_ctx
The parent AVHWDeviceContext.
int ff_vaapi_decode_init(AVCodecContext *avctx)
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames...
VABufferID * slice_buffers
struct vaapi_context * old_context
#define FF_ARRAY_ELEMS(a)
VABufferID param_buffers[MAX_PARAM_BUFFERS]
int thread_count
thread count is used to decide how many independent tasks should be passed to execute() ...
VADisplay display
The VADisplay handle, to be filled by the user.
VASurfaceID output_surface
void * display
Window system dependent data.
int min_width
The minimum size of frames in this hw_frames_ctx.
AVBufferRef * av_hwdevice_ctx_alloc(enum AVHWDeviceType type)
Allocate an AVHWDeviceContext for a given hardware type.
Libavcodec external API header.
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...
main external API structure.
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...
uint8_t * data
The data buffer.
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...
This struct describes a set or pool of "hardware" frames (i.e.
const char * name
Name of the codec described by this descriptor.
int ff_vaapi_decode_cancel(AVCodecContext *avctx, VAAPIDecodePicture *pic)
This struct describes the properties of a single codec described by an AVCodecID. ...
AVBufferRef * device_ref
A reference to the parent AVHWDeviceContext.
AVHWDeviceContext * device
common internal api header.
common internal and external API header
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
void * hwaccel_priv_data
hwaccel-specific private data
The driver does not destroy parameter buffers when they are used by vaRenderPicture().
struct AVCodecInternal * internal
Private context used for internal data.
enum AVPixelFormat * valid_sw_formats
A list of possible values for sw_format in the hw_frames_ctx, terminated by AV_PIX_FMT_NONE.
VAConfigID config_id
ID of a VAAPI pipeline configuration.
VASurfaceID * surface_ids
The surfaces IDs of all surfaces in the pool after creation.
#define av_malloc_array(a, b)
static const struct @124 vaapi_profile_map[]
int depth
Number of bits in the component.
AVBufferRef * hw_device_ctx
A reference to the AVHWDeviceContext describing the device which will be used by a hardware encoder/d...
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, const void *params_data, size_t params_size, const void *slice_data, size_t slice_size)
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
uint32_t config_id
Configuration ID.