FFmpeg
Data Structures | Macros | Functions | Variables
hwcontext_vdpau.c File Reference
#include "config.h"
#include <stdint.h>
#include <string.h>
#include <vdpau/vdpau.h>
#include "buffer.h"
#include "common.h"
#include "hwcontext.h"
#include "hwcontext_internal.h"
#include "hwcontext_vdpau.h"
#include "mem.h"
#include "pixfmt.h"
#include "pixdesc.h"

Go to the source code of this file.

Data Structures

struct  VDPAUPixFmtMap
 
struct  VDPAUDeviceContext
 
struct  VDPAUFramesContext
 

Macros

#define GET_CALLBACK(id, result)
 

Functions

static int count_pixfmts (const VDPAUPixFmtMap *map)
 
static int vdpau_init_pixmfts (AVHWDeviceContext *ctx)
 
static int vdpau_device_init (AVHWDeviceContext *ctx)
 
static void vdpau_device_uninit (AVHWDeviceContext *ctx)
 
static int vdpau_frames_get_constraints (AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints)
 
static void vdpau_buffer_free (void *opaque, uint8_t *data)
 
static AVBufferRefvdpau_pool_alloc (void *opaque, size_t size)
 
static int vdpau_frames_init (AVHWFramesContext *ctx)
 
static int vdpau_get_buffer (AVHWFramesContext *ctx, AVFrame *frame)
 
