Allow planar formats with supported GPUJPEG

This commit is contained in:
Martin Pulec
2021-01-22 15:14:59 +01:00
parent ffb709f366
commit db46daa0ff
2 changed files with 8 additions and 4 deletions

View File

@@ -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 {

View File

@@ -52,10 +52,6 @@
#include <stdlib.h>
#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;