From 5e9e9d9720acd513337fe582320b87bd3c3289cd Mon Sep 17 00:00:00 2001 From: Dirk Farin Date: Mon, 23 Sep 2024 16:47:50 +0200 Subject: [PATCH] unci: fix writing component interleaved tiles --- libheif/codecs/uncompressed_image.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libheif/codecs/uncompressed_image.cc b/libheif/codecs/uncompressed_image.cc index 097b35001d..854a9bdebf 100644 --- a/libheif/codecs/uncompressed_image.cc +++ b/libheif/codecs/uncompressed_image.cc @@ -1888,9 +1888,13 @@ Result> encode_image_tile(const std::shared_ptrget_plane(channel, &src_stride); - uint64_t out_size = src_image->get_height() * src_stride; + uint64_t out_size = src_image->get_height() * src_image->get_width(); + data.resize(data.size() + out_size); - memcpy(data.data() + offset, src_data, out_size); + for (uint32_t y = 0; y < src_image->get_height(); y++) { + memcpy(data.data() + offset + y * src_image->get_width(), src_data + y * src_stride, src_image->get_width()); + } + offset += out_size; } @@ -2059,8 +2063,6 @@ Result> ImageItem_uncompressed::add_unci uint64_t tile_size = headers.uncC->compute_tile_data_size_bytes(parameters->image_width / headers.uncC->get_number_of_tile_columns(), parameters->image_height / headers.uncC->get_number_of_tile_rows()); - std::cout << "tile size: " << tile_size << "\n"; - std::vector dummydata; dummydata.resize(tile_size);