From e73bee0910dd516d15fa074bcce5e6614d037b58 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Fri, 23 May 2025 15:06:55 +0200 Subject: [PATCH] vdec/cmpto_j2k: throw if no technology - when no technology at all - it would fail later, anyways - remove the informative message (just for CPU but not in the opposite case) - the used device type will then be printed out, anyways - also assume in _reconfigure that we have valid technology --- src/video_decompress/cmpto_j2k.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/video_decompress/cmpto_j2k.cpp b/src/video_decompress/cmpto_j2k.cpp index a4eb04ffb..dd834e266 100644 --- a/src/video_decompress/cmpto_j2k.cpp +++ b/src/video_decompress/cmpto_j2k.cpp @@ -3,7 +3,7 @@ * @author Martin Pulec */ /* - * Copyright (c) 2013-2024 CESNET + * Copyright (c) 2013-2025 CESNET * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -351,7 +351,7 @@ void state_decompress_j2k::parse_params() { platform = j2k_decompress_platform::CPU; } else { MSG(ERROR, "Unable to find supported CMPTO_TECHNOLOGY\n"); - platform = j2k_decompress_platform::NONE; // default to NONE + throw UnableToCreateJ2KDecoderCTX(); } // CUDA-specific commandline_params @@ -360,12 +360,6 @@ void state_decompress_j2k::parse_params() { platform = j2k_decompress_platform::CUDA; } else { MSG(ERROR, "j2k-dec-use-cuda argument provided. CUDA decompress not supported.\n"); - - // Check if CPU is default decompress - // If it is, create a log message to notify this will be used automatically - if (j2k_decompress_platform::CPU == platform) { - MSG(INFO, "Defaulting to CPU decompress\n"); - } } } @@ -588,6 +582,7 @@ static int j2k_decompress_reconfigure(void *state, struct video_desc desc, struct cmpto_j2k_dec_ctx_cfg *ctx_cfg = nullptr; CHECK_OK(cmpto_j2k_dec_ctx_cfg_create(&ctx_cfg), "Error creating dec cfg", return false); + if (j2k_decompress_platform::CUDA == s->platform) { for (unsigned int i = 0; i < cuda_devices_count; ++i) { CHECK_OK(cmpto_j2k_dec_ctx_cfg_add_cuda_device( @@ -595,9 +590,8 @@ static int j2k_decompress_reconfigure(void *state, struct video_desc desc, s->cuda_tile_limit), "Error setting CUDA device", return false); } - } - - if (j2k_decompress_platform::CPU == s->platform) { + } else { + assert(s->platform == j2k_decompress_platform::CPU); CHECK_OK(cmpto_j2k_dec_ctx_cfg_add_cpu( ctx_cfg, s->cpu_thread_count,