[FFmpeg-devel] [PATCH 1/2] lavfi/vaapi: check avaliable before set color properties
Fei Wang
fei.w.wang at intel.com
Sun Apr 26 06:02:55 EEST 2020
If the color proerties is UNSPECIFIED(enum value is 2), do not pass
the invalid value to driver.
Signed-off-by: Fei Wang <fei.w.wang at intel.com>
---
libavfilter/vaapi_vpp.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c
index b5b245c..6ffc09d 100644
--- a/libavfilter/vaapi_vpp.c
+++ b/libavfilter/vaapi_vpp.c
@@ -493,18 +493,18 @@ static int vaapi_vpp_colour_properties(AVFilterContext *avctx,
.chroma_sample_location = input_props.va_chroma_sample_location,
.color_range = input_props.va_color_range,
#if VA_CHECK_VERSION(1, 3, 0)
- .colour_primaries = input_props.color_primaries,
- .transfer_characteristics = input_props.color_trc,
- .matrix_coefficients = input_props.colorspace,
+ .colour_primaries = (input_props.color_primaries == AVCOL_PRI_UNSPECIFIED ? 0 : input_props.color_primaries),
+ .transfer_characteristics = (input_props.color_trc == AVCOL_TRC_UNSPECIFIED ? 0 : input_props.color_trc),
+ .matrix_coefficients = (input_props.colorspace == AVCOL_SPC_UNSPECIFIED ? 0 : input_props.colorspace),
#endif
};
params->output_color_properties = (VAProcColorProperties) {
.chroma_sample_location = output_props.va_chroma_sample_location,
.color_range = output_props.va_color_range,
#if VA_CHECK_VERSION(1, 3, 0)
- .colour_primaries = output_props.color_primaries,
- .transfer_characteristics = output_props.color_trc,
- .matrix_coefficients = output_props.colorspace,
+ .colour_primaries = (input_props.color_primaries == AVCOL_PRI_UNSPECIFIED ? 0 : input_props.color_primaries),
+ .transfer_characteristics = (input_props.color_trc == AVCOL_TRC_UNSPECIFIED ? 0 : input_props.color_trc),
+ .matrix_coefficients = (input_props.colorspace == AVCOL_SPC_UNSPECIFIED ? 0 : input_props.colorspace),
#endif
};
#endif
--
2.7.4
More information about the ffmpeg-devel
mailing list