static int vdpau_transfer_get_formats (AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
 
static int vdpau_transfer_data_from (AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
 
static int vdpau_transfer_data_to (AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
 

Variables

static const VDPAUPixFmtMap pix_fmts_420 []
 
static const VDPAUPixFmtMap pix_fmts_422 []
 
static const VDPAUPixFmtMap pix_fmts_444 []
 
struct {
   VdpChromaType   chroma_type
 
   enum AVPixelFormat   frames_sw_format
 
   const VDPAUPixFmtMap *   map
 
vdpau_pix_fmts []
 
const HWContextType ff_hwcontext_type_vdpau
 

Macro Definition Documentation

◆ GET_CALLBACK

#define GET_CALLBACK (   id,
  result 
)
Value:
do { \
void *tmp; \
err = hwctx->get_proc_address(hwctx->device, id, &tmp); \
if (err != VDP_STATUS_OK) { \
av_log(ctx, AV_LOG_ERROR, "Error getting the " #id " callback.\n"); \
return AVERROR_UNKNOWN; \
} \
result = tmp; \
} while (0)

Definition at line 147 of file hwcontext_vdpau.c.

Function Documentation

◆ count_pixfmts()

static int count_pixfmts ( const VDPAUPixFmtMap map)
static

Definition at line 106 of file hwcontext_vdpau.c.

Referenced by vdpau_init_pixmfts().

◆ vdpau_init_pixmfts()

static int vdpau_init_pixmfts ( AVHWDeviceContext ctx)
static

Definition at line 116 of file hwcontext_vdpau.c.

Referenced by vdpau_device_init().

◆ vdpau_device_init()

static int vdpau_device_init ( AVHWDeviceContext ctx)
static

Definition at line 158 of file hwcontext_vdpau.c.

◆ vdpau_device_uninit()

static void vdpau_device_uninit ( AVHWDeviceContext ctx)
static

Definition at line 181 of file hwcontext_vdpau.c.

◆ vdpau_frames_get_constraints()

static int vdpau_frames_get_constraints ( AVHWDeviceContext ctx,
const void *  hwconfig,
AVHWFramesConstraints constraints 
)
static

Definition at line 190 of file hwcontext_vdpau.c.

◆ vdpau_buffer_free()

static void vdpau_buffer_free ( void *  opaque,
uint8_t *  data 
)
static

Definition at line 219 of file hwcontext_vdpau.c.

Referenced by vdpau_pool_alloc().

◆ vdpau_pool_alloc()

static AVBufferRef* vdpau_pool_alloc ( void *  opaque,
size_t  size 
)
static

Definition at line 228 of file hwcontext_vdpau.c.

Referenced by vdpau_frames_init().

◆ vdpau_frames_init()

static int vdpau_frames_init ( AVHWFramesContext ctx)
static

Definition at line 256 of file hwcontext_vdpau.c.

◆ vdpau_get_buffer()

static int vdpau_get_buffer ( AVHWFramesContext ctx,
AVFrame frame 
)
static

Definition at line 291 of file hwcontext_vdpau.c.

◆ vdpau_transfer_get_formats()

static int vdpau_transfer_get_formats ( AVHWFramesContext ctx,
enum AVHWFrameTransferDirection  dir,
enum AVPixelFormat **  formats 
)
static

Definition at line 305 of file hwcontext_vdpau.c.

◆ vdpau_transfer_data_from()

static int vdpau_transfer_data_from ( AVHWFramesContext ctx,
AVFrame dst,
const AVFrame src 
)
static

Definition at line 329 of file hwcontext_vdpau.c.

◆ vdpau_transfer_data_to()

static int vdpau_transfer_data_to ( AVHWFramesContext ctx,
AVFrame dst,
const AVFrame src 
)
static

Definition at line 387 of file hwcontext_vdpau.c.

Variable Documentation

◆ pix_fmts_420

const VDPAUPixFmtMap pix_fmts_420[]
static
Initial value:
= {
{ VDP_YCBCR_FORMAT_NV12, AV_PIX_FMT_NV12 },
{ VDP_YCBCR_FORMAT_YV12, AV_PIX_FMT_YUV420P },
{ 0, AV_PIX_FMT_NONE, },
}

Definition at line 40 of file hwcontext_vdpau.c.

◆ pix_fmts_422

const VDPAUPixFmtMap pix_fmts_422[]
static
Initial value:
= {
{ VDP_YCBCR_FORMAT_NV12, AV_PIX_FMT_NV16 },
{ VDP_YCBCR_FORMAT_YV12, AV_PIX_FMT_YUV422P },
{ VDP_YCBCR_FORMAT_UYVY, AV_PIX_FMT_UYVY422 },
{ VDP_YCBCR_FORMAT_YUYV, AV_PIX_FMT_YUYV422 },
{ 0, AV_PIX_FMT_NONE, },
}

Definition at line 50 of file hwcontext_vdpau.c.

◆ pix_fmts_444

const VDPAUPixFmtMap pix_fmts_444[]
static
Initial value:
= {
{ 0, AV_PIX_FMT_NONE, },
}

Definition at line 58 of file hwcontext_vdpau.c.

◆ chroma_type

VdpChromaType chroma_type

Definition at line 69 of file hwcontext_vdpau.c.

◆ frames_sw_format

enum AVPixelFormat frames_sw_format

Definition at line 70 of file hwcontext_vdpau.c.

Referenced by vdpau_frames_init().

◆ map

const VDPAUPixFmtMap* map

Definition at line 71 of file hwcontext_vdpau.c.

Referenced by ac3_decode_frame(), aptx_insert_sync(), av_get_pcm_codec(), av_spherical_tile_bounds(), bidir_refine(), colormap_insert(), colormap_nearest_node(), count_pixfmts(), create_map(), d3d11va_transfer_data(), decode_alcd(), decode_avcf(), decode_frame(), decode_inter_block(), decode_inter_blocks(), decode_inter_plane(), decode_intra_block(), decode_intra_blocks(), decode_motion_vectors(), disp_node(), drm_transfer_data_from(), drm_transfer_data_to(), drm_unmap_frame(), dxva2_map_frame(), dxva2_transfer_data_from(), dxva2_transfer_data_to(), epzs_motion_search_internal(), ff_huff_gen_len_table(), ff_opus_parse_extradata(), ff_vk_create_imageview(), fill_colmap(), fill_rgb2yuv_table(), fill_texture_ptrs(), filter_frame(), fits_decode_frame(), fits_encode_frame(), fps_umf2avr(), generate_joint_tables(), get_channel(), get_channel_idx(), get_channel_label(), get_vs_prop_int(), gif_image_write_image(), hwmap_filter_frame(), init(), ls_encode_regular(), ls_encode_runterm(), ls_get_code_runterm(), make_block_map(), make_horizontal_map(), make_vertical_map(), match_streams(), mov_read_kind(), mov_write_track_kinds(), new_audio_stream(), open_output_file(), opencl_map_frame(), opencl_unmap_frame(), opt_map(), opus_decode_packet(), parse_mapping(), print_ctl_info(), qpel_motion_search(), read_code(), read_map(), remap_frame_to_palette(), sab_diamond_search(), set_default_ctl_value(), shrink_palette(), small_diamond_search(), tonemap(), vaapi_map_frame(), vaapi_transfer_data_from(), vaapi_transfer_data_to(), vaapi_unmap_frame(), vdpau_init_pixmfts(), vdpau_transfer_data_from(), vdpau_transfer_data_to(), vp6_build_huff_tree(), vt_transfer_data_from(), vt_transfer_data_to(), vulkan_map_frame_to_mem(), vulkan_unmap_frame(), and wmv2_get_cbp_table_index().

◆ vdpau_pix_fmts

const { ... } vdpau_pix_fmts[]

◆ ff_hwcontext_type_vdpau

const HWContextType ff_hwcontext_type_vdpau
Initial value:
= {
.name = "VDPAU",
.device_hwctx_size = sizeof(AVVDPAUDeviceContext),
.device_priv_size = sizeof(VDPAUDeviceContext),
.frames_priv_size = sizeof(VDPAUFramesContext),
.device_uninit = vdpau_device_uninit,
.frames_get_constraints = vdpau_frames_get_constraints,
.frames_init = vdpau_frames_init,
.frames_get_buffer = vdpau_get_buffer,
.transfer_get_formats = vdpau_transfer_get_formats,
.transfer_data_to = vdpau_transfer_data_to,
.transfer_data_from = vdpau_transfer_data_from,
}

Definition at line 507 of file hwcontext_vdpau.c.

AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
VDPAUFramesContext
Definition: hwcontext_vdpau.c:96
vdpau_frames_init
static int vdpau_frames_init(AVHWFramesContext *ctx)
Definition: hwcontext_vdpau.c:256
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:26
AVVDPAUDeviceContext
This struct is allocated as AVHWDeviceContext.hwctx.
Definition: hwcontext_vdpau.h:35
AVERROR_UNKNOWN
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:73
pix_fmts_422
static const VDPAUPixFmtMap pix_fmts_422[]
Definition: hwcontext_vdpau.c:50
VDPAUDeviceContext
Definition: hwcontext_vdpau.c:85
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
device_init
static int device_init(AVFormatContext *ctx, int *width, int *height, uint32_t pixelformat)
Definition: v4l2.c:194
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:296
ctx
AVFormatContext * ctx
Definition: movenc.c:48
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
pix_fmts_420
static const VDPAUPixFmtMap pix_fmts_420[]
Definition: hwcontext_vdpau.c:40
vdpau_frames_get_constraints
static int vdpau_frames_get_constraints(AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints)
Definition: hwcontext_vdpau.c:190
AV_PIX_FMT_YUYV422
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:67
vdpau_device_uninit
static void vdpau_device_uninit(AVHWDeviceContext *ctx)
Definition: hwcontext_vdpau.c:181
AV_PIX_FMT_NV16
@ AV_PIX_FMT_NV16
interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:191
AV_PIX_FMT_VDPAU
@ AV_PIX_FMT_VDPAU
HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface.
Definition: pixfmt.h:187
vdpau_transfer_data_to
static int vdpau_transfer_data_to(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
Definition: hwcontext_vdpau.c:387
AV_HWDEVICE_TYPE_VDPAU
@ AV_HWDEVICE_TYPE_VDPAU
Definition: hwcontext.h:29
vdpau_transfer_get_formats
static int vdpau_transfer_get_formats(AVHWFramesContext *ctx, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
Definition: hwcontext_vdpau.c:305
pix_fmts_444
static const VDPAUPixFmtMap pix_fmts_444[]
Definition: hwcontext_vdpau.c:58
AV_PIX_FMT_NV12
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
Definition: pixfmt.h:89
AV_PIX_FMT_UYVY422
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:81
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
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
vdpau_transfer_data_from
static int vdpau_transfer_data_from(AVHWFramesContext *ctx, AVFrame *dst, const AVFrame *src)
Definition: hwcontext_vdpau.c:329
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
vdpau_device_init
static int vdpau_device_init(AVHWDeviceContext *ctx)
Definition: hwcontext_vdpau.c:158
vdpau_get_buffer
static int vdpau_get_buffer(AVHWFramesContext *ctx, AVFrame *frame)
Definition: hwcontext_vdpau.c:291