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;
119 VdpVideoSurfaceQueryCapabilities *surface_query_caps;
120 VdpDecoderQueryCapabilities *decoder_query_caps;
125 uint32_t max_level, max_mb, max_width, max_height;
130 vdctx->width = UINT32_MAX;
131 vdctx->height = UINT32_MAX;
134 vdctx->
device = VDP_INVALID_HANDLE;
135 av_log(avctx,
AV_LOG_WARNING,
"hwaccel_context has not been setup by the user application, cannot initialize\n");
139 if (hwctx->context.decoder != VDP_INVALID_HANDLE) {
140 vdctx->
decoder = hwctx->context.decoder;
141 vdctx->render = hwctx->context.render;
142 vdctx->
device = VDP_INVALID_HANDLE;
147 vdctx->
device = hwctx->device;
159 type != VDP_CHROMA_TYPE_420)
163 VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES,
165 if (status != VDP_STATUS_OK)
168 surface_query_caps =
func;
170 status = surface_query_caps(vdctx->
device, type, &supported,
171 &max_width, &max_height);
172 if (status != VDP_STATUS_OK)
174 if (supported != VDP_TRUE ||
175 max_width < width || max_height < height)
179 VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES,
181 if (status != VDP_STATUS_OK)
184 decoder_query_caps =
func;
186 status = decoder_query_caps(vdctx->
device, profile, &supported, &max_level,
187 &max_mb, &max_width, &max_height);
188 #ifdef VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE
189 if (status != VDP_STATUS_OK && 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_H263_VDPAU_HWACCEL || 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;
363 VdpReferenceFrameH264 *rf, *rf2;
365 int i, list, pic_frame_idx;
370 rf = &render->
info.
h264.referenceFrames[0];
371 #define H264_RF_COUNT FF_ARRAY_ELEMS(render->info.h264.referenceFrames)
373 for (list = 0; list < 2; ++list) {
377 for (i = 0; i < ls; ++i) {
386 rf2 = &render->
info.
h264.referenceFrames[0];
389 (rf2->surface == render_ref->
surface)
390 && (rf2->is_long_term == pic->
long_ref)
391 && (rf2->frame_idx == pic_frame_idx)
405 rf->surface = render_ref->
surface;
409 rf->field_order_cnt[0] = pic->
field_poc[0];
410 rf->field_order_cnt[1] = pic->
field_poc[1];
411 rf->frame_idx = pic_frame_idx;
418 rf->surface = VDP_INVALID_HANDLE;
419 rf->is_long_term = 0;
420 rf->top_is_reference = 0;
421 rf->bottom_is_reference = 0;
422 rf->field_order_cnt[0] = 0;
423 rf->field_order_cnt[1] = 0;
445 #if CONFIG_H264_VDPAU_DECODER
454 for (i = 0; i < 2; ++i) {
458 render->
info.
h264.field_order_cnt[i] = foc;
472 if (render->
info.
h264.slice_count < 1)
508 #if CONFIG_MPEG_VDPAU_DECODER || CONFIG_MPEG1_VDPAU_DECODER
510 int buf_size,
int slice_count)
536 for (i = 0; i < 64; ++i) {
541 render->
info.
mpeg.forward_reference = VDP_INVALID_HANDLE;
542 render->
info.
mpeg.backward_reference = VDP_INVALID_HANDLE;
559 render->
info.
mpeg.slice_count = slice_count;
567 #if CONFIG_VC1_VDPAU_DECODER
578 render->
info.
vc1.frame_coding_mode = v->
fcm ? v->
fcm + 1 : 0;
608 render->
info.
vc1.forward_reference = VDP_INVALID_HANDLE;
609 render->
info.
vc1.backward_reference = VDP_INVALID_HANDLE;
612 render->
info.
vc1.picture_type = 4;
631 render->
info.
vc1.slice_count = 1;
638 #if CONFIG_MPEG4_VDPAU_DECODER
668 for (i = 0; i < 64; ++i) {
672 render->
info.
mpeg4.forward_reference = VDP_INVALID_HANDLE;
673 render->
info.
mpeg4.backward_reference = VDP_INVALID_HANDLE;
697 #define PROFILE(prof) \
699 *profile = VDP_DECODER_PROFILE_##prof; \
709 default:
return AVERROR(EINVAL);
716 default:
return AVERROR(EINVAL);
724 #ifdef VDP_DECODER_PROFILE_H264_EXTENDED
727 default:
return AVERROR(EINVAL);
735 default:
return AVERROR(EINVAL);
748 VdpGetProcAddress *get_proc,
unsigned flags)
750 VDPAUHWContext *hwctx;
760 memset(hwctx, 0,
sizeof(*hwctx));
761 hwctx->context.decoder = VDP_INVALID_HANDLE;
762 hwctx->device = device;
763 hwctx->get_proc_address = get_proc;
764 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
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.
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
void ff_vdpau_h264_picture_complete(H264Context *h)
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
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 PIX_FMT_YUV422P and setting color_...
int redundant_pic_cnt_present
redundant_pic_cnt_present_flag
uint16_t pp_time
time distance between the last 2 p,s,i frames
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
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 PIX_FMT_YUV420P and setting color_...
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
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
void ff_vdpau_add_data_chunk(uint8_t *data, const uint8_t *buf, int buf_size)
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
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.
void ff_vdpau_h264_set_reference_frames(H264Context *h)
int(* func)(AVBPrint *dst, const char *in, const char *arg)
H264Picture * cur_pic_ptr
void ff_vdpau_h264_picture_start(H264Context *h)
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
void ff_h264_draw_horiz_band(H264Context *h, int y, int height)
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
void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf, int buf_size, int slice_count)
#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 PIX_FMT_YUV444P and setting color_...
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
void ff_vdpau_mpeg4_decode_picture(Mpeg4DecContext *s, const uint8_t *buf, int buf_size)
struct AVCodecInternal * internal
Private context used for internal data.
#define FF_PROFILE_H264_BASELINE
Picture next_picture
copy of the next picture structure.
uint16_t intra_matrix[64]
matrix transmitted in the bitstream
int dquant
How qscale varies with MBs, 2bits (not in Simple)
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