ffmpeg | branch: master | Gnattu OC <gnatt...@me.com> | Fri Aug 16 10:06:37 2024 +0800| [30f090b4f8f73a05917cec914d3f7340f749bf9e] | committer: Zhao Zhili
avfilter: inherit input color range for videotoolbox filters The color range should be set to match the input when creating the VideoToolbox context. Otherwise, the new context will default to limited range, creates inconsistencies with full range inputs. Signed-off-by: Gnattu OC <gnatt...@me.com> Signed-off-by: Zhao Zhili <zhiliz...@tencent.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=30f090b4f8f73a05917cec914d3f7340f749bf9e --- libavfilter/vf_scale_vt.c | 1 + libavfilter/vf_transpose_vt.c | 1 + libavfilter/vf_yadif_videotoolbox.m | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/libavfilter/vf_scale_vt.c b/libavfilter/vf_scale_vt.c index 527e3ca72a..05f4e7b797 100644 --- a/libavfilter/vf_scale_vt.c +++ b/libavfilter/vf_scale_vt.c @@ -208,6 +208,7 @@ static int scale_vt_config_output(AVFilterLink *outlink) hw_frame_ctx_out->sw_format = hw_frame_ctx_in->sw_format; hw_frame_ctx_out->width = outlink->w; hw_frame_ctx_out->height = outlink->h; + ((AVVTFramesContext *)hw_frame_ctx_out->hwctx)->color_range = ((AVVTFramesContext *)hw_frame_ctx_in->hwctx)->color_range; err = ff_filter_init_hw_frames(avctx, outlink, 1); if (err < 0) diff --git a/libavfilter/vf_transpose_vt.c b/libavfilter/vf_transpose_vt.c index 86024c4ad3..8193340865 100644 --- a/libavfilter/vf_transpose_vt.c +++ b/libavfilter/vf_transpose_vt.c @@ -123,6 +123,7 @@ static int transpose_vt_recreate_hw_ctx(AVFilterLink *outlink) hw_frame_ctx_out->sw_format = hw_frame_ctx_in->sw_format; hw_frame_ctx_out->width = outlink->w; hw_frame_ctx_out->height = outlink->h; + ((AVVTFramesContext *)hw_frame_ctx_out->hwctx)->color_range = ((AVVTFramesContext *)hw_frame_ctx_in->hwctx)->color_range; err = ff_filter_init_hw_frames(avctx, outlink, 1); if (err < 0) diff --git a/libavfilter/vf_yadif_videotoolbox.m b/libavfilter/vf_yadif_videotoolbox.m index 85942e8321..09520db35d 100644 --- a/libavfilter/vf_yadif_videotoolbox.m +++ b/libavfilter/vf_yadif_videotoolbox.m @@ -24,6 +24,7 @@ #include "yadif.h" #include "libavutil/avassert.h" #include "libavutil/hwcontext.h" +#include "libavutil/hwcontext_videotoolbox.h" #include "libavutil/objc.h" #include <assert.h> @@ -323,7 +324,8 @@ static int config_input(AVFilterLink *inlink) static int do_config_output(AVFilterLink *link) API_AVAILABLE(macos(10.11), ios(8.0)) { FilterLink *l = ff_filter_link(link); - AVHWFramesContext *output_frames; + FilterLink *il = ff_filter_link(link->src->inputs[0]); + AVHWFramesContext *output_frames, *input_frames; AVFilterContext *ctx = link->src; YADIFVTContext *s = ctx->priv; YADIFContext *y = &s->yadif; @@ -345,12 +347,14 @@ static int do_config_output(AVFilterLink *link) API_AVAILABLE(macos(10.11), ios( goto exit; } + input_frames = (AVHWFramesContext*)il->hw_frames_ctx->data; output_frames = (AVHWFramesContext*)l->hw_frames_ctx->data; output_frames->format = AV_PIX_FMT_VIDEOTOOLBOX; output_frames->sw_format = s->input_frames->sw_format; output_frames->width = ctx->inputs[0]->w; output_frames->height = ctx->inputs[0]->h; + ((AVVTFramesContext *)output_frames->hwctx)->color_range = ((AVVTFramesContext *)input_frames->hwctx)->color_range; ret = ff_filter_init_hw_frames(ctx, link, 10); if (ret < 0) _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".