Skip to content

Commit

Permalink
grid: only use mutexes when parallel decoding is enabled, this is a s…
Browse files Browse the repository at this point in the history
…ubset of ENABLE_MULTITHREADING_SUPPORT (#1377)
  • Loading branch information
farindk committed Nov 9, 2024
1 parent 3ce6149 commit 08aba4a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libheif/image-items/grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ Error ImageItem_Grid::decode_and_paste_tile_image(heif_item_id tileID, uint32_t
// --- generate the image canvas for combining all the tiles

if (!inout_image) { // this avoids that we normally have to lock a mutex
#if ENABLE_MULTITHREADING_SUPPORT
#if ENABLE_PARALLEL_TILE_DECODING
static std::mutex createImageMutex;
std::lock_guard<std::mutex> lock(createImageMutex);
#endif
Expand Down Expand Up @@ -481,7 +481,7 @@ Error ImageItem_Grid::decode_and_paste_tile_image(heif_item_id tileID, uint32_t
inout_image->copy_image_to(tile_img, x0, y0);

if (options.on_progress) {
#if ENABLE_MULTITHREADING_SUPPORT
#if ENABLE_PARALLEL_TILE_DECODING
static std::mutex progressMutex;
std::lock_guard<std::mutex> lock(progressMutex);
#endif
Expand Down

0 comments on commit 08aba4a

Please sign in to comment.