aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_hwupload_cuda.c
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2019-10-23 18:11:37 -0700
committerLynne <dev@lynne.ee>2020-02-04 23:19:48 +0000
commit88d2ccbe9384a1cba44a2909ef896aac50636d11 (patch)
tree8f137a7dde99b0f88cc79333b261a41d48b2ceb3 /libavfilter/vf_hwupload_cuda.c
parenta88449ffb2f249e31ecf98f84e7f8c338308e7e4 (diff)
downloadffmpeg-88d2ccbe9384a1cba44a2909ef896aac50636d11.tar.gz
lavfi/vf_hwupload: Add support for HW -> HW transfers
As we find ourselves wanting a way to transfer frames between HW devices (or more realistically, between APIs on the same device), it's desirable to have a way to describe the relationship. While we could imagine introducing a `hwtransfer` filter, there is almost no difference from `hwupload`. The main new feature we need is a way to specify the target device. Having a single device for the filter chain is obviously insufficient if we're dealing with two devices. So let's add a way to specify the upload target device, and if none is specified, continue with the existing behaviour. We must also correctly preserve the sw_format on such a transfer.
Diffstat (limited to 'libavfilter/vf_hwupload_cuda.c')
-rw-r--r--libavfilter/vf_hwupload_cuda.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libavfilter/vf_hwupload_cuda.c b/libavfilter/vf_hwupload_cuda.c
index 4d83e6c8f2..8ee0825859 100644
--- a/libavfilter/vf_hwupload_cuda.c
+++ b/libavfilter/vf_hwupload_cuda.c
@@ -60,6 +60,9 @@ static int cudaupload_query_formats(AVFilterContext *ctx)
AV_PIX_FMT_NV12, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV444P,
AV_PIX_FMT_P010, AV_PIX_FMT_P016, AV_PIX_FMT_YUV444P16,
AV_PIX_FMT_0RGB32, AV_PIX_FMT_0BGR32,
+#if CONFIG_VULKAN
+ AV_PIX_FMT_VULKAN,
+#endif
AV_PIX_FMT_NONE,
};
static const enum AVPixelFormat output_pix_fmts[] = {
@@ -97,7 +100,12 @@ static int cudaupload_config_output(AVFilterLink *outlink)
hwframe_ctx = (AVHWFramesContext*)s->hwframe->data;
hwframe_ctx->format = AV_PIX_FMT_CUDA;
- hwframe_ctx->sw_format = inlink->format;
+ if (inlink->hw_frames_ctx) {
+ AVHWFramesContext *in_hwframe_ctx = (AVHWFramesContext*)inlink->hw_frames_ctx->data;
+ hwframe_ctx->sw_format = in_hwframe_ctx->sw_format;
+ } else {
+ hwframe_ctx->sw_format = inlink->format;
+ }
hwframe_ctx->width = inlink->w;
hwframe_ctx->height = inlink->h;