mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-04-07 18:05:51 +00:00
vcomp/cmpto_j2k: move pool setting to a sep func
The logic is a bit tricky so separate it to a separate func. just a refactor
This commit is contained in:
@@ -188,6 +188,30 @@ static struct {
|
|||||||
{R12L, CMPTO_444_U12_MSB16LE_P012, RG48, r12l_to_rg48_cuda},
|
{R12L, CMPTO_444_U12_MSB16LE_P012, RG48, r12l_to_rg48_cuda},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
set_pool(struct state_video_compress_j2k *s)
|
||||||
|
{
|
||||||
|
s->pool_in_device_memory = false;
|
||||||
|
#ifdef HAVE_CUDA
|
||||||
|
if (cuda_devices_count == 1) {
|
||||||
|
s->pool_in_device_memory = true;
|
||||||
|
s->pool = video_frame_pool(
|
||||||
|
s->max_in_frames,
|
||||||
|
cmpto_j2k_enc_cuda_buffer_data_allocator<
|
||||||
|
cuda_wrapper_malloc, cuda_wrapper_free>());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MSG(WARNING, "More than 1 CUDA device will use CPU buffers and "
|
||||||
|
"conversion...\n");
|
||||||
|
s->pool = video_frame_pool(
|
||||||
|
s->max_in_frames,
|
||||||
|
cmpto_j2k_enc_cuda_buffer_data_allocator<cuda_wrapper_malloc_host,
|
||||||
|
cuda_wrapper_free_host>());
|
||||||
|
#else
|
||||||
|
s->pool = video_frame_pool(s->max_in_frames, default_data_allocator());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static bool configure_with(struct state_video_compress_j2k *s, struct video_desc desc){
|
static bool configure_with(struct state_video_compress_j2k *s, struct video_desc desc){
|
||||||
enum cmpto_sample_format_type sample_format;
|
enum cmpto_sample_format_type sample_format;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
@@ -238,25 +262,7 @@ static bool configure_with(struct state_video_compress_j2k *s, struct video_desc
|
|||||||
"Setting MCT",
|
"Setting MCT",
|
||||||
NOOP);
|
NOOP);
|
||||||
|
|
||||||
s->pool_in_device_memory = false;
|
set_pool(s);
|
||||||
#ifdef HAVE_CUDA
|
|
||||||
if (cuda_devices_count == 1) {
|
|
||||||
s->pool_in_device_memory = true;
|
|
||||||
s->pool = video_frame_pool(
|
|
||||||
s->max_in_frames,
|
|
||||||
cmpto_j2k_enc_cuda_buffer_data_allocator<
|
|
||||||
cuda_wrapper_malloc, cuda_wrapper_free>());
|
|
||||||
} else {
|
|
||||||
MSG(WARNING, "More than 1 CUDA device will use CPU buffers and "
|
|
||||||
"conversion...\n");
|
|
||||||
s->pool = video_frame_pool(
|
|
||||||
s->max_in_frames,
|
|
||||||
cmpto_j2k_enc_cuda_buffer_data_allocator<
|
|
||||||
cuda_wrapper_malloc_host, cuda_wrapper_free_host>());
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
s->pool = video_frame_pool(s->max_in_frames, default_data_allocator());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
s->compressed_desc = desc;
|
s->compressed_desc = desc;
|
||||||
s->compressed_desc.color_spec = codec_is_a_rgb(desc.color_spec) ? J2KR : J2K;
|
s->compressed_desc.color_spec = codec_is_a_rgb(desc.color_spec) ? J2KR : J2K;
|
||||||
|
|||||||
Reference in New Issue
Block a user