From db46daa0ffb6766234f8d03565b44446ea83a319 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Fri, 22 Jan 2021 15:14:59 +0100 Subject: [PATCH] Allow planar formats with supported GPUJPEG --- src/video_compress/gpujpeg.cpp | 2 ++ src/video_decompress/gpujpeg.c | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/video_compress/gpujpeg.cpp b/src/video_compress/gpujpeg.cpp index d733230c9..82b96d048 100644 --- a/src/video_compress/gpujpeg.cpp +++ b/src/video_compress/gpujpeg.cpp @@ -247,12 +247,14 @@ bool encoder_state::configure_with(struct video_desc desc) compressed_desc.color_spec = JPEG; if (desc.color_spec == I420) { +#if GPUJPEG_VERSION_INT < GPUJPEG_MK_VERSION_INT(0, 14, 0) if ((m_parent_state->m_use_internal_codec != GPUJPEG_NONE && m_parent_state->m_use_internal_codec != GPUJPEG_YCBCR_BT709) || (m_parent_state->m_subsampling != 0 && m_parent_state->m_subsampling != 420)) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "Converting from planar pixel formats is " "possible only without subsampling/color space change.\n"); return false; } +#endif m_decoder = nullptr; m_enc_input_codec = desc.color_spec; } else { diff --git a/src/video_decompress/gpujpeg.c b/src/video_decompress/gpujpeg.c index c346f9733..bd791b362 100644 --- a/src/video_decompress/gpujpeg.c +++ b/src/video_decompress/gpujpeg.c @@ -52,10 +52,6 @@ #include #include "lib_common.h" -#if LIBGPUJPEG_API_VERSION < 11 -#error "GPUJPEG API 11 or more requested!" -#endif - #define MOD_NAME "[GPUJPEG dec.] " struct state_decompress_gpujpeg { @@ -308,6 +304,9 @@ static const struct decode_from_to *gpujpeg_decompress_get_decoders() { { JPEG, VIDEO_CODEC_NONE, RGB, 900 }, { JPEG, VIDEO_CODEC_NONE, UYVY, 900 }, { JPEG, VIDEO_CODEC_NONE, RGBA, 900 }, +#if GPUJPEG_VERSION_INT >= GPUJPEG_MK_VERSION_INT(0, 13, 0) + { JPEG, VIDEO_CODEC_NONE, I420, 900 }, +#endif // decoding from FFmpeg MJPG has lower priority than libavcodec // decoder because those files doesn't has much independent // segments (1 per MCU row -> 68 for HD) -> lavd may be better @@ -323,6 +322,9 @@ static const struct decode_from_to *gpujpeg_decompress_get_decoders() { { MJPG, VIDEO_CODEC_NONE, RGB, 920 }, { MJPG, VIDEO_CODEC_NONE, UYVY, 920 }, { MJPG, VIDEO_CODEC_NONE, RGBA, 920 }, +#if GPUJPEG_VERSION_INT >= GPUJPEG_MK_VERSION_INT(0, 13, 0) + { MJPG, VIDEO_CODEC_NONE, I420, 920 }, +#endif { VIDEO_CODEC_NONE, VIDEO_CODEC_NONE, VIDEO_CODEC_NONE, 0 }, }; return ret;