FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 MAKE_ACCESSORS(AVVDPAUContext, vdpau_hwaccel, AVVDPAU_Render2, render2)
73 
75  VdpChromaType *type,
76  uint32_t *width, uint32_t *height)
77 {
78  VdpChromaType t;
79  uint32_t w = avctx->coded_width;
80  uint32_t h = avctx->coded_height;
81 
82  /* See <vdpau/vdpau.h> for per-type alignment constraints. */
83  switch (avctx->sw_pix_fmt) {
84  case AV_PIX_FMT_YUV420P:
86  t = VDP_CHROMA_TYPE_420;
87  w = (w + 1) & ~1;
88  h = (h + 3) & ~3;
89  break;
90  case AV_PIX_FMT_YUV422P:
92  t = VDP_CHROMA_TYPE_422;
93  w = (w + 1) & ~1;
94  h = (h + 1) & ~1;
95  break;
96  case AV_PIX_FMT_YUV444P:
98  t = VDP_CHROMA_TYPE_444;
99  h = (h + 1) & ~1;
100  break;
101  default:
102  return AVERROR(ENOSYS);
103  }
104 
105  if (type)
106  *type = t;
107  if (width)
108  *width = w;
109  if (height)
110  *height = h;
111  return 0;
112 }
113 
115  AVBufferRef *hw_frames_ctx)
116 {
117  AVHWFramesContext *hw_frames = (AVHWFramesContext*)hw_frames_ctx->data;
118  VdpChromaType type;
119  uint32_t width;
120  uint32_t height;
121 
123  return AVERROR(EINVAL);
124 
125  hw_frames->format = AV_PIX_FMT_VDPAU;
126  hw_frames->sw_format = avctx->sw_pix_fmt;
127  hw_frames->width = width;
128  hw_frames->height = height;
129 
130  return 0;
131 }
132 
133 int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile,
134  int level)
135 {
136  VDPAUHWContext *hwctx = avctx->hwaccel_context;
137  VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
138  VdpVideoSurfaceQueryCapabilities *surface_query_caps;
139  VdpDecoderQueryCapabilities *decoder_query_caps;
140  VdpDecoderCreate *create;
141  VdpGetInformationString *info;
142  const char *info_string;
143  void *func;
144  VdpStatus status;
145  VdpBool supported;
146  uint32_t max_level, max_mb, max_width, max_height;
147  VdpChromaType type;
148  uint32_t width;
149  uint32_t height;
150  int ret;
151 
152  vdctx->width = UINT32_MAX;
153  vdctx->height = UINT32_MAX;
154 
155  if (av_vdpau_get_surface_parameters(avctx, &type, &width, &height))
156  return AVERROR(ENOSYS);
157 
158  if (hwctx) {
159  hwctx->reset = 0;
160 
161  if (hwctx->context.decoder != VDP_INVALID_HANDLE) {
162  vdctx->decoder = hwctx->context.decoder;
163  vdctx->render = hwctx->context.render;
164  vdctx->device = VDP_INVALID_HANDLE;
165  return 0; /* Decoder created by user */
166  }
167 
168  vdctx->device = hwctx->device;
169  vdctx->get_proc_address = hwctx->get_proc_address;
170 
171  if (hwctx->flags & AV_HWACCEL_FLAG_IGNORE_LEVEL)
172  level = 0;
173 
174  if (!(hwctx->flags & AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH) &&
175  type != VDP_CHROMA_TYPE_420)
176  return AVERROR(ENOSYS);
177  } else {
178  AVHWFramesContext *frames_ctx;
179  AVVDPAUDeviceContext *dev_ctx;
180 
182  if (ret < 0)
183  return ret;
184 
185  frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
186  dev_ctx = frames_ctx->device_ctx->hwctx;
187 
188  vdctx->device = dev_ctx->device;
189  vdctx->get_proc_address = dev_ctx->get_proc_address;
190 
192  level = 0;
193  }
194 
195  if (level < 0)
196  return AVERROR(ENOTSUP);
197 
198  status = vdctx->get_proc_address(vdctx->device,
199  VDP_FUNC_ID_GET_INFORMATION_STRING,
200  &func);
201  if (status != VDP_STATUS_OK)
202  return vdpau_error(status);
203  else
204  info = func;
205 
206  status = info(&info_string);
207  if (status != VDP_STATUS_OK)
208  return vdpau_error(status);
209  if (avctx->codec_id == AV_CODEC_ID_HEVC && strncmp(info_string, "NVIDIA ", 7) == 0 &&
211  av_log(avctx, AV_LOG_VERBOSE, "HEVC with NVIDIA VDPAU drivers is buggy, skipping.\n");
212  return AVERROR(ENOTSUP);
213  }
214 
215  status = vdctx->get_proc_address(vdctx->device,
216  VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES,
217  &func);
218  if (status != VDP_STATUS_OK)
219  return vdpau_error(status);
220  else
221  surface_query_caps = func;
222 
223  status = surface_query_caps(vdctx->device, type, &supported,
224  &max_width, &max_height);
225  if (status != VDP_STATUS_OK)
226  return vdpau_error(status);
227  if (supported != VDP_TRUE ||
228  max_width < width || max_height < height)
229  return AVERROR(ENOTSUP);
230 
231  status = vdctx->get_proc_address(vdctx->device,
232  VDP_FUNC_ID_DECODER_QUERY_CAPABILITIES,
233  &func);
234  if (status != VDP_STATUS_OK)
235  return vdpau_error(status);
236  else
237  decoder_query_caps = func;
238 
239  status = decoder_query_caps(vdctx->device, profile, &supported, &max_level,
240  &max_mb, &max_width, &max_height);
241 #ifdef VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE
242  if ((status != VDP_STATUS_OK || supported != VDP_TRUE) && profile == VDP_DECODER_PROFILE_H264_CONSTRAINED_BASELINE) {
243  profile = VDP_DECODER_PROFILE_H264_MAIN;
244  status = decoder_query_caps(vdctx->device, profile, &supported,
245  &max_level, &max_mb,
246  &max_width, &max_height);
247  }
248 #endif
249  if (status != VDP_STATUS_OK)
250  return vdpau_error(status);
251 
252  if (supported != VDP_TRUE || max_level < level ||
253  max_width < width || max_height < height)
254  return AVERROR(ENOTSUP);
255 
256  status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_CREATE,
257  &func);
258  if (status != VDP_STATUS_OK)
259  return vdpau_error(status);
260  else
261  create = func;
262 
263  status = vdctx->get_proc_address(vdctx->device, VDP_FUNC_ID_DECODER_RENDER,
264  &func);
265  if (status != VDP_STATUS_OK)
266  return vdpau_error(status);
267  else
268  vdctx->render = func;
269 
270  status = create(vdctx->device, profile, width, height, avctx->refs,
271  &vdctx->decoder);
272  if (status == VDP_STATUS_OK) {
273  vdctx->width = avctx->coded_width;
274  vdctx->height = avctx->coded_height;
275  }
276 
277  return vdpau_error(status);
278 }
279 
281 {
282  VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
283  VdpDecoderDestroy *destroy;
284  void *func;
285  VdpStatus status;
286 
287  if (vdctx->device == VDP_INVALID_HANDLE)
288  return 0; /* Decoder created and destroyed by user */
289  if (vdctx->width == UINT32_MAX && vdctx->height == UINT32_MAX)
290  return 0;
291 
292  status = vdctx->get_proc_address(vdctx->device,
293  VDP_FUNC_ID_DECODER_DESTROY, &func);
294  if (status != VDP_STATUS_OK)
295  return vdpau_error(status);
296  else
297  destroy = func;
298 
299  status = destroy(vdctx->decoder);
300  return vdpau_error(status);
301 }
302 
304 {
305  VDPAUHWContext *hwctx = avctx->hwaccel_context;
306  VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
307 
308  if (vdctx->device == VDP_INVALID_HANDLE)
309  return 0; /* Decoder created by user */
310  if (avctx->coded_width == vdctx->width &&
311  avctx->coded_height == vdctx->height && (!hwctx || !hwctx->reset))
312  return 0;
313 
314  avctx->hwaccel->uninit(avctx);
315  return avctx->hwaccel->init(avctx);
316 }
317 
319  av_unused const uint8_t *buffer,
320  av_unused uint32_t size)
321 {
322  pic_ctx->bitstream_buffers_allocated = 0;
323  pic_ctx->bitstream_buffers_used = 0;
324  pic_ctx->bitstream_buffers = NULL;
325  return 0;
326 }
327 
329  struct vdpau_picture_context *pic_ctx)
330 {
331  VDPAUContext *vdctx = avctx->internal->hwaccel_priv_data;
332  AVVDPAUContext *hwctx = avctx->hwaccel_context;
333  VdpVideoSurface surf = ff_vdpau_get_surface_id(frame);
334  VdpStatus status;
335  int val;
336 
337  val = ff_vdpau_common_reinit(avctx);
338  if (val < 0)
339  return val;
340 
341  if (hwctx && !hwctx->render && hwctx->render2) {
342  status = hwctx->render2(avctx, frame, (void *)&pic_ctx->info,
343  pic_ctx->bitstream_buffers_used, pic_ctx->bitstream_buffers);
344  } else
345  status = vdctx->render(vdctx->decoder, surf, &pic_ctx->info,
346  pic_ctx->bitstream_buffers_used,
347  pic_ctx->bitstream_buffers);
348 
349  av_freep(&pic_ctx->bitstream_buffers);
350 
351  return vdpau_error(status);
352 }
353 
354 #if CONFIG_MPEG1_VDPAU_HWACCEL || \
355  CONFIG_MPEG2_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL || \
356  CONFIG_VC1_VDPAU_HWACCEL || CONFIG_WMV3_VDPAU_HWACCEL
358 {
359  MpegEncContext *s = avctx->priv_data;
360  Picture *pic = s->current_picture_ptr;
361  struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
362  int val;
363 
364  val = ff_vdpau_common_end_frame(avctx, pic->f, pic_ctx);
365  if (val < 0)
366  return val;
367 
369  return 0;
370 }
371 #endif
372 
374  const uint8_t *buf, uint32_t size)
375 {
376  VdpBitstreamBuffer *buffers = pic_ctx->bitstream_buffers;
377 
378  buffers = av_fast_realloc(buffers, &pic_ctx->bitstream_buffers_allocated,
379  (pic_ctx->bitstream_buffers_used + 1) * sizeof(*buffers));
380  if (!buffers)
381  return AVERROR(ENOMEM);
382 
383  pic_ctx->bitstream_buffers = buffers;
384  buffers += pic_ctx->bitstream_buffers_used++;
385 
386  buffers->struct_version = VDP_BITSTREAM_BUFFER_VERSION;
387  buffers->bitstream = buf;
388  buffers->bitstream_bytes = size;
389  return 0;
390 }
391 
392 #if FF_API_VDPAU_PROFILE
393 int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile)
394 {
395 #define PROFILE(prof) \
396 do { \
397  *profile = VDP_DECODER_PROFILE_##prof; \
398  return 0; \
399 } while (0)
400 
401  switch (avctx->codec_id) {
402  case AV_CODEC_ID_MPEG1VIDEO: PROFILE(MPEG1);
404  switch (avctx->profile) {
405  case FF_PROFILE_MPEG2_MAIN: PROFILE(MPEG2_MAIN);
406  case FF_PROFILE_MPEG2_SIMPLE: PROFILE(MPEG2_SIMPLE);
407  default: return AVERROR(EINVAL);
408  }
409  case AV_CODEC_ID_H263: PROFILE(MPEG4_PART2_ASP);
410  case AV_CODEC_ID_MPEG4:
411  switch (avctx->profile) {
412  case FF_PROFILE_MPEG4_SIMPLE: PROFILE(MPEG4_PART2_SP);
413  case FF_PROFILE_MPEG4_ADVANCED_SIMPLE: PROFILE(MPEG4_PART2_ASP);
414  default: return AVERROR(EINVAL);
415  }
416  case AV_CODEC_ID_H264:
417  switch (avctx->profile & ~FF_PROFILE_H264_INTRA) {
418  case FF_PROFILE_H264_BASELINE: PROFILE(H264_BASELINE);
420  case FF_PROFILE_H264_MAIN: PROFILE(H264_MAIN);
421  case FF_PROFILE_H264_HIGH: PROFILE(H264_HIGH);
422 #ifdef VDP_DECODER_PROFILE_H264_EXTENDED
423  case FF_PROFILE_H264_EXTENDED: PROFILE(H264_EXTENDED);
424 #endif
425  default: return AVERROR(EINVAL);
426  }
427  case AV_CODEC_ID_WMV3:
428  case AV_CODEC_ID_VC1:
429  switch (avctx->profile) {
430  case FF_PROFILE_VC1_SIMPLE: PROFILE(VC1_SIMPLE);
431  case FF_PROFILE_VC1_MAIN: PROFILE(VC1_MAIN);
432  case FF_PROFILE_VC1_ADVANCED: PROFILE(VC1_ADVANCED);
433  default: return AVERROR(EINVAL);
434  }
435  }
436  return AVERROR(EINVAL);
437 #undef PROFILE
438 }
439 #endif /* FF_API_VDPAU_PROFILE */
440 
442 {
443  return av_mallocz(sizeof(VDPAUHWContext));
444 }
445 
446 int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
447  VdpGetProcAddress *get_proc, unsigned flags)
448 {
449  VDPAUHWContext *hwctx;
450 
452  return AVERROR(EINVAL);
453 
454  if (av_reallocp(&avctx->hwaccel_context, sizeof(*hwctx)))
455  return AVERROR(ENOMEM);
456 
457  hwctx = avctx->hwaccel_context;
458 
459  memset(hwctx, 0, sizeof(*hwctx));
460  hwctx->context.decoder = VDP_INVALID_HANDLE;
461  hwctx->device = device;
462  hwctx->get_proc_address = get_proc;
463  hwctx->flags = flags;
464  hwctx->reset = 1;
465  return 0;
466 }
467 
468 /* @}*/
#define FF_PROFILE_H264_MAIN
Definition: avcodec.h:2884
#define FF_PROFILE_MPEG4_SIMPLE
Definition: avcodec.h:2903
#define NULL
Definition: coverity.c:32
const char const char void * val
Definition: avisynth_c.h:771
This struct is allocated as AVHWDeviceContext.hwctx.
const char * s
Definition: avisynth_c.h:768
#define FF_PROFILE_MPEG2_MAIN
Definition: avcodec.h:2876
This structure describes decoded (raw) audio or video data.
Definition: frame.h:218
int(* init)(AVCodecContext *avctx)
Initialize the hwaccel private data.
Definition: avcodec.h:3706
VdpDevice device
VDPAU device handle.
int coded_width
Bitstream width / height, may be different from width/height e.g.
Definition: avcodec.h:1705
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:67
VdpGetProcAddress * get_proc_address
VdpDecoder decoder
VDPAU decoder handle.
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:318
VdpGetProcAddress * get_proc_address
#define FF_PROFILE_H264_INTRA
Definition: avcodec.h:2880
int width
The allocated dimensions of the frames in this pool.
Definition: hwcontext.h:228
int bitstream_buffers_used
Useful bitstream buffers in the bitstream buffers table.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
Definition: hwcontext.h:208
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:236
Public libavcodec VDPAU header.
const struct AVHWAccel * hwaccel
Hardware accelerator in use.
Definition: avcodec.h:2674
int profile
profile
Definition: avcodec.h:2843
AVVDPAUContext * av_vdpau_alloc_context(void)
Allocate an AVVDPAUContext.
Definition: vdpau.c:441
AVVDPAUContext * av_alloc_vdpaucontext(void)
allocation function for AVVDPAUContext
Definition: vdpau.c:67
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:74
void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h)
Definition: mpegvideo.c:2224
VdpBitstreamBuffer * bitstream_buffers
Table of bitstream buffers.
#define FF_PROFILE_H264_BASELINE
Definition: avcodec.h:2882
int ff_vdpau_common_uninit(AVCodecContext *avctx)
Definition: vdpau.c:280
uint8_t
void * hwaccel_context
Hardware accelerator context.
Definition: avcodec.h:2686
VdpGetProcAddress * get_proc_address
VDPAU device driver.
static AVFrame * frame
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
Definition: hwcontext.h:91
#define height
static int flags
Definition: log.c:55
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:75
VdpDecoder decoder
VDPAU decoder handle.
Definition: vdpau.h:87
#define FF_PROFILE_H264_EXTENDED
Definition: avcodec.h:2885
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:192
ptrdiff_t size
Definition: opengl_enc.c:101
AVVDPAUContext context
#define av_log(a,...)
int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile)
Get a decoder profile that should be used for initializing a VDPAU decoder.
Definition: vdpau.c:393
VdpDevice device
#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:3752
#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:3758
#define PROFILE(prof)
int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile, int level)
Definition: vdpau.c:133
This structure is used to share data between the libavcodec library and the client video application...
Definition: vdpau.h:81
#define MAKE_ACCESSORS(str, name, type, field)
Definition: internal.h:91
#define AVERROR(e)
Definition: error.h:43
#define FF_PROFILE_H264_HIGH
Definition: avcodec.h:2886
uint16_t width
Definition: gdv.c:47
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)
Definition: pixfmt.h:66
int refs
number of reference frames
Definition: avcodec.h:2101
uint32_t width
AVHWDeviceContext * device_ctx
The parent AVHWDeviceContext.
Definition: hwcontext.h:148
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:74
uint8_t w
Definition: llviddspenc.c:38
#define FF_PROFILE_VC1_MAIN
Definition: avcodec.h:2899
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames...
Definition: avcodec.h:3197
Picture * current_picture_ptr
pointer to the current picture
Definition: mpegvideo.h:184
Picture.
Definition: mpegpicture.h:45
void * hwaccel_picture_private
Hardware accelerator private data.
Definition: mpegpicture.h:77
static int vdpau_error(VdpStatus status)
Definition: vdpau.c:43
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
H.264 / AVC / MPEG-4 part10 codec.
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:464
int ff_vdpau_common_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
Definition: vdpau.c:114
#define FF_PROFILE_VC1_SIMPLE
Definition: avcodec.h:2898
preferred ID for MPEG-1/2 video decoding
Definition: avcodec.h:220
static void destroy(struct ResampleContext **c)
Definition: soxr_resample.c:64
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:163
Libavcodec external API header.
enum AVCodecID codec_id
Definition: avcodec.h:1528
int ff_vdpau_mpeg_end_frame(AVCodecContext *avctx)
main external API structure.
Definition: avcodec.h:1518
#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE
Definition: avcodec.h:2918
uint8_t * data
The data buffer.
Definition: buffer.h:89
void * buf
Definition: avisynth_c.h:690
GLint GLenum type
Definition: opengl_enc.c:105
VdpDecoderRender * render
VDPAU decoder render callback.
int coded_height
Definition: avcodec.h:1705
struct AVFrame * f
Definition: mpegpicture.h:46
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
Definition: pixfmt.h:193
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:123
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:67
VdpDecoderRender * render
VDPAU decoder render callback.
Definition: vdpau.h:94
int(* AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *, const VdpPictureInfo *, uint32_t, const VdpBitstreamBuffer *)
Definition: vdpau.h:63
mfxU16 profile
Definition: qsvenc.c:44
int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx, enum AVHWDeviceType dev_type)
Make sure avctx.hw_frames_ctx is set.
Definition: decode.c:1150
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:446
uint8_t level
Definition: svq3.c:207
MpegEncContext.
Definition: mpegvideo.h:81
struct AVCodecContext * avctx
Definition: mpegvideo.h:98
A reference to a data buffer.
Definition: buffer.h:81
int
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:62
AVVDPAU_Render2 render2
Definition: vdpau.h:96
common internal api header.
if(ret< 0)
Definition: vf_mcdeint.c:279
GLuint * buffers
Definition: opengl_enc.c:99
int ff_vdpau_add_buffer(struct vdpau_picture_context *pic_ctx, const uint8_t *buf, uint32_t size)
Definition: vdpau.c:373
int(* uninit)(AVCodecContext *avctx)
Uninitialize the hwaccel private data.
Definition: avcodec.h:3714
void * hwaccel_priv_data
hwaccel-specific private data
Definition: internal.h:190
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:76
unsigned char flags
int ff_vdpau_common_end_frame(AVCodecContext *avctx, AVFrame *frame, struct vdpau_picture_context *pic_ctx)
Definition: vdpau.c:328
void * priv_data
Definition: avcodec.h:1545
#define FF_PROFILE_VC1_ADVANCED
Definition: avcodec.h:2901
struct AVCodecInternal * internal
Private context used for internal data.
Definition: avcodec.h:1553
union VDPAUPictureInfo info
VDPAU picture information.
#define FF_PROFILE_MPEG2_SIMPLE
Definition: avcodec.h:2877
#define av_freep(p)
#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:3772
int hwaccel_flags
Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated decoding (if active)...
Definition: avcodec.h:3258
#define FF_PROFILE_H264_CONSTRAINED_BASELINE
Definition: avcodec.h:2883
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
Definition: hwcontext.h:221
uint32_t height
static int ff_vdpau_common_reinit(AVCodecContext *avctx)
Definition: vdpau.c:303
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:3047
GLuint buffer
Definition: opengl_enc.c:102
#define av_unused
Definition: attributes.h:125
static uintptr_t ff_vdpau_get_surface_id(AVFrame *pic)
Extract VdpVideoSurface from an AVFrame.