diff --git a/src/video_compress/gpujpeg.cpp b/src/video_compress/gpujpeg.cpp index 7d6d64fd2..a0862202f 100644 --- a/src/video_compress/gpujpeg.cpp +++ b/src/video_compress/gpujpeg.cpp @@ -3,7 +3,7 @@ * @author Martin Pulec */ /* - * Copyright (c) 2011-2023 CESNET, z. s. p. o. + * Copyright (c) 2011-2024 CESNET * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -62,6 +62,9 @@ #ifndef GPUJPEG_VERSION_INT #error "Old GPUJPEG API detected!" #endif +#if GPUJPEG_VERSION_INT >= GPUJPEG_MK_VERSION_INT(0, 25, 0) +#define NEW_PARAM_IMG_NO_COMP_COUNT +#endif #define MOD_NAME "[GPUJPEG enc.] " @@ -276,10 +279,18 @@ bool encoder_state::configure_with(struct video_desc desc) m_param_image.width = desc.width; m_param_image.height = desc.height; + +#if !defined NEW_PARAM_IMG_NO_COMP_COUNT m_param_image.comp_count = 3; +#endif if (m_parent_state->m_compress_alpha) { if (desc.color_spec == RGBA) { +#ifdef NEW_PARAM_IMG_NO_COMP_COUNT + gpujpeg_parameters_chroma_subsampling( + &m_encoder_param, GPUJPEG_SUBSAMPLING_4444); +#else m_param_image.comp_count = 4; +#endif } else { LOG(LOG_LEVEL_WARNING) << MOD_NAME "Requested alpha encode but input codec is unsupported pixel format: " << get_codec_name(desc.color_spec) << "\n"; @@ -290,7 +301,11 @@ bool encoder_state::configure_with(struct video_desc desc) switch (m_enc_input_codec) { case I420: m_param_image.pixel_format = GPUJPEG_420_U8_P0P1P2; break; case RGB: m_param_image.pixel_format = GPUJPEG_444_U8_P012; break; +#ifdef NEW_PARAM_IMG_NO_COMP_COUNT + case RGBA: m_param_image.pixel_format = GPUJPEG_4444_U8_P0123; break; +#else case RGBA: m_param_image.pixel_format = GPUJPEG_444_U8_P012Z; break; +#endif case UYVY: m_param_image.pixel_format = GPUJPEG_422_U8_P1020; break; default: log_msg(LOG_LEVEL_FATAL, MOD_NAME "Unexpected codec: %s\n", diff --git a/src/video_decompress/gpujpeg.c b/src/video_decompress/gpujpeg.c index c30d32cbc..b6f356c88 100644 --- a/src/video_decompress/gpujpeg.c +++ b/src/video_decompress/gpujpeg.c @@ -3,7 +3,7 @@ * @author Martin Pulec */ /* - * Copyright (c) 2011-2023 CESNET, z. s. p. o. + * Copyright (c) 2011-2024 CESNET * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -56,6 +56,10 @@ #define MOD_NAME "[GPUJPEG dec.] " +#if GPUJPEG_VERSION_INT >= GPUJPEG_MK_VERSION_INT(0, 25, 0) +#define NEW_PARAM_IMG_NO_COMP_COUNT +#endif + struct state_decompress_gpujpeg { struct gpujpeg_decoder *decoder; @@ -100,7 +104,11 @@ static int configure_with(struct state_decompress_gpujpeg *s, struct video_desc case RGBA: gpujpeg_decoder_set_output_format(s->decoder, GPUJPEG_RGB, s->out_codec == RGBA && s->rshift == 0 && s->gshift == 8 && s->bshift == 16 && vc_get_linesize(desc.width, RGBA) == s->pitch ? +#ifdef NEW_PARAM_IMG_NO_COMP_COUNT + GPUJPEG_4444_U8_P0123 : GPUJPEG_444_U8_P012); +#else GPUJPEG_444_U8_P012A : GPUJPEG_444_U8_P012); +#endif break; case RGB: gpujpeg_decoder_set_output_format(s->decoder, GPUJPEG_RGB, @@ -216,10 +224,13 @@ static decompress_status gpujpeg_probe_internal_codec(unsigned char *buffer, siz break; case GPUJPEG_444_U8_P012: case GPUJPEG_444_U8_P0P1P2: - case GPUJPEG_444_U8_P012Z: internal_prop->subsampling = 4440; break; +#ifdef NEW_PARAM_IMG_NO_COMP_COUNT + case GPUJPEG_4444_U8_P0123: +#else case GPUJPEG_444_U8_P012A: +#endif internal_prop->subsampling = 4444; break;