Add handling for padded buffers

This commit is contained in:
Georg Hagen
2025-01-08 15:49:19 +01:00
parent 8d14c40826
commit 2a1157ef71
4 changed files with 39 additions and 15 deletions

View File

@@ -78,7 +78,7 @@ namespace OpenVulkano::AR
if (m_settings.downsampleColor && !highRes)
{
dataBuffer = YuvUtils::PlansFromNV12(static_cast<uint8_t*>(img.luminescenceOrColor.data), static_cast<uint8_t*>(img.uv.data),
resX, resY, img.uv.resolution.x, img.uv.resolution.y, 2, 2);
resX, resY, img.uv.resolution.x, img.uv.resolution.y, 2, 2, img.luminescenceOrColor.rowPadding, img.uv.rowPadding);
resX /= 2;
resY /= 2;
buffers[0] = dataBuffer.get();
@@ -88,7 +88,7 @@ namespace OpenVulkano::AR
else
{
dataBuffer = std::unique_ptr<uint8_t[]>(new uint8_t[sizeUV + sizeUV]);
YuvUtils::ChromaPlanesFromNV12((uint8_t*)img.uv.data, dataBuffer.get(), sizeUV);
YuvUtils::ChromaPlanesFromNV12((uint8_t*)img.uv.data, dataBuffer.get(), img.uv.resolution.x, img.uv.resolution.y, img.uv.rowPadding);
buffers[0] = static_cast<uint8_t*>(img.luminescenceOrColor.data);
buffers[1] = dataBuffer.get();
buffers[2] = buffers[1] + sizeUV;
@@ -284,7 +284,10 @@ namespace OpenVulkano::AR
{
requestExit = true;
newDataAvailable.notify_one();
if (processingThread.joinable()) processingThread.join();
if (std::this_thread::get_id() != processingThread.get_id())
{
if (processingThread.joinable()) processingThread.join();
} else processingThread.detach();
}
void ArRecorder::AsyncProcessor::Queue(const std::shared_ptr<ArFrame>& frame, bool highRes)