* [FFmpeg-devel] [PATCH] lavfi/vf_libplacebo: add RGB colorspace sanity
@ 2023-05-21 13:54 Niklas Haas
2023-05-22 8:35 ` Niklas Haas
0 siblings, 1 reply; 2+ messages in thread
From: Niklas Haas @ 2023-05-21 13:54 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
From: Niklas Haas <git@haasn.dev>
Explicitly forbid using a non-RGB colorspace with RGB pixel format or
vice versa. This mirrors identical logic from vf_scale.
---
libavfilter/vf_libplacebo.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index f26d0126beb..e5af2693293 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -695,6 +695,13 @@ static int output_frame_mix(AVFilterContext *ctx,
if (s->color_primaries >= 0)
out->color_primaries = s->color_primaries;
+ /* Sanity colorspace overrides */
+ if (outdesc->flags & AV_PIX_FMT_FLAG_RGB) {
+ out->colorspace = AVCOL_SPC_RGB;
+ } else if (out->colorspace == AVCOL_SPC_RGB) {
+ out->colorspace = AVCOL_SPC_UNSPECIFIED;
+ }
+
changed_csp = ref->colorspace != out->colorspace ||
ref->color_range != out->color_range ||
ref->color_trc != out->color_trc ||
--
2.40.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH] lavfi/vf_libplacebo: add RGB colorspace sanity
2023-05-21 13:54 [FFmpeg-devel] [PATCH] lavfi/vf_libplacebo: add RGB colorspace sanity Niklas Haas
@ 2023-05-22 8:35 ` Niklas Haas
0 siblings, 0 replies; 2+ messages in thread
From: Niklas Haas @ 2023-05-22 8:35 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Niklas Haas
On Sun, 21 May 2023 15:54:20 +0200 Niklas Haas <ffmpeg@haasn.xyz> wrote:
> From: Niklas Haas <git@haasn.dev>
>
> Explicitly forbid using a non-RGB colorspace with RGB pixel format or
> vice versa. This mirrors identical logic from vf_scale.
> ---
> libavfilter/vf_libplacebo.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
> index f26d0126beb..e5af2693293 100644
> --- a/libavfilter/vf_libplacebo.c
> +++ b/libavfilter/vf_libplacebo.c
> @@ -695,6 +695,13 @@ static int output_frame_mix(AVFilterContext *ctx,
> if (s->color_primaries >= 0)
> out->color_primaries = s->color_primaries;
>
> + /* Sanity colorspace overrides */
> + if (outdesc->flags & AV_PIX_FMT_FLAG_RGB) {
> + out->colorspace = AVCOL_SPC_RGB;
> + } else if (out->colorspace == AVCOL_SPC_RGB) {
> + out->colorspace = AVCOL_SPC_UNSPECIFIED;
> + }
> +
> changed_csp = ref->colorspace != out->colorspace ||
> ref->color_range != out->color_range ||
> ref->color_trc != out->color_trc ||
> --
> 2.40.1
>
Merged as f66280182acb03604df2ef58c623b4fa39c56444
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-22 8:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-21 13:54 [FFmpeg-devel] [PATCH] lavfi/vf_libplacebo: add RGB colorspace sanity Niklas Haas
2023-05-22 8:35 ` Niklas Haas
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git