diff --git a/openVulkanoCpp/AR/Provider/Playback/ArPlaybackReader.cpp b/openVulkanoCpp/AR/Provider/Playback/ArPlaybackReader.cpp index 1ae47bd..c145359 100644 --- a/openVulkanoCpp/AR/Provider/Playback/ArPlaybackReader.cpp +++ b/openVulkanoCpp/AR/Provider/Playback/ArPlaybackReader.cpp @@ -35,6 +35,8 @@ namespace OpenVulkano::AR::Playback //YuvUtils::NV12FromChromaPlanes(buff, img.data + (img.cols * img.rows), img.cols * img.rows / 4); + m_imgReadSize += 1000 + file.value().first.size; + return img; } } @@ -53,6 +55,7 @@ namespace OpenVulkano::AR::Playback stbi_load_from_memory(reinterpret_cast(file->second.Data()), file->second.Size(), &img.cols, &img.rows, &img.channels, 3), &stbi_image_free); img.data = img.dataPtr.get(); + m_imgReadSize += 1000 + file.value().first.size; return img; } } diff --git a/openVulkanoCpp/AR/Provider/Playback/ArPlaybackReader.hpp b/openVulkanoCpp/AR/Provider/Playback/ArPlaybackReader.hpp index 495297e..6c3674b 100644 --- a/openVulkanoCpp/AR/Provider/Playback/ArPlaybackReader.hpp +++ b/openVulkanoCpp/AR/Provider/Playback/ArPlaybackReader.hpp @@ -32,15 +32,15 @@ namespace OpenVulkano::AR::Playback static constexpr std::string_view TAR_EXTENSIONS_REGEX = R"(\.(tar(\.gz|\.bz2)?|tgz|tbz|tb2|tbz2))"; ArchiveReader m_archiveMetadata, m_archiveColor, m_archiveDepth, m_archiveConfidence; - size_t m_depthTotalSize = 0, m_depthReadSize = 0; + size_t m_imgTotalSize = 0, m_imgReadSize = 0; public: ArPlaybackReader(const std::string& recDir) { std::string extensions = R"((_\d+|\.part\d+)?)" + std::string(TAR_EXTENSIONS_REGEX); m_archiveMetadata.Open(recDir, ".*meta(data)?" + extensions); - m_archiveColor.Open(recDir, ".*(color|image)" + extensions); - m_archiveDepth.Open(recDir, ".*depth" + extensions, &m_depthTotalSize); + m_archiveColor.Open(recDir, ".*(color|image)" + extensions, &m_imgTotalSize); + m_archiveDepth.Open(recDir, ".*depth" + extensions); m_archiveConfidence.Open(recDir, ".*conf(idence)?" + extensions); } @@ -60,8 +60,7 @@ namespace OpenVulkano::AR::Playback DepthImage ReadDepthImage() { DepthImage img; - size_t& depthRead = m_depthReadSize; - m_archiveDepth.GetNextFileAsStream([&img, &depthRead](const FileDescription& desc, std::istream& stream) { img.depth.Read(stream); depthRead += desc.size + 1000; }); + m_archiveDepth.GetNextFileAsStream([&img](const FileDescription& desc, std::istream& stream) { img.depth.Read(stream); }); m_archiveConfidence.GetNextFileAsStream([&img](const FileDescription&, std::istream& stream) { img.confidence.Read(stream); }); return img; @@ -69,7 +68,7 @@ namespace OpenVulkano::AR::Playback [[nodiscard]] double GetProgress() const { - return static_cast(m_depthReadSize) / static_cast(m_depthTotalSize); + return static_cast(m_imgReadSize) / static_cast(m_imgTotalSize); } [[nodiscard]] bool HasNext() const