diff mbox series

[FFmpeg-devel,7/8] avfilter/vf_scale: tag output color space

Message ID 20231027170446.63684-7-ffmpeg@haasn.xyz
State New
Headers show
Series [FFmpeg-devel,1/8] swscale: fix sws_setColorspaceDetails after sws_init_context | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Niklas Haas Oct. 27, 2023, 5:04 p.m. UTC
From: Niklas Haas <git@haasn.dev>

When using vf_scale to force a specific output color space, also tag
this on the AVFrame. (Mirroring existing logic for output range)
---
 libavfilter/vf_scale.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Vittorio Giovara Oct. 28, 2023, 2:04 a.m. UTC | #1
On Fri, Oct 27, 2023 at 10:06 AM Niklas Haas <ffmpeg@haasn.xyz> wrote:

> From: Niklas Haas <git@haasn.dev>
>
> When using vf_scale to force a specific output color space, also tag
> this on the AVFrame. (Mirroring existing logic for output range)
> ---
>  libavfilter/vf_scale.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> index 4a2f0bd1f1..d79d67c413 100644
> --- a/libavfilter/vf_scale.c
> +++ b/libavfilter/vf_scale.c
> @@ -821,6 +821,9 @@ scale:
>      out->width  = outlink->w;
>      out->height = outlink->h;
>      out->color_range = out_full ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
> +    if (scale->out_color_matrix >= 0 &&
> +        scale->out_color_matrix != AVCOL_SPC_UNSPECIFIED)
> +        out->colorspace = scale->out_color_matrix;
>

what about the other color properties?
diff mbox series

Patch

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 4a2f0bd1f1..d79d67c413 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -821,6 +821,9 @@  scale:
     out->width  = outlink->w;
     out->height = outlink->h;
     out->color_range = out_full ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
+    if (scale->out_color_matrix >= 0 &&
+        scale->out_color_matrix != AVCOL_SPC_UNSPECIFIED)
+        out->colorspace = scale->out_color_matrix;
 
     // Sanity checks:
     //   1. If the output is RGB, set the matrix coefficients to RGB.