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 "config_components.h"
25 
26 #include <limits.h>
27 
28 #include "avcodec.h"
29 #include "decode.h"
30 #include "internal.h"
31 #include "mpegvideodec.h"
32 #include "vc1.h"
33 #include "vdpau.h"
34 #include "vdpau_internal.h"
35 
36 // XXX: at the time of adding this ifdefery, av_assert* wasn't use outside.
37 // When dropping it, make sure other av_assert* were not added since then.
38 
39 /**
40  * @addtogroup VDPAU_Decoding
41  *
42  * @{
43  */
44 
45 static int vdpau_error(VdpStatus status)
46 {
47  switch (status) {
48  case VDP_STATUS_OK:
49  return 0;
50  case VDP_STATUS_NO_IMPLEMENTATION:
51  return AVERROR(ENOSYS);
52  case VDP_STATUS_DISPLAY_PREEMPTED:
53  return AVERROR(EIO);
54  case VDP_STATUS_INVALID_HANDLE:
55  return AVERROR(EBADF);
56  case VDP_STATUS_INVALID_POINTER:
57  return AVERROR(EFAULT);
58  case VDP_STATUS_RESOURCES:
59  return AVERROR(ENOBUFS);
60  case VDP_STATUS_HANDLE_DEVICE_MISMATCH:
61  return AVERROR(EXDEV);
62  case VDP_STATUS_ERROR:
63  return AVERROR(EIO);
64  default:
65  return AVERROR(EINVAL);
66  }
67 }
68 
70 {
71  return av_vdpau_alloc_context();
72 }
73 
74 #define MAKE_ACCESSORS(str, name, type, field) \
75  type av_##name##_get_##field(const str *s) { return s->field; } \
76  void av_##name##_set_##field(str *s, type v) { s->field = v; }
77 MAKE_ACCESSORS(AVVDPAUContext, vdpau_hwaccel, AVVDPAU_Render2, render2)
78 
80  VdpChromaType *type,
81  uint32_t *width, uint32_t *height)
82 {
83  VdpChromaType t;
84  uint32_t w = avctx->coded_width;
85  uint32_t h = avctx->coded_height;
86 
87  /* See <vdpau/vdpau.h> for per-type alignment constraints. */
88  switch (avctx->sw_pix_fmt) {
89  case AV_PIX_FMT_YUV420P:
93  t = VDP_CHROMA_TYPE_420;
94  w = (w + 1) & ~1;
95  h = (h + 3) & ~3;
96  break;
97  case AV_PIX_FMT_YUV422P:
99  t = VDP_CHROMA_TYPE_422;
100  w = (w + 1) & ~1;
101  h = (h + 1) & ~1;
102  break;
103  case AV_PIX_FMT_YUV444P:
104  case AV_PIX_FMT_YUVJ444P:
107  t = VDP_CHROMA_TYPE_444;
108  h = (h + 1) & ~1;
109  break;
110  default:
111  return AVERROR(ENOSYS);
112  }
113 
114  if (type)
115  *type = t;
116  if (width)
117  *width = w;
118  if (height)
119  *height = h;
120  return 0;
121 }
122 
124  AVBufferRef *hw_frames_ctx)
125 {
126  AVHWFramesContext *hw_frames = (AVHWFramesContext*)hw_frames_ctx->data;
127  VdpChromaType type;
128  uint32_t width;
129  uint32_t height;
130 
132  return AVERROR(EINVAL);
133 
134  hw_frames->format = AV_PIX_FMT_VDPAU;
135  hw_frames->sw_format = avctx->sw_pix_fmt;
136  hw_frames->width = width;
137  hw_frames->height = height;
138 
139  return 0;
140 }
141 
142 int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile,
143  int level)
144 {
145  VDPAUHWContext *hwctx = avctx->hwaccel_context;
146  VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
147  VdpVideoSurfaceQueryCapabilities *surface_query_caps;
148  VdpDecoderQueryCapabilities *decoder_query_caps;
149  VdpDecoderCreate *create;
150  VdpGetInformationString *info;
151  const char *info_string;
152  void *func;
153  VdpStatus status;
154  VdpBool supported;
155  uint32_t max_level, max_mb, max_width, max_height;
156  VdpChromaType type;
157  uint32_t width;
158  uint32_t height;
159  int ret;
160 
161  vdctx->width = UINT32_MAX;
162  vdctx->height = UINT32_MAX;
163 
165  return AVERROR(ENOSYS);
166 
167  if (hwctx) {
168  hwctx->reset = 0;
169 
170  if (hwctx->context.decoder != VDP_INVALID_HANDLE) {
171  vdctx->decoder = hwctx->context.decoder;
172  vdctx->render = hwctx->context.render;
173  vdctx->device = VDP_INVALID_HANDLE;
174  return 0; /* Decoder created by user */
175  }
176 
177  vdctx->device = hwctx->device;
178  vdctx->get_proc_address = hwctx->get_proc_address;
179 
180  if (hwctx->flags & AV_HWACCEL_FLAG_IGNORE_LEVEL)
181  level = 0;
182 
183  if (!(hwctx->flags & AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH) &&
184  type != VDP_CHROMA_TYPE_420)
185  return AVERROR(ENOSYS);
186  } else {
187  AVHWFramesContext *frames_ctx;
188  AVVDPAUDeviceContext *dev_ctx;
189 
191  if (ret < 0)
192  return ret;
193 
194  frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
195  dev_ctx = frames_ctx->device_ctx->hwctx;
196 
197  vdctx->device = dev_ctx->device;
198  vdctx->get_proc_address = dev_ctx->get_proc_address;
199 
201  level = 0;
202  }
203 
204  if (level < 0)
205  return AVERROR(ENOTSUP);
206 
207  status = vdctx->get_proc_address(vdctx->device,
208  VDP_FUNC_ID_GET_INFORMATION_STRING,
209  &func);
210  if (status != VDP_STATUS_OK)
211  return vdpau_error(status);
212  else
213  info = func;
214 
215  status = info(&info_string);
216  if (status != VDP_STATUS_OK)
217  return vdpau_error(status);
218  if (avctx->codec_id == AV_CODEC_ID_HEVC && strncmp(info_string, "NVIDIA ", 7) == 0 &&
220  int driver_version = 0;
221  sscanf(info_string, "NVIDIA VDPAU Driver Shared Library %d", &driver_version);
222  if (driver_version < 410) {
223  av_log(avctx, AV_LOG_VERBOSE, "HEVC with NVIDIA VDPAU drivers is buggy, skipping.\n");
224  return AVERROR(ENOTSUP);
225  }
226  }
227 
228  status = vdctx->get_proc_address(vdctx->device,
229  VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES,
230  &func);
231  if (status != VDP_STATUS_OK)
232  return vdpau_error(status);
233  else
234  surface_query_caps = func;
235 
236  status = surface_query_caps(vdctx->device, type, &supported,
237  &max_width, &max_height);
238  if (status != VDP_STATUS_OK)
239  return vdpau_error(status);
240  if (supported != VDP_TRUE ||
241  max_width < width || max_height < height)
242  return AVERROR(ENOTSUP);
243 
244  status = vdctx->get_proc_address(vdctx->device,
245  VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES,
246  &func);
247  if (status != VDP_STATUS_OK)
248  return vdpau_error(status);
249  else
250  decoder_query_caps = func;
251 
252  status = decoder_query_caps(vdctx->device, profile, &supported, &max_level,
253  &max_mb, &max_width, &max_height);
254 #ifdef VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE
255  if ((status != VDP_STATUS_OK || supported != VDP_TRUE) && profile == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE) {
256  profile = VDP_DECODER_PROFILE_H264_MAIN;
257  status = decoder_query_caps(vdctx->device, profile, &supported,
258  &max_level, &max_mb,
259  &max_width, &max_height);
260  }
261 #endif
262  if (status != VDP_STATUS_OK)
263  return vdpau_error(status);
264 
265  if (supported != VDP_TRUE || max_level < level ||
266  max_width < width || max_height < height)
267  return AVERROR(ENOTSUP);
268 
269  status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_CREATE,
270  &func);
271  if (status != VDP_STATUS_OK)
272  return vdpau_error(status);
273  else
274  create = func;
275 
276  status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_RENDER,
277  &func);
278  if (status != VDP_STATUS_OK)
279  return vdpau_error(status);
280  else
281  vdctx->render = func;
282 
283  status = create(vdctx->device, profile, width, height, avctx->refs,
284  &vdctx->decoder);
285  if (status == VDP_STATUS_OK) {
286  vdctx->width = avctx->coded_width;
287  vdctx->height = avctx->coded_height;
288  }
289 
290  return vdpau_error(status);
291 }
292 
294 {
295  VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
296  VdpDecoderDestroy *destroy;
297  void *func;
298  VdpStatus status;
299 
300  if (vdctx->device == VDP_INVALID_HANDLE)
301  return 0; /* Decoder created and destroyed by user */
302  if (vdctx->width == UINT32_MAX && vdctx->height == UINT32_MAX)
303  return 0;
304 
305  status = vdctx->get_proc_address(vdctx->device,
306  VDP_FUNC_ID_DECODER_DESTROY, &func);
307  if (status != VDP_STATUS_OK)
308  return vdpau_error(status);
309  else
310  destroy = func;
311 
312  status = destroy(vdctx->decoder);
313  return vdpau_error(status);
314 }
315 
317 {
318  VDPAUHWContext *hwctx = avctx->hwaccel_context;
319  VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
320 
321  if (vdctx->device == VDP_INVALID_HANDLE)
322  return 0; /* Decoder created by user */
323  if (avctx->coded_width == vdctx->width &&
324  avctx->coded_height == vdctx->height && (!hwctx || !hwctx->reset))
325  return 0;
326 
327  avctx->hwaccel->uninit(avctx);
328  return avctx->hwaccel->init(avctx);
329 }
330 
332  av_unused const uint8_t *buffer,
333  av_unused uint32_t size)
334 {
335  pic_ctx->bitstream_buffers_allocated = 0;
336  pic_ctx->bitstream_buffers_used = 0;
337  pic_ctx->bitstream_buffers = NULL;
338  return 0;
339 }
340 
342  struct vdpau_picture_context *pic_ctx)
343 {
344  VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
345  AVVDPAUContext *hwctx = avctx->hwaccel_context;
346  VdpVideoSurface surf = ff_vdpau_get_surface_id(frame);
347  VdpStatus status;
348  int val;
349 
350  val = ff_vdpau_common_reinit(avctx);
351  if (val < 0)
352  return val;
353 
354  if (hwctx && !hwctx->render && hwctx->render2) {
355  status = hwctx->render2(avctx, frame, (void *)&pic_ctx->info,
356  pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers);
357  } else
358  status = vdctx->render(vdctx->decoder, surf, &pic_ctx->info,
359  pic_ctx->bitstream_buffers_used,
360  pic_ctx->bitstream_buffers);
361 
362  av_freep(&pic_ctx->bitstream_buffers);
363 
364  return vdpau_error(status);
365 }
366 
367 #if CONFIG_MPEG1_VDPAU_HWACCEL || \
368  CONFIG_MPEG2_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL || \
369  CONFIG_VC1_VDPAU_HWACCEL || CONFIG_WMV3_VDPAU_HWACCEL
371 {
372  MpegEncContext *s = avctx->priv_data;
373  Picture *pic = s->current_picture_ptr;
374  struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
375  int val;
376 
377  val = ff_vdpau_common_end_frame(avctx, pic->f, pic_ctx);
378  if (val < 0)
379  return val;
380 
381  ff_mpeg_draw_horiz_band(s, 0, s->avctx->height);
382  return 0;
383 }
384 #endif
385 
387  const uint8_t *buf, uint32_t size)
388 {
389  VdpBitstreamBuffer *buffers = pic_ctx->bitstream_buffers;
390 
391  buffers = av_fast_realloc(buffers, &pic_ctx->bitstream_buffers_allocated,
392  (pic_ctx->bitstream_buffers_used + 1) * sizeof(*buffers));
393  if (!buffers)
394  return AVERROR(ENOMEM);
395 
396  pic_ctx->bitstream_buffers = buffers;
397  buffers += pic_ctx->bitstream_buffers_used++;
398 
399  buffers->struct_version = VDP_BITSTREAM_BUFFER_VERSION;
400  buffers->bitstream = buf;
401  buffers->bitstream_bytes = size;
402  return 0;
403 }
404 
406 {
407  return av_mallocz(sizeof(VDPAUHWContext));
408 }
409 
410 int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
411  VdpGetProcAddress *get_proc, unsigned flags)
412 {
413  VDPAUHWContext *hwctx;
414 
416  return AVERROR(EINVAL);
417 
418  if (av_reallocp(&avctx->hwaccel_context, sizeof(*hwctx)))
419  return AVERROR(ENOMEM);
420 
421  hwctx = avctx->hwaccel_context;
422 
423  memset(hwctx, 0, sizeof(*hwctx));
424  hwctx->context.decoder = VDP_INVALID_HANDLE;
425  hwctx->device = device;
426  hwctx->get_proc_address = get_proc;
427  hwctx->flags = flags;
428  hwctx->reset = 1;
429  return 0;
430 }
431 
432 /* @}*/
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:1379
AVCodecContext::hwaccel_context
void * hwaccel_context
Hardware accelerator context.
Definition: avcodec.h:1390
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:206
ff_vdpau_common_frame_params
int ff_vdpau_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
Definition: vdpau.c:123
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:316
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
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:325
VDPAUHWContext::get_proc_address
VdpGetProcAddress * get_proc_address
Definition: vdpau_internal.h:68
vdpau_picture_context::bitstream_buffers_used
int bitstream_buffers_used
Useful bitstream buffers in the bitstream buffers table.
Definition: vdpau_internal.h:112
w
uint8_t w
Definition: llviddspenc.c:38
internal.h
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:406
AVHWAccel::init
int(* init)(AVCodecContext *avctx)
Initialize the hwaccel private data.
Definition: avcodec.h:2185
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:46
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:94
VDPAUContext::render
VdpDecoderRender * render
VDPAU decoder render callback.
Definition: vdpau_internal.h:92
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:2231
VDPAUHWContext::device
VdpDevice device
Definition: vdpau_internal.h:67
vdpau_picture_context
Definition: vdpau_internal.h:98
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:938
val
static double val(void *priv, double ch)
Definition: aeval.c:77
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:577
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:386
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:409
mpegvideodec.h
ff_vdpau_common_init
int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, int level)
Definition: vdpau.c:142
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:505
width
#define width
s
#define s(width, name)
Definition: cbs_vp9.c:256
AVHWAccel::uninit
int(* uninit)(AVCodecContext *avctx)
Uninitialize the hwaccel private data.
Definition: avcodec.h:2193
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:410
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:2237
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:331
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:79
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:951
AVCodecContext::codec_id
enum AVCodecID codec_id
Definition: avcodec.h:399
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:95
AVCodecContext::internal
struct AVCodecInternal * internal
Private context used for internal data.
Definition: avcodec.h:424
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:341
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:2251
MAKE_ACCESSORS
#define MAKE_ACCESSORS(str, name, type, field)
Definition: vdpau.c:74
AVVDPAUContext::render
VdpDecoderRender * render
VDPAU decoder render callback.
Definition: vdpau.h:93
VDPAUHWContext
Definition: vdpau_internal.h:65
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:79
VDPAUContext::device
VdpDevice device
VDPAU device handle.
Definition: vdpau_internal.h:77
ff_vdpau_common_uninit
int ff_vdpau_common_uninit(AVCodecContext *avctx)
Definition: vdpau.c:293
VDPAUContext
Definition: vdpau_internal.h:73
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:120
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:186
VDPAUContext::decoder
VdpDecoder decoder
VDPAU decoder handle.
Definition: vdpau_internal.h:82
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:413
ff_mpeg_draw_horiz_band
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
Definition: mpegvideo_dec.c:543
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
VDPAUHWContext::reset
char reset
Definition: vdpau_internal.h:69
AVCodecContext::hwaccel_flags
int hwaccel_flags
Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated decoding (if active).
Definition: avcodec.h:1939
vdpau_picture_context::bitstream_buffers
VdpBitstreamBuffer * bitstream_buffers
Table of bitstream buffers.
Definition: vdpau_internal.h:117
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:405
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:264
VDPAUHWContext::context
AVVDPAUContext context
Definition: vdpau_internal.h:66
AV_HWDEVICE_TYPE_VDPAU
@ AV_HWDEVICE_TYPE_VDPAU
Definition: hwcontext.h:29
profile
int profile
Definition: mxfenc.c:2005
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:1880
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:87
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:410
vdpau_picture_context::bitstream_buffers_allocated
int bitstream_buffers_allocated
Allocated size of the bitstream_buffers table.
Definition: vdpau_internal.h:107
AVCodecContext
main external API structure.
Definition: avcodec.h:389
vdpau_picture_context::info
union VDPAUPictureInfo info
VDPAU picture information.
Definition: vdpau_internal.h:102
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:47
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:577
vdpau_error
static int vdpau_error(VdpStatus status)
Definition: vdpau.c:45
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:69
VDPAUHWContext::flags
unsigned char flags
Definition: vdpau_internal.h:70
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:416
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
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:1739
AVVDPAUDeviceContext::device
VdpDevice device
Definition: hwcontext_vdpau.h:36
int
int
Definition: ffmpeg_filter.c:153
MpegEncContext
MpegEncContext.
Definition: mpegvideo.h:62