56 case VDP_STATUS_NO_IMPLEMENTATION:
58 case VDP_STATUS_DISPLAY_PREEMPTED:
60 case VDP_STATUS_INVALID_HANDLE:
62 case VDP_STATUS_INVALID_POINTER:
64 case VDP_STATUS_RESOURCES:
66 case VDP_STATUS_HANDLE_DEVICE_MISMATCH:
68 case VDP_STATUS_ERROR:
87 uint32_t w = avctx->coded_width;
88 uint32_t
h = avctx->coded_height;
91 switch (avctx->sw_pix_fmt) {
94 t = VDP_CHROMA_TYPE_420;
100 t = VDP_CHROMA_TYPE_422;
106 t = VDP_CHROMA_TYPE_444;
127 VdpVideoSurfaceQueryCapabilities *surface_query_caps;
128 VdpDecoderQueryCapabilities *decoder_query_caps;
130 VdpGetInformationString *info;
131 const char *info_string;
135 uint32_t max_level, max_mb, max_width, max_height;
140 vdctx->
width = UINT32_MAX;
141 vdctx->
height = UINT32_MAX;
152 vdctx->
device = VDP_INVALID_HANDLE;
163 type != VDP_CHROMA_TYPE_420)
197 "required for VDPAU decoding.\n");
214 VDP_FUNC_ID_GET_INFORMATION_STRING,
216 if (status != VDP_STATUS_OK)
221 status = info(&info_string);
222 if (status != VDP_STATUS_OK)
231 VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES,
233 if (status != VDP_STATUS_OK)
236 surface_query_caps =
func;
238 status = surface_query_caps(vdctx->
device, type, &supported,
239 &max_width, &max_height);
240 if (status != VDP_STATUS_OK)
242 if (supported != VDP_TRUE ||
243 max_width < width || max_height < height)
247 VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES,
249 if (status != VDP_STATUS_OK)
252 decoder_query_caps =
func;
254 status = decoder_query_caps(vdctx->
device, profile, &supported, &max_level,
255 &max_mb, &max_width, &max_height);
256 #ifdef VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE 257 if ((status != VDP_STATUS_OK || supported != VDP_TRUE) && profile == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE) {
258 profile = VDP_DECODER_PROFILE_H264_MAIN;
259 status = decoder_query_caps(vdctx->
device, profile, &supported,
261 &max_width, &max_height);
264 if (status != VDP_STATUS_OK)
267 if (supported != VDP_TRUE || max_level < level ||
268 max_width < width || max_height < height)
273 if (status != VDP_STATUS_OK)
280 if (status != VDP_STATUS_OK)
287 if (status == VDP_STATUS_OK) {
302 if (vdctx->
device == VDP_INVALID_HANDLE)
304 if (vdctx->
width == UINT32_MAX && vdctx->
height == UINT32_MAX)
308 VDP_FUNC_ID_DECODER_DESTROY, &func);
309 if (status != VDP_STATUS_OK)
323 if (vdctx->
device == VDP_INVALID_HANDLE)
356 #if FF_API_BUFS_VDPAU 360 memcpy(&hwctx->
info, &pic_ctx->
info,
sizeof(hwctx->
info));
369 status = hwctx->
render2(avctx, frame, (
void *)&pic_ctx->
info,
378 #if FF_API_BUFS_VDPAU 391 #if CONFIG_MPEG1_VDPAU_HWACCEL || \ 392 CONFIG_MPEG2_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL || \ 393 CONFIG_VC1_VDPAU_HWACCEL || CONFIG_WMV3_VDPAU_HWACCEL 423 buffers->struct_version = VDP_BITSTREAM_BUFFER_VERSION;
424 buffers->bitstream =
buf;
425 buffers->bitstream_bytes =
size;
449 #if CONFIG_H264_VDPAU_DECODER 453 VdpReferenceFrameH264 *rf, *rf2;
455 int i, list, pic_frame_idx;
460 rf = &render->
info.
h264.referenceFrames[0];
461 #define H264_RF_COUNT FF_ARRAY_ELEMS(render->info.h264.referenceFrames) 463 for (list = 0; list < 2; ++list) {
467 for (i = 0; i < ls; ++i) {
476 rf2 = &render->
info.
h264.referenceFrames[0];
479 (rf2->surface == render_ref->
surface)
480 && (rf2->is_long_term == pic->
long_ref)
481 && (rf2->frame_idx == pic_frame_idx)
495 rf->surface = render_ref->
surface;
499 rf->field_order_cnt[0] = pic->
field_poc[0];
500 rf->field_order_cnt[1] = pic->
field_poc[1];
501 rf->frame_idx = pic_frame_idx;
508 rf->surface = VDP_INVALID_HANDLE;
509 rf->is_long_term = 0;
510 rf->top_is_reference = 0;
511 rf->bottom_is_reference = 0;
512 rf->field_order_cnt[0] = 0;
513 rf->field_order_cnt[1] = 0;
526 for (i = 0; i < 2; ++i) {
530 render->
info.
h264.field_order_cnt[i] = foc;
544 if (render->
info.
h264.slice_count < 1)
580 #if CONFIG_MPEG_VDPAU_DECODER || CONFIG_MPEG1_VDPAU_DECODER 582 int buf_size,
int slice_count)
608 for (i = 0; i < 64; ++i) {
613 render->
info.
mpeg.forward_reference = VDP_INVALID_HANDLE;
614 render->
info.
mpeg.backward_reference = VDP_INVALID_HANDLE;
631 render->
info.
mpeg.slice_count = slice_count;
639 #if CONFIG_VC1_VDPAU_DECODER 650 render->
info.
vc1.frame_coding_mode = v->
fcm ? v->
fcm + 1 : 0;
680 render->
info.
vc1.forward_reference = VDP_INVALID_HANDLE;
681 render->
info.
vc1.backward_reference = VDP_INVALID_HANDLE;
684 render->
info.
vc1.picture_type = 4;
703 render->
info.
vc1.slice_count = 1;
710 #if CONFIG_MPEG4_VDPAU_DECODER 740 for (i = 0; i < 64; ++i) {
744 render->
info.
mpeg4.forward_reference = VDP_INVALID_HANDLE;
745 render->
info.
mpeg4.backward_reference = VDP_INVALID_HANDLE;
768 #if FF_API_VDPAU_PROFILE 771 #define PROFILE(prof) \ 773 *profile = VDP_DECODER_PROFILE_##prof; \ 783 default:
return AVERROR(EINVAL);
790 default:
return AVERROR(EINVAL);
798 #ifdef VDP_DECODER_PROFILE_H264_EXTENDED 801 default:
return AVERROR(EINVAL);
809 default:
return AVERROR(EINVAL);
823 VdpGetProcAddress *get_proc,
unsigned flags)
835 memset(hwctx, 0,
sizeof(*hwctx));
#define FF_PROFILE_H264_MAIN
#define FF_PROFILE_MPEG4_SIMPLE
const struct AVCodec * codec
const char const char void * val
void ff_vdpau_h264_picture_complete(H264Context *h)
This struct is allocated as AVHWDeviceContext.hwctx.
int long_ref
1->long term reference 0->short term reference
#define FF_PROFILE_MPEG2_MAIN
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
This structure describes decoded (raw) audio or video 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
int chroma_qp_index_offset[2]
int resync_marker
could this stream contain resync markers
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)
int extended_mv
Ext MV in P/B (not in Simple)
VdpGetProcAddress * get_proc_address
int broadcast
TFF/RFF present.
#define FF_PROFILE_H264_INTRA
unsigned int ref_count[2]
num_ref_idx_l0/1_active_minus1 + 1
uint8_t rangeredfrm
Frame decoding info for S/M profiles only.
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.
VdpPictureInfoMPEG1Or2 mpeg
attribute_deprecated VdpBitstreamBuffer * bitstream_buffers
Table of bitstream buffers.
Public libavcodec VDPAU header.
int fastuvmc
Rounding of qpel vector to hpel ? (not in Simple)
H264Picture * long_ref[32]
AVVDPAUContext * av_vdpau_alloc_context(void)
Allocate an AVVDPAUContext.
AVVDPAUContext * av_alloc_vdpaucontext(void)
allocation function for AVVDPAUContext
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
int(* uninit)(AVCodecContext *avctx)
Uninitialize the hwaccel private data.
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...
struct AVHWAccel * hwaccel
Hardware accelerator in use.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
VdpBitstreamBuffer * bitstream_buffers
Table of bitstream buffers.
uint8_t scaling_matrix4[6][16]
int deblocking_filter_parameters_present
deblocking_filter_parameters_present_flag
#define FF_PROFILE_H264_BASELINE
int ff_vdpau_common_uninit(AVCodecContext *avctx)
void * hwaccel_context
Hardware accelerator context.
int panscanflag
NUMPANSCANWIN, TOPLEFT{X,Y}, BOTRIGHT{X,Y} present.
int interlace
Progressive/interlaced (RPTFTM syntax element)
void ff_vdpau_mpeg4_decode_picture(Mpeg4DecContext *s, const uint8_t *buf, int buf_size)
int cabac
entropy_coding_mode_flag
int no_rounding
apply no rounding to motion compensation (MPEG-4, msmpeg4, ...) for B-frames rounding mode is always ...
VdpGetProcAddress * get_proc_address
VDPAU device driver.
Picture current_picture
copy of the current picture structure.
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
attribute_deprecated int bitstream_buffers_used
Useful bitstream buffers in the bitstream buffers table.
#define PICT_BOTTOM_FIELD
int refdist_flag
REFDIST syntax element present in II, IP, PI or PP field picture headers.
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.
int redundant_pic_cnt_present
redundant_pic_cnt_present_flag
#define FF_PROFILE_H264_EXTENDED
uint16_t pp_time
time distance between the last 2 p,s,i frames
#define AV_LOG_VERBOSE
Detailed information.
int(* init)(AVCodecContext *avctx)
Initialize the hwaccel private data.
void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf, int buf_size, int slice_count)
int psf
Progressive Segmented Frame.
int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile)
Get a decoder profile that should be used for initializing a VDPAU decoder.
void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl, int y, int height)
int(* AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *, const VdpPictureInfo *, uint32_t, const VdpBitstreamBuffer *)
attribute_deprecated union AVVDPAUPictureInfo info
VDPAU picture information.
#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 mb_aff
mb_adaptive_frame_field_flag
int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, int level)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
VdpBitstreamBuffer * bitstream_buffers
The user is responsible for freeing this buffer using av_freep().
int overlap
overlapped transforms in use
This structure is used to share data between the libavcodec library and the client video application...
int poc_type
pic_order_cnt_type
int constrained_intra_pred
constrained_intra_pred_flag
#define MAKE_ACCESSORS(str, name, type, field)
#define FF_PROFILE_H264_HIGH
simple assert() macros that are a bit more flexible than ISO C assert().
int weighted_pred
weighted_pred_flag
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
int quarter_sample
1->qpel, 0->half pel ME/MC
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
int bitstream_buffers_allocated
Allocated size of the bitstream_buffers table.
int frame_num
frame_num (raw frame_num from slice header)
int resync_marker
could this stream contain resync markers
int postprocflag
Per-frame processing suggestion flag present.
int delta_pic_order_always_zero_flag
attribute_deprecated 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)
uint8_t scaling_matrix8[6][64]
int refs
number of reference frames
void ff_vdpau_h264_picture_start(H264Context *h)
union AVVDPAUPictureInfo info
picture parameter information for all supported codecs
int ref_frame_count
num_ref_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...
int tfcntrflag
TFCNTR present.
#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)
int init_qp
pic_init_qp_minus26 + 26
H.264 / AVC / MPEG-4 part10 codec.
H264SliceContext * slice_ctx
int direct_8x8_inference_flag
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.
#define FF_PROFILE_VC1_SIMPLE
VdpPictureInfoMPEG4Part2 mpeg4
preferred ID for MPEG-1/2 video decoding
int pic_order_present
pic_order_present_flag
int rangered
RANGEREDFRM (range reduction) syntax element present at frame level.
static void destroy(struct ResampleContext **c)
int finterpflag
INTERPFRM present.
uint16_t inter_matrix[64]
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
int concealment_motion_vectors
Libavcodec external API header.
H264Picture * short_ref[32]
int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx)
int multires
frame-level RESPIC syntax element present
int field_poc[2]
top/bottom POC
main external API structure.
#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE
uint8_t * data
The data buffer.
int bitstream_buffers_used
void ff_vdpau_h264_set_reference_frames(H264Context *h)
int extended_dmv
Additional extended dmv range at P/B-frame-level.
VdpDecoderRender * render
VDPAU decoder render callback.
int bitstream_buffers_allocated
Describe size/location of the compressed video data.
int(* func)(AVBPrint *dst, const char *in, const char *arg)
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
This struct describes a set or pool of "hardware" frames (i.e.
H264Picture * cur_pic_ptr
VdpDecoderRender * render
VDPAU decoder render callback.
int quantizer_mode
2 bits, quantizer mode used for sequence, see QUANT_*
int f_code
forward MV resolution
int log2_max_poc_lsb
log2_max_pic_order_cnt_lsb_minus4
int max_b_frames
max number of B-frames for encoding
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
int vstransform
variable-size [48]x[48] transform type + info
int transform_8x8_mode
transform_8x8_mode_flag
uint16_t pb_field_time
like above, just for interlaced
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
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
int pic_id
pic_num (short -> no wrap version of pic_num, pic_num & max_pic_num; long -> long_pic_num) ...
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
This structure is used as a callback between the FFmpeg decoder (vd_) and presentation (vo_) module...
int ff_vdpau_add_buffer(struct vdpau_picture_context *pic_ctx, const uint8_t *buf, uint32_t size)
enum FrameCodingMode fcm
Frame decoding info for Advanced profile.
int log2_max_frame_num
log2_max_frame_num_minus4 + 4
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
Picture last_picture
copy of the previous picture structure.
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
#define FF_ENABLE_DEPRECATION_WARNINGS
struct AVCodecInternal * internal
Private context used for internal data.
union VDPAUPictureInfo info
VDPAU picture information.
#define FF_PROFILE_MPEG2_SIMPLE
Picture next_picture
copy of the next picture structure.
int current_slice
current slice number, used to initialize slice_num of each thread/context
uint16_t intra_matrix[64]
matrix transmitted in the bitstream
#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)...
int dquant
How qscale varies with MBs, 2 bits (not in Simple)
void ff_vdpau_add_data_chunk(uint8_t *data, const uint8_t *buf, int buf_size)
#define FF_PROFILE_H264_CONSTRAINED_BASELINE
int b_code
backward MV resolution for B-frames (MPEG-4)
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.
void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf, int buf_size)
static int ff_vdpau_common_reinit(AVCodecContext *avctx)
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
VdpVideoSurface surface
Used as rendered surface, never changed.
uint16_t pb_time
time distance between the last b and p,s,i frame
static uintptr_t ff_vdpau_get_surface_id(AVFrame *pic)
Extract VdpVideoSurface from an AVFrame.
int short_ref_count
number of actual short term references