From cc6b820db2584c60f82618db78397db432964f29 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 3 Sep 2024 14:54:21 +0200 Subject: [PATCH] vcomp/cmpto_j2k, pool: alloc extra data padding for conversions --- src/utils/video_frame_pool.cpp | 5 +++-- src/video_compress/cmpto_j2k.cpp | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utils/video_frame_pool.cpp b/src/utils/video_frame_pool.cpp index 9f404d29b..9951bfd3d 100644 --- a/src/utils/video_frame_pool.cpp +++ b/src/utils/video_frame_pool.cpp @@ -174,8 +174,9 @@ std::shared_ptr video_frame_pool::impl::get_frame() { try { ret = vf_alloc_desc(m_desc); for (unsigned int i = 0; i < m_desc.tile_count; ++i) { - ret->tiles[i].data = (char *) - m_allocator->allocate(m_max_data_len); + ret->tiles[i].data = + (char *) m_allocator->allocate( + m_max_data_len + MAX_PADDING); if (ret->tiles[i].data == NULL) { throw std::runtime_error("Cannot allocate data"); } diff --git a/src/video_compress/cmpto_j2k.cpp b/src/video_compress/cmpto_j2k.cpp index 16f4a777e..aaacead14 100644 --- a/src/video_compress/cmpto_j2k.cpp +++ b/src/video_compress/cmpto_j2k.cpp @@ -208,7 +208,8 @@ static bool configure_with(struct state_video_compress_j2k *s, struct video_desc cuda_wrapper_free(s->cuda_conv_tmp_buf); cuda_wrapper_malloc( (void **) &s->cuda_conv_tmp_buf, - vc_get_datalen(desc.width, desc.height, desc.color_spec)); + vc_get_datalen(desc.width, desc.height, desc.color_spec) + + MAX_PADDING); } #endif