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.
This commit is contained in:
Niklas Haas 2023-05-21 15:52:40 +02:00
parent c00fd02558
commit f66280182a
1 changed files with 7 additions and 0 deletions

View File

@ -697,6 +697,13 @@ static int output_frame_mix(AVFilterContext *ctx,
if (s->color_primaries >= 0) if (s->color_primaries >= 0)
out->color_primaries = s->color_primaries; 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 || changed_csp = ref->colorspace != out->colorspace ||
ref->color_range != out->color_range || ref->color_range != out->color_range ||
ref->color_trc != out->color_trc || ref->color_trc != out->color_trc ||