49 case VDP_STATUS_NO_IMPLEMENTATION:
51 case VDP_STATUS_DISPLAY_PREEMPTED:
53 case VDP_STATUS_INVALID_HANDLE:
55 case VDP_STATUS_INVALID_POINTER:
57 case VDP_STATUS_RESOURCES:
59 case VDP_STATUS_HANDLE_DEVICE_MISMATCH:
61 case VDP_STATUS_ERROR:
80 uint32_t w = avctx->coded_width;
81 uint32_t
h = avctx->coded_height;
84 switch (avctx->sw_pix_fmt) {
87 t = VDP_CHROMA_TYPE_420;
93 t = VDP_CHROMA_TYPE_422;
99 t = VDP_CHROMA_TYPE_444;
120 VdpVideoSurfaceQueryCapabilities *surface_query_caps;
121 VdpDecoderQueryCapabilities *decoder_query_caps;
126 uint32_t max_level, max_mb, max_width, max_height;
131 vdctx->width = UINT32_MAX;
132 vdctx->height = UINT32_MAX;
135 vdctx->
device = VDP_INVALID_HANDLE;
136 av_log(avctx,
AV_LOG_WARNING,
"hwaccel_context has not been setup by the user application, cannot initialize\n");
140 if (hwctx->context.decoder != VDP_INVALID_HANDLE) {
141 vdctx->
decoder = hwctx->context.decoder;
142 vdctx->render = hwctx->context.render;
143 vdctx->
device = VDP_INVALID_HANDLE;
148 vdctx->
device = hwctx->device;
160 type != VDP_CHROMA_TYPE_420)
164 VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES,
166 if (status != VDP_STATUS_OK)
169 surface_query_caps =
func;
171 status = surface_query_caps(vdctx->
device, type, &supported,
172 &max_width, &max_height);
173 if (status != VDP_STATUS_OK)
175 if (supported != VDP_TRUE ||
176 max_width < width || max_height < height)
180 VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES,
182 if (status != VDP_STATUS_OK)
185 decoder_query_caps =
func;
187 status = decoder_query_caps(vdctx->
device, profile, &supported, &max_level,
188 &max_mb, &max_width, &max_height);
189 #ifdef VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE
190 if ((status != VDP_STATUS_OK || supported != VDP_TRUE) && profile == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE) {
191 profile = VDP_DECODER_PROFILE_H264_MAIN;
192 status = decoder_query_caps(vdctx->
device, profile, &supported,
194 &max_width, &max_height);
197 if (status != VDP_STATUS_OK)
200 if (supported != VDP_TRUE || max_level < level ||
201 max_width < width || max_height < height)
206 if (status != VDP_STATUS_OK)
213 if (status != VDP_STATUS_OK)
216 vdctx->render =
func;
220 if (status == VDP_STATUS_OK) {
235 if (vdctx->
device == VDP_INVALID_HANDLE)
237 if (vdctx->width == UINT32_MAX && vdctx->height == UINT32_MAX)
241 VDP_FUNC_ID_DECODER_DESTROY, &func);
242 if (status != VDP_STATUS_OK)
256 if (vdctx->
device == VDP_INVALID_HANDLE)
270 pic_ctx->bitstream_buffers_allocated = 0;
271 pic_ctx->bitstream_buffers_used = 0;
272 pic_ctx->bitstream_buffers =
NULL;
277 struct vdpau_picture_context *pic_ctx)
289 #if FF_API_BUFS_VDPAU
292 memcpy(&hwctx->
info, &pic_ctx->info,
sizeof(hwctx->
info));
300 status = hwctx->
render2(avctx, frame, (
void *)&pic_ctx->info,
301 pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers);
303 status = vdctx->render(vdctx->
decoder, surf, (
void *)&pic_ctx->info,
304 pic_ctx->bitstream_buffers_used,
305 pic_ctx->bitstream_buffers);
307 av_freep(&pic_ctx->bitstream_buffers);
309 #if FF_API_BUFS_VDPAU
320 #if CONFIG_MPEG1_VDPAU_HWACCEL || \
321 CONFIG_MPEG2_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL || \
322 CONFIG_VC1_VDPAU_HWACCEL || CONFIG_WMV3_VDPAU_HWACCEL
342 VdpBitstreamBuffer *
buffers = pic_ctx->bitstream_buffers;
344 buffers =
av_fast_realloc(buffers, &pic_ctx->bitstream_buffers_allocated,
345 (pic_ctx->bitstream_buffers_used + 1) *
sizeof(*buffers));
349 pic_ctx->bitstream_buffers =
buffers;
350 buffers += pic_ctx->bitstream_buffers_used++;
352 buffers->struct_version = VDP_BITSTREAM_BUFFER_VERSION;
353 buffers->bitstream =
buf;
354 buffers->bitstream_bytes =
size;
378 #if CONFIG_H264_VDPAU_DECODER
382 VdpReferenceFrameH264 *rf, *rf2;
384 int i, list, pic_frame_idx;
389 rf = &render->
info.
h264.referenceFrames[0];
390 #define H264_RF_COUNT FF_ARRAY_ELEMS(render->info.h264.referenceFrames)
392 for (list = 0; list < 2; ++list) {
396 for (i = 0; i < ls; ++i) {
405 rf2 = &render->
info.
h264.referenceFrames[0];
408 (rf2->surface == render_ref->
surface)
409 && (rf2->is_long_term == pic->
long_ref)
410 && (rf2->frame_idx == pic_frame_idx)
424 rf->surface = render_ref->
surface;
428 rf->field_order_cnt[0] = pic->
field_poc[0];
429 rf->field_order_cnt[1] = pic->
field_poc[1];
430 rf->frame_idx = pic_frame_idx;
437 rf->surface = VDP_INVALID_HANDLE;
438 rf->is_long_term = 0;
439 rf->top_is_reference = 0;
440 rf->bottom_is_reference = 0;
441 rf->field_order_cnt[0] = 0;
442 rf->field_order_cnt[1] = 0;
455 for (i = 0; i < 2; ++i) {
459 render->
info.
h264.field_order_cnt[i] = foc;
473 if (render->
info.
h264.slice_count < 1)
509 #if CONFIG_MPEG_VDPAU_DECODER || CONFIG_MPEG1_VDPAU_DECODER
511 int buf_size,
int slice_count)
537 for (i = 0; i < 64; ++i) {
542 render->
info.
mpeg.forward_reference = VDP_INVALID_HANDLE;
543 render->
info.
mpeg.backward_reference = VDP_INVALID_HANDLE;
560 render->
info.
mpeg.slice_count = slice_count;
568 #if CONFIG_VC1_VDPAU_DECODER
579 render->
info.
vc1.frame_coding_mode = v->
fcm ? v->
fcm + 1 : 0;
609 render->
info.
vc1.forward_reference = VDP_INVALID_HANDLE;
610 render->
info.
vc1.backward_reference = VDP_INVALID_HANDLE;
613 render->
info.
vc1.picture_type = 4;
632 render->
info.
vc1.slice_count = 1;
639 #if CONFIG_MPEG4_VDPAU_DECODER
669 for (i = 0; i < 64; ++i) {
673 render->
info.
mpeg4.forward_reference = VDP_INVALID_HANDLE;
674 render->
info.
mpeg4.backward_reference = VDP_INVALID_HANDLE;
699 #define PROFILE(prof) \
701 *profile = VDP_DECODER_PROFILE_##prof; \
711 default:
return AVERROR(EINVAL);
718 default:
return AVERROR(EINVAL);
726 #ifdef VDP_DECODER_PROFILE_H264_EXTENDED
729 default:
return AVERROR(EINVAL);
737 default:
return AVERROR(EINVAL);
750 VdpGetProcAddress *get_proc,
unsigned flags)
752 VDPAUHWContext *hwctx;
762 memset(hwctx, 0,
sizeof(*hwctx));
763 hwctx->context.decoder = VDP_INVALID_HANDLE;
764 hwctx->device = device;
765 hwctx->get_proc_address = get_proc;
766 hwctx->flags =
flags;
#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)
int long_ref
1->long term reference 0->short term reference
#define FF_PROFILE_MPEG2_MAIN
This structure describes decoded (raw) audio or video data.
int(* init)(AVCodecContext *avctx)
Initialize the hwaccel private data.
ptrdiff_t const GLvoid * data
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)
#define AV_LOG_WARNING
Something somehow does not look correct.
int chroma_qp_index_offset[2]
int resync_marker
could this stream contain resync markers
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)
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.
void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl, int y, int height)
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 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)
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 (MPEG4, msmpeg4, ...) for b-frames rounding mode is always 0...
VdpGetProcAddress * get_proc_address
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)
Picture current_picture
copy of the current picture structure.
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...
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
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.
H.264 / AVC / MPEG4 part10 codec.
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)
VdpBitstreamBuffer * bitstream_buffers
The user is responsible for freeing this buffer using av_freep().
int overlap
overlapped transforms in use
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given block if it is not large enough, otherwise do nothing.
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
int quarter_sample
1->qpel, 0->half pel ME/MC
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
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
Picture * current_picture_ptr
pointer to the current picture
void * hwaccel_picture_private
Hardware accelerator private data.
static int vdpau_error(VdpStatus status)
int init_qp
pic_init_qp_minus26 + 26
H264SliceContext * slice_ctx
int direct_8x8_inference_flag
#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 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
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.
BYTE int const BYTE int int int height
int bitstream_buffers_allocated
Describe size/location of the compressed video data.
int(* func)(AVBPrint *dst, const char *in, const char *arg)
H264Picture * cur_pic_ptr
VdpDecoderRender * render
VDPAU decoder render callback.
int quantizer_mode
2bits, 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(* AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *, const VdpPictureInfo *, uint32_t, const VdpBitstreamBuffer *)
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
int av_reallocp(void *ptr, size_t size)
Allocate or reallocate a block of memory.
int(* uninit)(AVCodecContext *avctx)
Uninitialize the hwaccel private data.
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.
#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
int dquant
How qscale varies with MBs, 2bits (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 (mpeg4)
void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf, int buf_size)
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static int ff_vdpau_common_reinit(AVCodecContext *avctx)
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