[FFmpeg-cvslog] lavfi/vf_libplacebo: add RGB colorspace sanity
Niklas Haas
git at videolan.org
Mon May 22 11:34:53 EEST 2023
ffmpeg | branch: master | Niklas Haas <git at haasn.dev> | Sun May 21 15:52:40 2023 +0200| [f66280182acb03604df2ef58c623b4fa39c56444] | committer: Niklas Haas
lavfi/vf_libplacebo: add RGB colorspace sanity
Explicitly forbid using a non-RGB colorspace with RGB pixel format or
vice versa. This mirrors identical logic from vf_scale.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f66280182acb03604df2ef58c623b4fa39c56444
---
libavfilter/vf_libplacebo.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index a8904b0e6b..aafe69c4cb 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -697,6 +697,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 ||
More information about the ffmpeg-cvslog
mailing list