aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/utils.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2024-11-29 21:39:15 +0100
committerNiklas Haas <git@haasn.dev>2024-12-23 12:33:43 +0100
commitb9dfe8138eb2df49c85a085b73c20d652ecf579a (patch)
tree6e17707e28254ddb1135ee14a8553d2bb3a148c0 /libswscale/utils.c
parent6c9218d748e06da019b6d15c37e5849d8a69bb07 (diff)
downloadffmpeg-b9dfe8138eb2df49c85a085b73c20d652ecf579a.tar.gz
swscale/utils: check for supported color transfers
We will use the av_csp_itu_eotf() functions to decode these internally, so check this function to see if it succeeds.
Diffstat (limited to 'libswscale/utils.c')
-rw-r--r--libswscale/utils.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 4dedbfc394..dc0f30aa3a 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -41,6 +41,7 @@
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/cpu.h"
+#include "libavutil/csp.h"
#include "libavutil/emms.h"
#include "libavutil/imgutils.h"
#include "libavutil/intreadwrite.h"
@@ -2738,8 +2739,9 @@ int sws_test_primaries(enum AVColorPrimaries prim, int output)
int sws_test_transfer(enum AVColorTransferCharacteristic trc, int output)
{
- return trc > AVCOL_TRC_RESERVED0 && trc < AVCOL_TRC_NB &&
- trc != AVCOL_TRC_RESERVED;
+ av_csp_eotf_function eotf = output ? av_csp_itu_eotf_inv(trc)
+ : av_csp_itu_eotf(trc);
+ return trc == AVCOL_TRC_UNSPECIFIED || eotf != NULL;
}
static int test_range(enum AVColorRange range)