> On Aug 16, 2024, at 10:06, gnattu via ffmpeg-devel <ffmpeg-devel@ffmpeg.org> 
> wrote:
> 
> 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.

LGTM, thanks.

> 
> Signed-off-by: Gnattu OC <gnatt...@me.com>
> ---
> 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 7481af17471..1155233555f 100644
> --- a/libavfilter/vf_scale_vt.c
> +++ b/libavfilter/vf_scale_vt.c
> @@ -209,6 +209,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 72bab3d53b3..385a188ff77 100644
> --- a/libavfilter/vf_transpose_vt.c
> +++ b/libavfilter/vf_transpose_vt.c
> @@ -124,6 +124,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 f77e7e86b5a..27fdadf1609 100644
> --- a/libavfilter/vf_yadif_videotoolbox.m
> +++ b/libavfilter/vf_yadif_videotoolbox.m
> @@ -25,6 +25,7 @@
> #include "yadif.h"
> #include "libavutil/avassert.h"
> #include "libavutil/hwcontext.h"
> +#include "libavutil/hwcontext_videotoolbox.h"
> #include "libavutil/objc.h"
> 
> #include <assert.h>
> @@ -324,7 +325,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;
> @@ -346,12 +348,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)
> -- 
> 2.39.3 (Apple Git-146)
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to