Allow switch vector to span
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
#include "Image/ExifBuilder.hpp"
|
#include "Image/ExifBuilder.hpp"
|
||||||
#include "Image/XmpBuilder.hpp"
|
#include "Image/XmpBuilder.hpp"
|
||||||
#include "Image/JpegWithTagsWriter.hpp"
|
#include "Image/JpegWithTagsWriter.hpp"
|
||||||
|
#include <array>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#if __has_include("turbojpeg.h")
|
#if __has_include("turbojpeg.h")
|
||||||
@@ -137,7 +138,7 @@ namespace OpenVulkano::AR
|
|||||||
colorWriter->AddFile(fileName.c_str(), outBuffer, size);
|
colorWriter->AddFile(fileName.c_str(), outBuffer, size);
|
||||||
if (jpgWriter) [[unlikely]]
|
if (jpgWriter) [[unlikely]]
|
||||||
{
|
{
|
||||||
jpgWriter->WriteImageData({ outBuffer, size }, false); // Keep open, livetime is managed outside
|
jpgWriter->WriteImageData({ outBuffer, size }, false); // Keep open, lifetime is managed outside
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tjFree(outBuffer);
|
tjFree(outBuffer);
|
||||||
@@ -150,7 +151,7 @@ namespace OpenVulkano::AR
|
|||||||
//BlockProfiler profile("Save AR Frame - Depth");
|
//BlockProfiler profile("Save AR Frame - Depth");
|
||||||
if (!depthWriter || !confWriter) return;
|
if (!depthWriter || !confWriter) return;
|
||||||
auto depthImg = arFrame->GetDepthImage();
|
auto depthImg = arFrame->GetDepthImage();
|
||||||
std::vector<std::pair<const void*, size_t>> buffers(2);
|
std::array<std::pair<const void*, size_t>, 2> buffers;
|
||||||
{ // TODO handle alternative depth formats!!!!
|
{ // TODO handle alternative depth formats!!!!
|
||||||
//BlockProfiler profile("Save AR Frame - Depth");
|
//BlockProfiler profile("Save AR Frame - Depth");
|
||||||
PfmHeader depthHeader(static_cast<uint32_t>(depthImg.depth.resolution.x), static_cast<uint32_t>(depthImg.depth.resolution.y), 5.0f, false);
|
PfmHeader depthHeader(static_cast<uint32_t>(depthImg.depth.resolution.x), static_cast<uint32_t>(depthImg.depth.resolution.y), 5.0f, false);
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ namespace OpenVulkano
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ArchiveWriter::AddFile(const FileDescription& description, const std::vector<std::pair<const void*, size_t>>& buffers)
|
bool ArchiveWriter::AddFile(const FileDescription& description, const std::span<std::pair<const void*, size_t>>& buffers)
|
||||||
{
|
{
|
||||||
WriteHeader(description);
|
WriteHeader(description);
|
||||||
for(const auto& buffer : buffers)
|
for(const auto& buffer : buffers)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace OpenVulkano
|
|||||||
[[nodiscard]] size_t GetTotalWrittenBytes() const { return m_bytesWritten; }
|
[[nodiscard]] size_t GetTotalWrittenBytes() const { return m_bytesWritten; }
|
||||||
|
|
||||||
bool AddFile(const FileDescription& description, const void* buffer) override;
|
bool AddFile(const FileDescription& description, const void* buffer) override;
|
||||||
bool AddFile(const FileDescription& description, const std::vector<std::pair<const void*, size_t>>& buffers) override;
|
bool AddFile(const FileDescription& description, const std::span<std::pair<const void*, size_t>>& buffers) override;
|
||||||
bool AddFile(const char* fileName, const char* inArchiveName) override;
|
bool AddFile(const char* fileName, const char* inArchiveName) override;
|
||||||
[[nodiscard]] ArchiveOStream AddFileStream(const FileDescription& description) override;
|
[[nodiscard]] ArchiveOStream AddFileStream(const FileDescription& description) override;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "ArchiveOStream.hpp"
|
#include "ArchiveOStream.hpp"
|
||||||
#include "IO/FileDescription.hpp"
|
#include "IO/FileDescription.hpp"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <vector>
|
#include <span>
|
||||||
|
|
||||||
namespace OpenVulkano
|
namespace OpenVulkano
|
||||||
{
|
{
|
||||||
@@ -24,7 +24,7 @@ namespace OpenVulkano
|
|||||||
virtual void SetShouldCompressFunction(const std::function<bool(const FileDescription&)>& shouldComp) = 0;
|
virtual void SetShouldCompressFunction(const std::function<bool(const FileDescription&)>& shouldComp) = 0;
|
||||||
|
|
||||||
virtual bool AddFile(const FileDescription& description, const void* buffer) = 0;
|
virtual bool AddFile(const FileDescription& description, const void* buffer) = 0;
|
||||||
virtual bool AddFile(const FileDescription& description, const std::vector<std::pair<const void*, size_t>>& buffers) = 0;
|
virtual bool AddFile(const FileDescription& description, const std::span<std::pair<const void*, size_t>>& buffers) = 0;
|
||||||
virtual bool AddFile(const char* fileName, const char* inArchiveName) = 0;
|
virtual bool AddFile(const char* fileName, const char* inArchiveName) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,7 +56,7 @@ namespace OpenVulkano
|
|||||||
return AddFile(description, buffer);
|
return AddFile(description, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AddFile(const char* fileName, const std::vector<std::pair<const void*, size_t>>& buffers)
|
bool AddFile(const char* fileName, const std::span<std::pair<const void*, size_t>>& buffers)
|
||||||
{
|
{
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
for(const auto& buffer : buffers)
|
for(const auto& buffer : buffers)
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace OpenVulkano
|
|||||||
return m_writer->AddFile(description, buffer);
|
return m_writer->AddFile(description, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MultiPartArchiveWriter::AddFile(const FileDescription& description, const std::vector<std::pair<const void*, size_t>>& buffers)
|
bool MultiPartArchiveWriter::AddFile(const FileDescription& description, const std::span<std::pair<const void*, size_t>>& buffers)
|
||||||
{
|
{
|
||||||
CheckSize(description.size);
|
CheckSize(description.size);
|
||||||
return m_writer->AddFile(description, buffers);
|
return m_writer->AddFile(description, buffers);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace OpenVulkano
|
|||||||
~MultiPartArchiveWriter() override;
|
~MultiPartArchiveWriter() override;
|
||||||
|
|
||||||
bool AddFile(const FileDescription& description, const void* buffer) override;
|
bool AddFile(const FileDescription& description, const void* buffer) override;
|
||||||
bool AddFile(const FileDescription& description, const std::vector<std::pair<const void*, size_t>>& buffers) override;
|
bool AddFile(const FileDescription& description, const std::span<std::pair<const void*, size_t>>& buffers) override;
|
||||||
[[deprecated]] bool AddFile(const char* fileName, const char* inArchiveName) override;
|
[[deprecated]] bool AddFile(const char* fileName, const char* inArchiveName) override;
|
||||||
using IArchiveWriter::AddFile;
|
using IArchiveWriter::AddFile;
|
||||||
[[nodiscard]] virtual ArchiveOStream AddFileStream(const FileDescription& description) override;
|
[[nodiscard]] virtual ArchiveOStream AddFileStream(const FileDescription& description) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user