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 && profile == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE) {
192 profile = VDP_DECODER_PROFILE_H264_MAIN;
193 status = decoder_query_caps(vdctx->
device, profile, &supported,
195 &max_width, &max_height);
198 if (status != VDP_STATUS_OK)
201 if (supported != VDP_TRUE || max_level < level ||
202 max_width < width || max_height < height)
207 if (status != VDP_STATUS_OK)
214 if (status != VDP_STATUS_OK)
217 vdctx->render =
func;
221 if (status == VDP_STATUS_OK) {
236 if (vdctx->
device == VDP_INVALID_HANDLE)
238 if (vdctx->width == UINT32_MAX && vdctx->height == UINT32_MAX)
242 VDP_FUNC_ID_DECODER_DESTROY, &func);
243 if (status != VDP_STATUS_OK)
257 if (vdctx->
device == VDP_INVALID_HANDLE)
271 pic_ctx->bitstream_buffers_allocated = 0;
272 pic_ctx->bitstream_buffers_used = 0;
273 pic_ctx->bitstream_buffers =
NULL;
278 struct vdpau_picture_context *pic_ctx)
290 #if FF_API_BUFS_VDPAU
293 memcpy(&hwctx->
info, &pic_ctx->info,
sizeof(hwctx->
info));
301 status = hwctx->
render2(avctx, frame, (
void *)&pic_ctx->info,
302 pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers);
304 status = vdctx->render(vdctx->
decoder, surf, (
void *)&pic_ctx->info,
305 pic_ctx->bitstream_buffers_used,
306 pic_ctx->bitstream_buffers);
308 av_freep(&pic_ctx->bitstream_buffers);
310 #if FF_API_BUFS_VDPAU
321 #if CONFIG_H263_VDPAU_HWACCEL || CONFIG_MPEG1_VDPAU_HWACCEL || \
322 CONFIG_MPEG2_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL || \
323 CONFIG_VC1_VDPAU_HWACCEL || CONFIG_WMV3_VDPAU_HWACCEL
343 VdpBitstreamBuffer *
buffers = pic_ctx->bitstream_buffers;
345 buffers =
av_fast_realloc(buffers, &pic_ctx->bitstream_buffers_allocated,
346 (pic_ctx->bitstream_buffers_used + 1) *
sizeof(*buffers));
350 pic_ctx->bitstream_buffers =
buffers;
351 buffers += pic_ctx->bitstream_buffers_used++;
353 buffers->struct_version = VDP_BITSTREAM_BUFFER_VERSION;
354 buffers->bitstream =
buf;
355 buffers->bitstream_bytes =
size;
379 #if CONFIG_H264_VDPAU_DECODER
383 VdpReferenceFrameH264 *rf, *rf2;
385 int i, list, pic_frame_idx;
390 rf = &render->
info.
h264.referenceFrames[0];
391 #define H264_RF_COUNT FF_ARRAY_ELEMS(render->info.h264.referenceFrames)
393 for (list = 0; list < 2; ++list) {
397 for (i = 0; i < ls; ++i) {
406 rf2 = &render->
info.
h264.referenceFrames[0];
409 (rf2->surface == render_ref->
surface)
410 && (rf2->is_long_term == pic->
long_ref)
411 && (rf2->frame_idx == pic_frame_idx)
425 rf->surface = render_ref->
surface;
429 rf->field_order_cnt[0] = pic->
field_poc[0];
430 rf->field_order_cnt[1] = pic->
field_poc[1];
431 rf->frame_idx = pic_frame_idx;
438 rf->surface = VDP_INVALID_HANDLE;
439 rf->is_long_term = 0;
440 rf->top_is_reference = 0;
441 rf->bottom_is_reference = 0;
442 rf->field_order_cnt[0] = 0;
443 rf->field_order_cnt[1] = 0;
456 for (i = 0; i < 2; ++i) {
460 render->
info.
h264.field_order_cnt[i] = foc;
474 if (render->
info.
h264.slice_count < 1)
510 #if CONFIG_MPEG_VDPAU_DECODER || CONFIG_MPEG1_VDPAU_DECODER
512 int buf_size,
int slice_count)
538 for (i = 0; i < 64; ++i) {
543 render->
info.
mpeg.forward_reference = VDP_INVALID_HANDLE;
544 render->
info.
mpeg.backward_reference = VDP_INVALID_HANDLE;
561 render->
info.
mpeg.slice_count = slice_count;
569 #if CONFIG_VC1_VDPAU_DECODER
580 render->
info.
vc1.frame_coding_mode = v->
fcm ? v->
fcm + 1 : 0;
610 render->
info.
vc1.forward_reference = VDP_INVALID_HANDLE;
611 render->
info.
vc1.backward_reference = VDP_INVALID_HANDLE;
614 render->
info.
vc1.picture_type = 4;
633 render->
info.
vc1.slice_count = 1;
640 #if CONFIG_MPEG4_VDPAU_DECODER
670 for (i = 0; i < 64; ++i) {
674 render->
info.
mpeg4.forward_reference = VDP_INVALID_HANDLE;
675 render->
info.
mpeg4.backward_reference = VDP_INVALID_HANDLE;
700 #define PROFILE(prof) \
702 *profile = VDP_DECODER_PROFILE_##prof; \
712 default:
return AVERROR(EINVAL);
719 default:
return AVERROR(EINVAL);
727 #ifdef VDP_DECODER_PROFILE_H264_EXTENDED
730 default:
return AVERROR(EINVAL);
738 default:
return AVERROR(EINVAL);
751 VdpGetProcAddress *get_proc,
unsigned flags)
753 VDPAUHWContext *hwctx;
763 memset(hwctx, 0,
sizeof(*hwctx));
764 hwctx->context.decoder = VDP_INVALID_HANDLE;
765 hwctx->device = device;
766 hwctx->get_proc_address = get_proc;
767 hwctx->flags =
flags;
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, int kaiser_beta, double precision, int cheby)
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
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)
#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE
int broadcast
TFF/RFF present.
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)
#define FF_PROFILE_H264_MAIN
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
int ff_vdpau_common_uninit(AVCodecContext *avctx)
void * hwaccel_context
Hardware accelerator context.
int panscanflag
NUMPANSCANWIN, TOPLEFT{X,Y}, BOTRIGHT{X,Y} present.
#define FF_PROFILE_H264_EXTENDED
int interlace
Progressive/interlaced (RPTFTM syntax element)
#define FF_PROFILE_VC1_ADVANCED
void ff_vdpau_mpeg4_decode_picture(Mpeg4DecContext *s, const uint8_t *buf, int buf_size)
int cabac
entropy_coding_mode_flag
#define FF_PROFILE_MPEG2_MAIN
int no_rounding
apply no rounding to motion compensation (MPEG4, msmpeg4, ...) for b-frames rounding mode is always 0...
VdpGetProcAddress * get_proc_address
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 av_reallocp(void *ptr, size_t size)
Allocate or reallocate a block of memory.
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
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_MPEG2_SIMPLE
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
Libavcodec external API header.
#define FF_PROFILE_VC1_MAIN
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
#define FF_PROFILE_MPEG4_SIMPLE
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
int tfcntrflag
TFCNTR present.
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
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
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.
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
#define FF_PROFILE_H264_INTRA
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
#define FF_PROFILE_VC1_SIMPLE
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
#define FF_PROFILE_H264_HIGH
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(* 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_H264_CONSTRAINED_BASELINE
#define FF_ENABLE_DEPRECATION_WARNINGS
struct AVCodecInternal * internal
Private context used for internal data.
#define FF_PROFILE_H264_BASELINE
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)
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