FFmpeg
vdpau.c
Go to the documentation of this file.
1 /*
2  * Video Decode and Presentation API for UNIX (VDPAU) is used for
3  * HW decode acceleration for MPEG-1/2, MPEG-4 ASP, H.264 and VC-1.
4  *
5  * Copyright (c) 2008 NVIDIA
6  *
7  * This file is part of FFmpeg.
8  *
9  * FFmpeg is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * FFmpeg is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with FFmpeg; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  */
23 
24 #include <limits.h>
25 
26 #include "avcodec.h"
27 #include "decode.h"
28 #include "internal.h"
29 #include "h264dec.h"
30 #include "vc1.h"
31 #include "vdpau.h"
32 #include "vdpau_internal.h"
33 
34 // XXX: at the time of adding this ifdefery, av_assert* wasn't use outside.
35 // When dropping it, make sure other av_assert* were not added since then.
36 
37 /**
38  * @addtogroup VDPAU_Decoding
39  *
40  * @{
41  */
42 
43 static int vdpau_error(VdpStatus status)
44 {
45  switch (status) {
46  case VDP_STATUS_OK:
47  return 0;
48  case VDP_STATUS_NO_IMPLEMENTATION:
49  return AVERROR(ENOSYS);
50  case VDP_STATUS_DISPLAY_PREEMPTED:
51  return AVERROR(EIO);
52  case VDP_STATUS_INVALID_HANDLE:
53  return AVERROR(EBADF);
54  case VDP_STATUS_INVALID_POINTER:
55  return AVERROR(EFAULT);
56  case VDP_STATUS_RESOURCES:
57  return AVERROR(ENOBUFS);
58  case VDP_STATUS_HANDLE_DEVICE_MISMATCH:
59  return AVERROR(EXDEV);
60  case VDP_STATUS_ERROR:
61  return AVERROR(EIO);
62  default:
63  return AVERROR(EINVAL);
64  }
65 }
66 
68 {
69  return av_vdpau_alloc_context();
70 }
71 
72 #define MAKE_ACCESSORS(str, name, type, field) \
73  type av_##name##_get_##field(const str *s) { return s->field; } \
74  void av_##name##_set_##field(str *s, type v) { s->field = v; }
75 MAKE_ACCESSORS(AVVDPAUContext, vdpau_hwaccel, AVVDPAU_Render2, render2)
76 
78  VdpChromaType *type,
79  uint32_t *width, uint32_t *height)
80 {
81  VdpChromaType t;
82  uint32_t w = avctx->coded_width;
83  uint32_t h = avctx->coded_height;
84 
85  /* See <vdpau/vdpau.h> for per-type alignment constraints. */
86  switch (avctx->sw_pix_fmt) {
87  case AV_PIX_FMT_YUV420P:
91  t = VDP_CHROMA_TYPE_420;
92  w = (w + 1) & ~1;
93  h = (h + 3) & ~3;
94  break;
95  case AV_PIX_FMT_YUV422P:
97  t = VDP_CHROMA_TYPE_422;
98  w = (w + 1) & ~1;
99  h = (h + 1) & ~1;
100  break;
101  case AV_PIX_FMT_YUV444P:
102  case AV_PIX_FMT_YUVJ444P:
105  t = VDP_CHROMA_TYPE_444;
106  h = (h + 1) & ~1;
107  break;
108  default:
109  return AVERROR(ENOSYS);
110  }
111 
112  if (type)
113  *type = t;
114  if (width)
115  *width = w;
116  if (height)
117  *height = h;
118  return 0;
119 }
120 
122  AVBufferRef *hw_frames_ctx)
123 {
124  AVHWFramesContext *hw_frames = (AVHWFramesContext*)hw_frames_ctx->data;
125  VdpChromaType type;
126  uint32_t width;
127  uint32_t height;
128 
130  return AVERROR(EINVAL);
131 
132  hw_frames->format = AV_PIX_FMT_VDPAU;
133  hw_frames->sw_format = avctx->sw_pix_fmt;
134  hw_frames->width = width;
135  hw_frames->height = height;
136 
137  return 0;
138 }
139 
140 int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile,
141  int level)
142 {
143  VDPAUHWContext *hwctx = avctx->hwaccel_context;
144  VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
145  VdpVideoSurfaceQueryCapabilities *surface_query_caps;
146  VdpDecoderQueryCapabilities *decoder_query_caps;
147  VdpDecoderCreate *create;
148  VdpGetInformationString *info;
149  const char *info_string;
150  void *func;
151  VdpStatus status;
152  VdpBool supported;
153  uint32_t max_level, max_mb, max_width, max_height;
154  VdpChromaType type;
155  uint32_t width;
156  uint32_t height;
157  int ret;
158 
159  vdctx->width = UINT32_MAX;
160  vdctx->height = UINT32_MAX;
161 
163  return AVERROR(ENOSYS);
164 
165  if (hwctx) {
166  hwctx->reset = 0;
167 
168  if (hwctx->context.decoder != VDP_INVALID_HANDLE) {
169  vdctx->decoder = hwctx->context.decoder;
170  vdctx->render = hwctx->context.render;
171  vdctx->device = VDP_INVALID_HANDLE;
172  return 0; /* Decoder created by user */
173  }
174 
175  vdctx->device = hwctx->device;
176  vdctx->get_proc_address = hwctx->get_proc_address;
177 
178  if (hwctx->flags & AV_HWACCEL_FLAG_IGNORE_LEVEL)
179  level = 0;
180 
181  if (!(hwctx->flags & AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH) &&
182  type != VDP_CHROMA_TYPE_420)
183  return AVERROR(ENOSYS);
184  } else {
185  AVHWFramesContext *frames_ctx;
186  AVVDPAUDeviceContext *dev_ctx;
187 
189  if (ret < 0)
190  return ret;
191 
192  frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
193  dev_ctx = frames_ctx->device_ctx->hwctx;
194 
195  vdctx->device = dev_ctx->device;
196  vdctx->get_proc_address = dev_ctx->get_proc_address;
197 
199  level = 0;
200  }
201 
202  if (level < 0)
203  return AVERROR(ENOTSUP);
204 
205  status = vdctx->get_proc_address(vdctx->device,
206  VDP_FUNC_ID_GET_INFORMATION_STRING,
207  &func);
208  if (status != VDP_STATUS_OK)
209  return vdpau_error(status);
210  else
211  info = func;
212 
213  status = info(&info_string);
214  if (status != VDP_STATUS_OK)
215  return vdpau_error(status);
216  if (avctx->codec_id == AV_CODEC_ID_HEVC && strncmp(info_string, "NVIDIA ", 7) == 0 &&
218  int driver_version = 0;
219  sscanf(info_string, "NVIDIA VDPAU Driver Shared Library %d", &driver_version);
220  if (driver_version < 410) {
221  av_log(avctx, AV_LOG_VERBOSE, "HEVC with NVIDIA VDPAU drivers is buggy, skipping.\n");
222  return AVERROR(ENOTSUP);
223  }
224  }
225 
226  status = vdctx->get_proc_address(vdctx->device,
227  VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES,
228  &func);
229  if (status != VDP_STATUS_OK)
230  return vdpau_error(status);
231  else
232  surface_query_caps = func;
233 
234  status = surface_query_caps(vdctx->device, type, &supported,
235  &max_width, &max_height);
236  if (status != VDP_STATUS_OK)
237  return vdpau_error(status);
238  if (supported != VDP_TRUE ||
239  max_width < width || max_height < height)
240  return AVERROR(ENOTSUP);
241 
242  status = vdctx->get_proc_address(vdctx->device,
243  VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES,
244  &func);
245  if (status != VDP_STATUS_OK)
246  return vdpau_error(status);
247  else
248  decoder_query_caps = func;
249 
250  status = decoder_query_caps(vdctx->device, profile, &supported, &max_level,
251  &max_mb, &max_width, &max_height);
252 #ifdef VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE
253  if ((status != VDP_STATUS_OK || supported != VDP_TRUE) && profile == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE) {
254  profile = VDP_DECODER_PROFILE_H264_MAIN;
255  status = decoder_query_caps(vdctx->device, profile, &supported,
256  &max_level, &max_mb,
257  &max_width, &max_height);
258  }
259 #endif
260  if (status != VDP_STATUS_OK)
261  return vdpau_error(status);
262 
263  if (supported != VDP_TRUE || max_level < level ||
264  max_width < width || max_height < height)
265  return AVERROR(ENOTSUP);
266 
267  status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_CREATE,
268  &func);
269  if (status != VDP_STATUS_OK)
270  return vdpau_error(status);
271  else
272  create = func;
273 
274  status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_RENDER,
275  &func);
276  if (status != VDP_STATUS_OK)
277  return vdpau_error(status);
278  else
279  vdctx->render = func;
280 
281  status = create(vdctx->device, profile, width, height, avctx->refs,
282  &vdctx->decoder);
283  if (status == VDP_STATUS_OK) {
284  vdctx->width = avctx->coded_width;
285  vdctx->height = avctx->coded_height;
286  }
287 
288  return vdpau_error(status);
289 }
290 
292 {
293  VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
294  VdpDecoderDestroy *destroy;
295  void *func;
296  VdpStatus status;
297 
298  if (vdctx->device == VDP_INVALID_HANDLE)
299  return 0; /* Decoder created and destroyed by user */
300  if (vdctx->width == UINT32_MAX && vdctx->height == UINT32_MAX)
301  return 0;
302 
303  status = vdctx->get_proc_address(vdctx->device,
304  VDP_FUNC_ID_DECODER_DESTROY, &func);
305  if (status != VDP_STATUS_OK)
306  return vdpau_error(status);
307  else
308  destroy = func;
309 
310  status = destroy(vdctx->decoder);
311  return vdpau_error(status);
312 }
313 
315 {
316  VDPAUHWContext *hwctx = avctx->hwaccel_context;
317  VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
318 
319  if (vdctx->device == VDP_INVALID_HANDLE)
320  return 0; /* Decoder created by user */
321  if (avctx->coded_width == vdctx->width &&
322  avctx->coded_height == vdctx->height && (!hwctx || !hwctx->reset))
323  return 0;
324 
325  avctx->hwaccel->uninit(avctx);
326  return avctx->hwaccel->init(avctx);
327 }
328 
330  av_unused const uint8_t *buffer,
331  av_unused uint32_t size)
332 {
333  pic_ctx->bitstream_buffers_allocated = 0;
334  pic_ctx->bitstream_buffers_used = 0;
335  pic_ctx->bitstream_buffers = NULL;
336  return 0;
337 }
338 
340  struct vdpau_picture_context *pic_ctx)
341 {
342  VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
343  AVVDPAUContext *hwctx = avctx->hwaccel_context;
344  VdpVideoSurface surf = ff_vdpau_get_surface_id(frame);
345  VdpStatus status;
346  int val;
347 
348  val = ff_vdpau_common_reinit(avctx);
349  if (val < 0)
350  return val;
351 
352  if (hwctx && !hwctx->render && hwctx->render2) {
353  status = hwctx->render2(avctx, frame, (void *)&pic_ctx->info,
354  pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers);
355  } else
356  status = vdctx->render(vdctx->decoder, surf, &pic_ctx->info,
357  pic_ctx->bitstream_buffers_used,
358  pic_ctx->bitstream_buffers);
359 
360  av_freep(&pic_ctx->bitstream_buffers);
361 
362  return vdpau_error(status);
363 }
364 
365 #if CONFIG_MPEG1_VDPAU_HWACCEL || \
366  CONFIG_MPEG2_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL || \
367  CONFIG_VC1_VDPAU_HWACCEL || CONFIG_WMV3_VDPAU_HWACCEL
369 {
370  MpegEncContext *s = avctx->priv_data;
371  Picture *pic = s->current_picture_ptr;
372  struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
373  int val;
374 
375  val = ff_vdpau_common_end_frame(avctx, pic->f, pic_ctx);
376  if (val < 0)
377  return val;
378 
379  ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
380  return 0;
381 }
382 #endif
383 
385  const uint8_t *buf, uint32_t size)
386 {
387  VdpBitstreamBuffer *buffers = pic_ctx->bitstream_buffers;
388 
389  buffers = av_fast_realloc(buffers, &pic_ctx->bitstream_buffers_allocated,
390  (pic_ctx->bitstream_buffers_used + 1) * sizeof(*buffers));
391  if (!buffers)
392  return AVERROR(ENOMEM);
393 
394  pic_ctx->bitstream_buffers = buffers;
395  buffers += pic_ctx->bitstream_buffers_used++;
396 
397  buffers->struct_version = VDP_BITSTREAM_BUFFER_VERSION;
398  buffers->bitstream = buf;
399  buffers->bitstream_bytes = size;
400  return 0;
401 }
402 
404 {
405  return av_mallocz(sizeof(VDPAUHWContext));
406 }
407 
408 int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
409  VdpGetProcAddress *get_proc, unsigned flags)
410 {
411  VDPAUHWContext *hwctx;
412 
414  return AVERROR(EINVAL);
415 
416  if (av_reallocp(&avctx->hwaccel_context, sizeof(*hwctx)))
417  return AVERROR(ENOMEM);
418 
419  hwctx = avctx->hwaccel_context;
420 
421  memset(hwctx, 0, sizeof(*hwctx));
422  hwctx->context.decoder = VDP_INVALID_HANDLE;
423  hwctx->device = device;
424  hwctx->get_proc_address = get_proc;
425  hwctx->flags = flags;
426  hwctx->reset = 1;
427  return 0;
428 }
429 
430 /* @}*/
func
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:68
AVHWDeviceContext::hwctx
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
Definition: hwcontext.h:92
AVCodecContext::hwaccel
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
Definition: avcodec.h:1359
AVCodecContext::hwaccel_context
void * hwaccel_context
Hardware accelerator context.
Definition: avcodec.h:1370
status
they must not be accessed directly The fifo field contains the frames that are queued in the input for processing by the filter The status_in and status_out fields contains the queued status(EOF or error) of the link
level
uint8_t level
Definition: svq3.c:204
ff_vdpau_common_frame_params
int ff_vdpau_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
Definition: vdpau.c:121
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
destroy
static void destroy(struct ResampleContext **c)
Definition: soxr_resample.c:64
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:90
vc1.h
ff_vdpau_common_reinit
static int ff_vdpau_common_reinit(AVCodecContext *avctx)
Definition: vdpau.c:314
AVHWFramesContext::format
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
Definition: hwcontext.h:209
av_unused
#define av_unused
Definition: attributes.h:131
profile
mfxU16 profile
Definition: qsvenc.c:45
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:303
VDPAUHWContext::get_proc_address
VdpGetProcAddress * get_proc_address
Definition: vdpau_internal.h:65
vdpau_picture_context::bitstream_buffers_used
int bitstream_buffers_used
Useful bitstream buffers in the bitstream buffers table.
Definition: vdpau_internal.h:109
w
uint8_t w
Definition: llviddspenc.c:38
internal.h
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:391
AVHWAccel::init
int(* init)(AVCodecContext *avctx)
Initialize the hwaccel private data.
Definition: avcodec.h:2169
AVVDPAUDeviceContext::get_proc_address
VdpGetProcAddress * get_proc_address
Definition: hwcontext_vdpau.h:37
AVVDPAUDeviceContext
This struct is allocated as AVHWDeviceContext.hwctx.
Definition: hwcontext_vdpau.h:35
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:196
Picture
Picture.
Definition: mpegpicture.h:45
AVHWFramesContext::width
int width
The allocated dimensions of the frames in this pool.
Definition: hwcontext.h:229
VDPAUContext::width
uint32_t width
Definition: vdpau_internal.h:91
VDPAUContext::render
VdpDecoderRender * render
VDPAU decoder render callback.
Definition: vdpau_internal.h:89
vdpau_internal.h
AV_HWACCEL_FLAG_IGNORE_LEVEL
#define AV_HWACCEL_FLAG_IGNORE_LEVEL
Hardware acceleration should be used for decoding even if the codec level used is unknown or higher t...
Definition: avcodec.h:2215
VDPAUHWContext::device
VdpDevice device
Definition: vdpau_internal.h:64
vdpau_picture_context
Definition: vdpau_internal.h:95
AVVDPAUContext
This structure is used to share data between the libavcodec library and the client video application.
Definition: vdpau.h:80
AVCodecContext::refs
int refs
number of reference frames
Definition: avcodec.h:932
ff_mpeg_draw_horiz_band
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
Definition: mpegvideo.c:2264
val
static double val(void *priv, double ch)
Definition: aeval.c:76
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
AVCodecContext::coded_height
int coded_height
Definition: avcodec.h:571
AVVDPAUContext::render2
AVVDPAU_Render2 render2
Definition: vdpau.h:95
ff_vdpau_add_buffer
int ff_vdpau_add_buffer(struct vdpau_picture_context *pic_ctx, const uint8_t *buf, uint32_t size)
Definition: vdpau.c:384
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:394
ff_vdpau_common_init
int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, int level)
Definition: vdpau.c:140
vdpau.h
AVHWFramesContext::height
int height
Definition: hwcontext.h:229
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:79
av_fast_realloc
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.
Definition: mem.c:504
width
#define width
s
#define s(width, name)
Definition: cbs_vp9.c:257
AVHWAccel::uninit
int(* uninit)(AVCodecContext *avctx)
Uninitialize the hwaccel private data.
Definition: avcodec.h:2177
info
MIPS optimizations info
Definition: mips.txt:2
decode.h
limits.h
av_vdpau_bind_context
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.
Definition: vdpau.c:408
AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH
#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...
Definition: avcodec.h:2221
ff_vdpau_common_start_frame
int ff_vdpau_common_start_frame(struct vdpau_picture_context *pic_ctx, av_unused const uint8_t *buffer, av_unused uint32_t size)
Definition: vdpau.c:329
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
ff_vdpau_get_surface_id
static uintptr_t ff_vdpau_get_surface_id(AVFrame *pic)
Extract VdpVideoSurface from an AVFrame.
Definition: vdpau_internal.h:38
Picture::hwaccel_picture_private
void * hwaccel_picture_private
Hardware accelerator private data.
Definition: mpegpicture.h:78
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:80
ff_decode_get_hw_frames_ctx
int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx, enum AVHWDeviceType dev_type)
Make sure avctx.hw_frames_ctx is set.
Definition: decode.c:938
AVCodecContext::codec_id
enum AVCodecID codec_id
Definition: avcodec.h:393
if
if(ret)
Definition: filter_design.txt:179
NULL
#define NULL
Definition: coverity.c:32
AVHWFramesContext::sw_format
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
Definition: hwcontext.h:222
create
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)
Definition: soxr_resample.c:32
VDPAUContext::height
uint32_t height
Definition: vdpau_internal.h:92
AVCodecContext::internal
struct AVCodecInternal * internal
Private context used for internal data.
Definition: avcodec.h:418
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:78
ff_vdpau_common_end_frame
int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, struct vdpau_picture_context *pic_ctx)
Definition: vdpau.c:339
AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH
#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH
Hardware acceleration should still be attempted for decoding when the codec profile does not match th...
Definition: avcodec.h:2235
MAKE_ACCESSORS
#define MAKE_ACCESSORS(str, name, type, field)
Definition: vdpau.c:72
AVVDPAUContext::render
VdpDecoderRender * render
VDPAU decoder render callback.
Definition: vdpau.h:93
VDPAUHWContext
Definition: vdpau_internal.h:62
av_vdpau_get_surface_parameters
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...
Definition: vdpau.c:77
VDPAUContext::device
VdpDevice device
VDPAU device handle.
Definition: vdpau_internal.h:74
ff_vdpau_common_uninit
int ff_vdpau_common_uninit(AVCodecContext *avctx)
Definition: vdpau.c:291
VDPAUContext
Definition: vdpau_internal.h:70
AVVDPAUContext::decoder
VdpDecoder decoder
VDPAU decoder handle.
Definition: vdpau.h:86
AVCodecInternal::hwaccel_priv_data
void * hwaccel_priv_data
hwaccel-specific private data
Definition: internal.h:181
size
int size
Definition: twinvq_data.h:10344
av_reallocp
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
Definition: mem.c:185
VDPAUContext::decoder
VdpDecoder decoder
VDPAU decoder handle.
Definition: vdpau_internal.h:79
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:398
ff_vdpau_mpeg_end_frame
int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx)
height
#define height
AV_PIX_FMT_VDPAU
@ AV_PIX_FMT_VDPAU
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
Definition: pixfmt.h:187
h264dec.h
VDPAUHWContext::reset
char reset
Definition: vdpau_internal.h:66
AVCodecContext::hwaccel_flags
int hwaccel_flags
Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated decoding (if active).
Definition: avcodec.h:1917
vdpau_picture_context::bitstream_buffers
VdpBitstreamBuffer * bitstream_buffers
Table of bitstream buffers.
Definition: vdpau_internal.h:114
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: codec_id.h:224
av_vdpau_alloc_context
AVVDPAUContext * av_vdpau_alloc_context(void)
Allocate an AVVDPAUContext.
Definition: vdpau.c:403
AVVDPAU_Render2
int(* AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *, const VdpPictureInfo *, uint32_t, const VdpBitstreamBuffer *)
Definition: vdpau.h:62
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:263
VDPAUHWContext::context
AVVDPAUContext context
Definition: vdpau_internal.h:63
AV_HWDEVICE_TYPE_VDPAU
@ AV_HWDEVICE_TYPE_VDPAU
Definition: hwcontext.h:29
AVCodecContext::hw_frames_ctx
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames.
Definition: avcodec.h:1858
avcodec.h
AVHWFramesContext
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:124
ret
ret
Definition: filter_design.txt:187
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
AVHWFramesContext::device_ctx
AVHWDeviceContext * device_ctx
The parent AVHWDeviceContext.
Definition: hwcontext.h:149
VDPAUContext::get_proc_address
VdpGetProcAddress * get_proc_address
VDPAU device driver.
Definition: vdpau_internal.h:84
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:395
vdpau_picture_context::bitstream_buffers_allocated
int bitstream_buffers_allocated
Allocated size of the bitstream_buffers table.
Definition: vdpau_internal.h:104
AVCodecContext
main external API structure.
Definition: avcodec.h:383
vdpau_picture_context::info
union VDPAUPictureInfo info
VDPAU picture information.
Definition: vdpau_internal.h:99
buffer
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
Definition: filter_design.txt:49
Picture::f
struct AVFrame * f
Definition: mpegpicture.h:46
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
AVCodecContext::coded_width
int coded_width
Bitstream width / height, may be different from width/height e.g.
Definition: avcodec.h:571
vdpau_error
static int vdpau_error(VdpStatus status)
Definition: vdpau.c:43
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:70
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
av_alloc_vdpaucontext
AVVDPAUContext * av_alloc_vdpaucontext(void)
allocation function for AVVDPAUContext
Definition: vdpau.c:67
VDPAUHWContext::flags
unsigned char flags
Definition: vdpau_internal.h:67
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:410
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
h
h
Definition: vp9dsp_template.c:2038
AVCodecContext::sw_pix_fmt
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1717
AVVDPAUDeviceContext::device
VdpDevice device
Definition: hwcontext_vdpau.h:36
int
int
Definition: ffmpeg_filter.c:156
MpegEncContext
MpegEncContext.
Definition: mpegvideo.h:71