This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch master
in repository ffmpeg.
The following commit(s) were added to refs/heads/master by this push:
new cb2370e546 avfilter/vf_{vpp,sr,vqe}_amf: Enforce memory type
cb2370e546 is described below
commit cb2370e546bb4c51b2a0f914f06d4698ae3ab1aa
Author: Dmitrii Gershenkop <[email protected]>
AuthorDate: Wed Aug 12 16:49:40 2026 +0200
Commit: ArazIusubov <[email protected]>
CommitDate: Wed Aug 19 08:52:44 2026 +0000
avfilter/vf_{vpp,sr,vqe}_amf: Enforce memory type
---
libavfilter/vf_sr_amf.c | 5 +++++
libavfilter/vf_vpp_amf.c | 7 ++++++-
libavfilter/vf_vqe_amf.c | 6 +++++-
libavutil/hwcontext_amf.c | 3 +++
4 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/libavfilter/vf_sr_amf.c b/libavfilter/vf_sr_amf.c
index 8f3ae7ed80..17bfdc2a03 100644
--- a/libavfilter/vf_sr_amf.c
+++ b/libavfilter/vf_sr_amf.c
@@ -89,6 +89,7 @@ static int amf_filter_config_output(AVFilterLink *outlink)
int err;
AMF_RESULT res;
enum AVPixelFormat in_format;
+ enum AMF_MEMORY_TYPE mem_type = AMF_MEMORY_UNKNOWN;
err = amf_init_filter_config(outlink, &in_format);
if (err < 0)
@@ -103,6 +104,10 @@ static int amf_filter_config_output(AVFilterLink *outlink)
res =
ctx->amf_device_ctx->factory->pVtbl->CreateComponent(ctx->amf_device_ctx->factory,
ctx->amf_device_ctx->context, AMFHQScaler, &ctx->component);
AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR_FILTER_NOT_FOUND,
"CreateComponent(%ls) failed with error %d\n", AMFHQScaler, res);
+ mem_type = av_amf_get_memory_type(ctx->amf_device_ctx);
+ if (mem_type != AMF_MEMORY_UNKNOWN)
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->component,
AMF_HQ_SCALER_ENGINE_TYPE, mem_type);
+
out_size.width = outlink->w;
out_size.height = outlink->h;
AMF_ASSIGN_PROPERTY_SIZE(res, ctx->component, AMF_HQ_SCALER_OUTPUT_SIZE,
out_size);
diff --git a/libavfilter/vf_vpp_amf.c b/libavfilter/vf_vpp_amf.c
index e836cec68a..839a075ea7 100644
--- a/libavfilter/vf_vpp_amf.c
+++ b/libavfilter/vf_vpp_amf.c
@@ -90,6 +90,7 @@ static int amf_filter_config_output(AVFilterLink *outlink)
const AVFrameSideData *sd;
enum AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM amf_color_profile;
enum AVPixelFormat in_format;
+ enum AMF_MEMORY_TYPE mem_type = AMF_MEMORY_UNKNOWN;
ret = amf_init_filter_config(outlink, &in_format);
if (ret < 0)
@@ -98,7 +99,11 @@ static int amf_filter_config_output(AVFilterLink *outlink)
hwframes_out = (AVHWFramesContext*)ctx->hwframes_out_ref->data;
res =
ctx->amf_device_ctx->factory->pVtbl->CreateComponent(ctx->amf_device_ctx->factory,
ctx->amf_device_ctx->context, AMFVideoConverter, &ctx->component);
AMF_RETURN_IF_FALSE(ctx, res == AMF_OK, AVERROR_FILTER_NOT_FOUND,
"CreateComponent(%ls) failed with error %d\n", AMFVideoConverter, res);
- // FIXME: add checks whether we have HW context
+
+ mem_type = av_amf_get_memory_type(ctx->amf_device_ctx);
+ if (mem_type != AMF_MEMORY_UNKNOWN)
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->component,
AMF_VIDEO_CONVERTER_MEMORY_TYPE, mem_type);
+
AMF_ASSIGN_PROPERTY_INT64(res, ctx->component,
AMF_VIDEO_CONVERTER_OUTPUT_FORMAT,
(amf_int32)av_av_to_amf_format(hwframes_out->sw_format));
AMF_RETURN_IF_FALSE(avctx, res == AMF_OK, AVERROR_UNKNOWN,
"AMFConverter-SetProperty() failed with error %d\n", res);
diff --git a/libavfilter/vf_vqe_amf.c b/libavfilter/vf_vqe_amf.c
index fdda675f09..70b533e475 100644
--- a/libavfilter/vf_vqe_amf.c
+++ b/libavfilter/vf_vqe_amf.c
@@ -94,6 +94,7 @@ static int amf_vqe_filter_config_output(AVFilterLink *outlink)
AMFVQEFilterContext *vqe_ctx = avctx->priv;
AMFFilterContext *amf_ctx = &vqe_ctx->common;
AVAMFDeviceContext *device_ctx = NULL;
+ enum AMF_MEMORY_TYPE mem_type = AMF_MEMORY_UNKNOWN;
int err;
AMF_RESULT res;
@@ -110,8 +111,11 @@ static int amf_vqe_filter_config_output(AVFilterLink
*outlink)
amf_filter = amf_ctx->component;
- if (vqe_ctx->engine_type != -1)
+ mem_type = av_amf_get_memory_type(device_ctx);
+ if (vqe_ctx->engine_type != -1) {
AMF_ASSIGN_PROPERTY_INT64(res, amf_filter,
AMF_VIDEO_ENHANCER_ENGINE_TYPE, vqe_ctx->engine_type);
+ } else if (mem_type != AMF_MEMORY_UNKNOWN)
+ AMF_ASSIGN_PROPERTY_INT64(res, amf_filter,
AMF_VIDEO_ENHANCER_ENGINE_TYPE, mem_type);
AMF_ASSIGN_PROPERTY_DOUBLE(res, amf_filter, AMF_VE_FCR_ATTENUATION,
vqe_ctx->attenuation);
AMF_RETURN_IF_FALSE(avctx, res == AMF_OK, AVERROR_UNKNOWN, "Failed to set
VQ enhancer attenuation: %d\n", res);
diff --git a/libavutil/hwcontext_amf.c b/libavutil/hwcontext_amf.c
index 5ab9678c3c..505424af74 100644
--- a/libavutil/hwcontext_amf.c
+++ b/libavutil/hwcontext_amf.c
@@ -564,6 +564,9 @@ enum AMF_MEMORY_TYPE
av_amf_get_memory_type(AVAMFDeviceContext *amf_ctx)
AMFContext1 *context1 = NULL;
AMFGuid guid1 = IID_AMFContext1();
+ if (!amf_ctx)
+ return AMF_MEMORY_UNKNOWN;
+
#ifdef _WIN32
if (AMF_IFACE_CALL(context, GetDX11Device, AMF_DX11_1))
return AMF_MEMORY_DX11;
--
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]