FFmpeg
Loading...
Searching...
No Matches
d3d12_vpp.h
Go to the documentation of this file.
1/*
2 * D3D12VA video processor helpers
3 *
4 * Copyright (c) 2026 Advanced Micro Devices, Inc.
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef AVFILTER_D3D12_VPP_H
24#define AVFILTER_D3D12_VPP_H
25
26#include "libavutil/frame.h"
28
29#include "avfilter.h"
30#include "d3d12_filter.h"
31
32/**
33 * Video processor state shared by the D3D12 filters. All work is submitted
34 * to the video process queue of cmd.
35 */
36typedef struct D3D12VPPContext {
38
39 ID3D12VideoDevice *video_device;
40 ID3D12VideoProcessor *video_processor;
41
44
45/**
46 * Create the video device and the video process command context on device,
47 * after releasing any previous configuration.
48 */
49int ff_d3d12_vpp_init(AVFilterContext *ctx, D3D12VPPContext *vpp, ID3D12Device *device);
50
51/**
52 * Log, at debug level, which output formats the video processor supports
53 * for the input described in support.
54 */
56 const D3D12_FEATURE_DATA_VIDEO_PROCESS_SUPPORT *support);
57
58/**
59 * Create the video processor and mark vpp as configured. Must be called
60 * after ff_d3d12_vpp_init(). Releases everything on failure.
61 */
63 const D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC *output_desc,
64 const D3D12_VIDEO_PROCESS_INPUT_STREAM_DESC *input_desc);
65
66/**
67 * Start recording into vpp->cmd.list.video_process, see ff_d3d12_cmd_begin().
68 * Clears vpp->configured if the command context was torn down.
69 */
71
72/**
73 * Execute the recorded commands, see ff_d3d12_cmd_submit(). Clears
74 * vpp->configured if the command context was torn down.
75 */
77 AVFrame *const *inputs, int nb_inputs, AVFrame *output,
78 int *frames_in_use);
79
80/**
81 * Wait for the GPU to finish all submitted work, then release all D3D12
82 * objects and clear vpp->configured.
83 *
84 * @return 0 on success, AVERROR_EXTERNAL if the GPU could not be confirmed
85 * idle, in which case nothing is released
86 */
88
89#endif /* AVFILTER_D3D12_VPP_H */
static const AVFilterPad inputs[]
Definition af_aap.c:299
static AVFormatContext * ctx
Main libavfilter public API header.
int ff_d3d12_vpp_init(AVFilterContext *ctx, D3D12VPPContext *vpp, ID3D12Device *device)
Create the video device and the video process command context on device, after releasing any previous...
Definition d3d12_vpp.c:70
int ff_d3d12_vpp_uninit(AVFilterContext *ctx, D3D12VPPContext *vpp)
Wait for the GPU to finish all submitted work, then release all D3D12 objects and clear vpp->configur...
Definition d3d12_vpp.c:55
int ff_d3d12_vpp_begin(AVFilterContext *ctx, D3D12VPPContext *vpp)
Start recording into vpp->cmd.list.video_process, see ff_d3d12_cmd_begin().
Definition d3d12_vpp.c:163
int ff_d3d12_vpp_submit(AVFilterContext *ctx, D3D12VPPContext *vpp, AVFrame *const *inputs, int nb_inputs, AVFrame *output, int *frames_in_use)
Execute the recorded commands, see ff_d3d12_cmd_submit().
Definition d3d12_vpp.c:172
int ff_d3d12_vpp_create_processor(AVFilterContext *ctx, D3D12VPPContext *vpp, const D3D12_VIDEO_PROCESS_OUTPUT_STREAM_DESC *output_desc, const D3D12_VIDEO_PROCESS_INPUT_STREAM_DESC *input_desc)
Create the video processor and mark vpp as configured.
Definition d3d12_vpp.c:136
void ff_d3d12_vpp_report_output_support(AVFilterContext *ctx, D3D12VPPContext *vpp, const D3D12_FEATURE_DATA_VIDEO_PROCESS_SUPPORT *support)
Log, at debug level, which output formats the video processor supports for the input described in sup...
Definition d3d12_vpp.c:97
reference-counted frame API
An API-specific header for AV_HWDEVICE_TYPE_D3D12VA.
An instance of a filter.
Definition avfilter.h:279
This structure describes decoded (raw) audio or video data.
Definition frame.h:479
One command queue with its command list, a pool of command allocators and a private fence.
Video processor state shared by the D3D12 filters.
Definition d3d12_vpp.h:36
D3D12CommandContext cmd
Definition d3d12_vpp.h:37
ID3D12VideoDevice * video_device
Definition d3d12_vpp.h:39
ID3D12VideoProcessor * video_processor
Definition d3d12_vpp.h:40