48 case VDP_STATUS_NO_IMPLEMENTATION:
50 case VDP_STATUS_DISPLAY_PREEMPTED:
52 case VDP_STATUS_INVALID_HANDLE:
54 case VDP_STATUS_INVALID_POINTER:
56 case VDP_STATUS_RESOURCES:
58 case VDP_STATUS_HANDLE_DEVICE_MISMATCH:
60 case VDP_STATUS_ERROR:
79 uint32_t
w = avctx->coded_width;
80 uint32_t
h = avctx->coded_height;
83 switch (avctx->sw_pix_fmt) {
86 t = VDP_CHROMA_TYPE_420;
92 t = VDP_CHROMA_TYPE_422;
98 t = VDP_CHROMA_TYPE_444;
138 VdpVideoSurfaceQueryCapabilities *surface_query_caps;
139 VdpDecoderQueryCapabilities *decoder_query_caps;
141 VdpGetInformationString *info;
142 const char *info_string;
146 uint32_t max_level, max_mb, max_width, max_height;
152 vdctx->
width = UINT32_MAX;
153 vdctx->
height = UINT32_MAX;
164 vdctx->
device = VDP_INVALID_HANDLE;
175 type != VDP_CHROMA_TYPE_420)
199 VDP_FUNC_ID_GET_INFORMATION_STRING,
201 if (status != VDP_STATUS_OK)
206 status = info(&info_string);
207 if (status != VDP_STATUS_OK)
211 int driver_version = 0;
212 sscanf(info_string,
"NVIDIA VDPAU Driver Shared Library %d", &driver_version);
213 if (driver_version < 410) {
220 VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES,
222 if (status != VDP_STATUS_OK)
225 surface_query_caps =
func;
227 status = surface_query_caps(vdctx->
device, type, &supported,
228 &max_width, &max_height);
229 if (status != VDP_STATUS_OK)
231 if (supported != VDP_TRUE ||
232 max_width < width || max_height < height)
236 VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES,
238 if (status != VDP_STATUS_OK)
241 decoder_query_caps =
func;
243 status = decoder_query_caps(vdctx->
device, profile, &supported, &max_level,
244 &max_mb, &max_width, &max_height);
245 #ifdef VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE
246 if ((status != VDP_STATUS_OK || supported != VDP_TRUE) && profile == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE) {
247 profile = VDP_DECODER_PROFILE_H264_MAIN;
248 status = decoder_query_caps(vdctx->
device, profile, &supported,
250 &max_width, &max_height);
253 if (status != VDP_STATUS_OK)
256 if (supported != VDP_TRUE || max_level < level ||
257 max_width < width || max_height < height)
262 if (status != VDP_STATUS_OK)
269 if (status != VDP_STATUS_OK)
276 if (status == VDP_STATUS_OK) {
291 if (vdctx->
device == VDP_INVALID_HANDLE)
293 if (vdctx->
width == UINT32_MAX && vdctx->
height == UINT32_MAX)
297 VDP_FUNC_ID_DECODER_DESTROY, &func);
298 if (status != VDP_STATUS_OK)
312 if (vdctx->
device == VDP_INVALID_HANDLE)
346 status = hwctx->
render2(avctx, frame, (
void *)&pic_ctx->
info,
358 #if CONFIG_MPEG1_VDPAU_HWACCEL || \
359 CONFIG_MPEG2_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL || \
360 CONFIG_VC1_VDPAU_HWACCEL || CONFIG_WMV3_VDPAU_HWACCEL
390 buffers->struct_version = VDP_BITSTREAM_BUFFER_VERSION;
391 buffers->bitstream =
buf;
392 buffers->bitstream_bytes =
size;
396 #if FF_API_VDPAU_PROFILE
399 #define PROFILE(prof) \
401 *profile = VDP_DECODER_PROFILE_##prof; \
411 default:
return AVERROR(EINVAL);
418 default:
return AVERROR(EINVAL);
426 #ifdef VDP_DECODER_PROFILE_H264_EXTENDED
429 default:
return AVERROR(EINVAL);
437 default:
return AVERROR(EINVAL);
451 VdpGetProcAddress *get_proc,
unsigned flags)
463 memset(hwctx, 0,
sizeof(*hwctx));
#define FF_PROFILE_H264_MAIN
#define FF_PROFILE_MPEG4_SIMPLE
const char const char void * val
This struct is allocated as AVHWDeviceContext.hwctx.
#define FF_PROFILE_MPEG2_MAIN
This structure describes decoded (raw) audio or video data.
int(* init)(AVCodecContext *avctx)
Initialize the hwaccel private data.
VdpDevice device
VDPAU device handle.
int coded_width
Bitstream width / height, may be different from width/height e.g.
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
VdpGetProcAddress * get_proc_address
VdpDecoder decoder
VDPAU decoder handle.
int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic_ctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
VdpGetProcAddress * get_proc_address
#define FF_PROFILE_H264_INTRA
int width
The allocated dimensions of the frames in this pool.
int bitstream_buffers_used
Useful bitstream buffers in the bitstream buffers table.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Public libavcodec VDPAU header.
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
AVVDPAUContext * av_vdpau_alloc_context(void)
Allocate an AVVDPAUContext.
AVVDPAUContext * av_alloc_vdpaucontext(void)
allocation function for AVVDPAUContext
int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, uint32_t *width, uint32_t *height)
Gets the parameters to create an adequate VDPAU video surface for the codec context using VDPAU hardw...
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
VdpBitstreamBuffer * bitstream_buffers
Table of bitstream buffers.
#define FF_PROFILE_H264_BASELINE
int ff_vdpau_common_uninit(AVCodecContext *avctx)
void * hwaccel_context
Hardware accelerator context.
VdpGetProcAddress * get_proc_address
VDPAU device driver.
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
VdpDecoder decoder
VDPAU decoder handle.
#define FF_PROFILE_H264_EXTENDED
#define AV_LOG_VERBOSE
Detailed information.
int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile)
Get a decoder profile that should be used for initializing a VDPAU decoder.
#define AV_HWACCEL_FLAG_IGNORE_LEVEL
Hardware acceleration should be used for decoding even if the codec level used is unknown or higher t...
#define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH
Hardware acceleration can output YUV pixel formats with a different chroma sampling than 4:2:0 and/or...
int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, int level)
This structure is used to share data between the libavcodec library and the client video application...
#define MAKE_ACCESSORS(str, name, type, field)
#define FF_PROFILE_H264_HIGH
int bitstream_buffers_allocated
Allocated size of the bitstream_buffers table.
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
int refs
number of reference frames
AVHWDeviceContext * device_ctx
The parent AVHWDeviceContext.
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define FF_PROFILE_VC1_MAIN
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames...
Picture * current_picture_ptr
pointer to the current picture
void * hwaccel_picture_private
Hardware accelerator private data.
static int vdpau_error(VdpStatus status)
static struct ResampleContext * create(struct ResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff, enum AVSampleFormat format, enum SwrFilterType filter_type, double kaiser_beta, double precision, int cheby, int exact_rational)
H.264 / AVC / MPEG-4 part10 codec.
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
int ff_vdpau_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
#define FF_PROFILE_VC1_SIMPLE
preferred ID for MPEG-1/2 video decoding
static void destroy(struct ResampleContext **c)
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
Libavcodec external API header.
int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx)
main external API structure.
#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE
uint8_t * data
The data buffer.
VdpDecoderRender * render
VDPAU decoder render callback.
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
This struct describes a set or pool of "hardware" frames (i.e.
int(* func)(AVBPrint *dst, const char *in, const char *arg)
VdpDecoderRender * render
VDPAU decoder render callback.
int(* AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *, const VdpPictureInfo *, uint32_t, const VdpBitstreamBuffer *)
#define flags(name, subs,...)
int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx, enum AVHWDeviceType dev_type)
Make sure avctx.hw_frames_ctx is set.
int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, VdpGetProcAddress *get_proc, unsigned flags)
Associate a VDPAU device with a codec context for hardware acceleration.
struct AVCodecContext * avctx
A reference to a data buffer.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
int ff_vdpau_add_buffer(struct vdpau_picture_context *pic_ctx, const uint8_t *buf, uint32_t size)
int(* uninit)(AVCodecContext *avctx)
Uninitialize the hwaccel private data.
void * hwaccel_priv_data
hwaccel-specific private data
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, struct vdpau_picture_context *pic_ctx)
#define FF_PROFILE_VC1_ADVANCED
struct AVCodecInternal * internal
Private context used for internal data.
union VDPAUPictureInfo info
VDPAU picture information.
#define FF_PROFILE_MPEG2_SIMPLE
#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH
Hardware acceleration should still be attempted for decoding when the codec profile does not match th...
int hwaccel_flags
Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated decoding (if active)...
#define FF_PROFILE_H264_CONSTRAINED_BASELINE
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
static int ff_vdpau_common_reinit(AVCodecContext *avctx)
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
static uintptr_t ff_vdpau_get_surface_id(AVFrame *pic)
Extract VdpVideoSurface from an AVFrame.