adding ff_scale_adjust_dimensions to scale_d3d11

This commit is contained in:
gnattu
2026-07-01 16:26:36 +08:00
parent bfc89c9e74
commit a5117dbcff
@@ -408,7 +408,18 @@ Index: FFmpeg/libavfilter/vf_scale_d3d11.c
///< Allocate output frame
out = av_frame_alloc();
if (!out) {
@@ -353,13 +710,6 @@ static int scale_d3d11_config_props(AVFi
@@ -344,6 +701,10 @@ static int scale_d3d11_config_props(AVFi
return ret;
}
+ ret = ff_scale_adjust_dimensions(inlink, &s->width, &s->height, 0, 1, 1.f);
+ if (ret < 0)
+ return ret;
+
outlink->w = s->width;
outlink->h = s->height;
@@ -353,13 +714,6 @@ static int scale_d3d11_config_props(AVFi
return AVERROR(EINVAL);
}
@@ -422,7 +433,7 @@ Index: FFmpeg/libavfilter/vf_scale_d3d11.c
///< Initialize filter's hardware device context
if (!s->hw_device_ctx) {
AVHWFramesContext *in_frames_ctx = (AVHWFramesContext *)inl->hw_frames_ctx->data;
@@ -382,6 +732,29 @@ static int scale_d3d11_config_props(AVFi
@@ -382,6 +736,29 @@ static int scale_d3d11_config_props(AVFi
return AVERROR(EINVAL);
}
@@ -452,7 +463,7 @@ Index: FFmpeg/libavfilter/vf_scale_d3d11.c
///< Create new hardware frames context for output
s->hw_frames_ctx_out = av_hwframe_ctx_alloc(s->hw_device_ctx);
if (!s->hw_frames_ctx_out)
@@ -399,16 +772,43 @@ static int scale_d3d11_config_props(AVFi
@@ -399,16 +776,43 @@ static int scale_d3d11_config_props(AVFi
AVD3D11VAFramesContext *frames_hwctx = frames_ctx->hwctx;
frames_hwctx->MiscFlags = 0;
@@ -499,7 +510,7 @@ Index: FFmpeg/libavfilter/vf_scale_d3d11.c
outl->hw_frames_ctx = av_buffer_ref(s->hw_frames_ctx_out);
if (!outl->hw_frames_ctx)
return AVERROR(ENOMEM);
@@ -424,6 +824,8 @@ static av_cold void scale_d3d11_uninit(A
@@ -424,6 +828,8 @@ static av_cold void scale_d3d11_uninit(A
///< Release D3D11 resources
release_d3d11_resources(s);
@@ -508,7 +519,7 @@ Index: FFmpeg/libavfilter/vf_scale_d3d11.c
///< Free the hardware device context reference
av_buffer_unref(&s->hw_frames_ctx_out);
av_buffer_unref(&s->hw_device_ctx);
@@ -453,9 +855,12 @@ static const AVFilterPad scale_d3d11_out
@@ -453,9 +859,12 @@ static const AVFilterPad scale_d3d11_out
#define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
static const AVOption scale_d3d11_options[] = {
@@ -521,7 +532,7 @@ Index: FFmpeg/libavfilter/vf_scale_d3d11.c
{ NULL }
};
@@ -463,7 +868,7 @@ AVFILTER_DEFINE_CLASS(scale_d3d11);
@@ -463,7 +872,7 @@ AVFILTER_DEFINE_CLASS(scale_d3d11);
const FFFilter ff_vf_scale_d3d11 = {
.p.name = "scale_d3d11",