Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions core/calibration/DeviceVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ namespace {
// Helper function to convert a string to lowercase
std::string toLowerCase(const std::string& input) {
std::string result = input; // Create a copy of the input string
std::transform(result.begin(), result.end(), result.begin(), [](unsigned char c) {
return std::tolower(c);
});
std::ranges::transform(result, result.begin(), [](unsigned char c) { return std::tolower(c); });
return result;
}
} // namespace
Expand Down
10 changes: 4 additions & 6 deletions core/data_provider/TimeSyncMapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@ int64_t TimeSyncMapper::convertFromSyncTimeToDeviceTimeNs(

TimeSyncData query;
query.realTimestampNs = timecodeTimeNs;
auto timecodeIter = std::upper_bound( // finds first timestamp > query
timecodeData.begin(),
timecodeData.end(),
auto timecodeIter = std::ranges::upper_bound( // finds first timestamp > query
timecodeData,
query,
[&](const auto& lhs, const auto& rhs) { return lhs.realTimestampNs < rhs.realTimestampNs; });
auto lastTimeCodeIter = timecodeIter - 1;
Expand Down Expand Up @@ -132,9 +131,8 @@ int64_t TimeSyncMapper::convertFromDeviceTimeToSyncTimeNs(

TimeSyncData query;
query.monotonicTimestampNs = deviceTimeNs;
auto timecodeIter = std::upper_bound( // finds first timestamp > query
timecodeData.begin(),
timecodeData.end(),
auto timecodeIter = std::ranges::upper_bound( // finds first timestamp > query
timecodeData,
query,
[&](const auto& lhs, const auto& rhs) {
return lhs.monotonicTimestampNs < rhs.monotonicTimestampNs;
Expand Down
7 changes: 4 additions & 3 deletions core/data_provider/TimestampIndexMapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#define DEFAULT_LOG_CHANNEL "TimestampIndexMapper"
#include <logging/Log.h>

#include <algorithm>

namespace projectaria::tools::data_provider {
TimestampIndexMapper::TimestampIndexMapper(std::shared_ptr<RecordReaderInterface> interface)
: interface_(interface), streamIdToDataRecords_(interface_->getStreamIdToDataRecords()) {
Expand Down Expand Up @@ -132,9 +134,8 @@ int TimestampIndexMapper::getIndexBeforeTimeNsNonTimeCode(
estTimeSecInRecordTime, 0, vrs::StreamId(), vrs::Record::Type::UNDEFINED);
auto dataRecords = streamIdToDataRecords_.at(streamId);

auto recordIter = std::upper_bound( // searches for earliest timestamp > query
dataRecords.begin(),
dataRecords.end(),
auto recordIter = std::ranges::upper_bound( // searches for earliest timestamp > query
dataRecords,
&queryTime,
[&](const auto& query, const auto& dataRecord) {
// Convert both to nanoseconds in integer for comparison, to avoid precision issue when
Expand Down
3 changes: 2 additions & 1 deletion core/python/XprsPyBind.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <pybind11/stl.h>

#include <fmt/core.h>
#include <algorithm>
#include <sstream>
#include <type_traits>

Expand Down Expand Up @@ -69,7 +70,7 @@ inline bool xprsFrameToImageData(xprs::Frame& xprsFrame, ImageData& imageData) {
// Copy to pixel frame
auto outputPixelFrame =
std::make_shared<vrs::utils::PixelFrame>(vrs::PixelFormat::RGB8, width, height, width * 3);
std::copy(outDecodedFrame.begin(), outDecodedFrame.end(), outputPixelFrame->getBuffer().begin());
std::ranges::copy(outDecodedFrame, outputPixelFrame->getBuffer().begin());
imageData.pixelFrame = std::move(outputPixelFrame);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void AriaDigitalTwinDataPathsProvider::loadV1Metadata(const rapidjson::Document&
for (const auto& [deviceSerial, _] : serialToSubtourName_) {
deviceSerialNumbers_.push_back(deviceSerial);
}
std::sort(deviceSerialNumbers_.begin(), deviceSerialNumbers_.end());
std::ranges::sort(deviceSerialNumbers_);
}

std::optional<AriaDigitalTwinDataPaths> AriaDigitalTwinDataPathsProvider::getDataPaths(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <fmt/core.h>
#include <pangolin/gl/glpixformat.h>
#include <algorithm>
#include <filesystem>

#include <mps/EyeGazeReader.h>
Expand Down Expand Up @@ -49,8 +50,7 @@ void AriaDigitalTwinViewer::loadData(const AriaDigitalTwinDataPaths& dataPaths)
tsNsRgb_ = adtDataProvider_->getAriaDeviceCaptureTimestampsNs(rgbStreamId_);

// get start time:
tsNsOverlapStartIter_ =
std::lower_bound(tsNsRgb_.begin(), tsNsRgb_.end(), adtDataProvider_->getStartTimeNs());
tsNsOverlapStartIter_ = std::ranges::lower_bound(tsNsRgb_, adtDataProvider_->getStartTimeNs());

// get end time and count
numberOfFrames_ = 0;
Expand Down
9 changes: 4 additions & 5 deletions tools/visualization/PlottingHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

#include <pangolin/gl/gldraw.h>

#include <algorithm>

#include "PangolinColor.h"

using namespace projectaria::tools::mps;
Expand Down Expand Up @@ -118,11 +120,8 @@ std::vector<std::vector<Eigen::Vector3d>> createHandSkeleton3d(
// Loop over all skeleton segments. In 3D no need to check for std::nullopt
for (const auto& landmarkNameVec : kHandSkeletonOrders) {
std::vector<Eigen::Vector3d> segments;
std::transform(
landmarkNameVec.begin(),
landmarkNameVec.end(),
std::back_inserter(segments),
[&](const auto& landmarkName) {
std::ranges::transform(
landmarkNameVec, std::back_inserter(segments), [&](const auto& landmarkName) {
return handMarkers3d.at(static_cast<uint8_t>(landmarkName));
});
handSkeleton.push_back(std::move(segments));
Expand Down
Loading