diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2019-01-28 22:21:51 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-01-28 22:21:51 +0000 |
commit | 938d58078455ad446fb1196cb9978429faff36cc (patch) | |
tree | 651b48226356b70dbd99d471abd462bad303aa02 /internal/dynamic_depth/point_cloud.cc | |
parent | 6b9f1f428665620ad0577a2b9bcf5c9834c711aa (diff) | |
parent | cf24597915ce4f06730cd9236f3bfdd07cb87311 (diff) | |
download | dynamic_depth-938d58078455ad446fb1196cb9978429faff36cc.tar.gz |
Merge changes from topic "dynamic_depth"
* changes:
Add Android dynamic depth buffer validation sequence
Sync libdynamic_depth to CL #228913159
Diffstat (limited to 'internal/dynamic_depth/point_cloud.cc')
-rw-r--r-- | internal/dynamic_depth/point_cloud.cc | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/internal/dynamic_depth/point_cloud.cc b/internal/dynamic_depth/point_cloud.cc index f35e9c1..a2aa442 100644 --- a/internal/dynamic_depth/point_cloud.cc +++ b/internal/dynamic_depth/point_cloud.cc @@ -6,10 +6,10 @@ #include "xmpmeta/base64.h" #include "xmpmeta/xml/utils.h" -using photos_editing_formats::xml::Deserializer; -using photos_editing_formats::xml::Serializer; +using ::dynamic_depth::xmpmeta::EncodeFloatArrayBase64; +using ::dynamic_depth::xmpmeta::xml::Deserializer; +using ::dynamic_depth::xmpmeta::xml::Serializer; -namespace photos_editing_formats { namespace dynamic_depth { namespace { @@ -43,9 +43,9 @@ std::unique_ptr<PointCloud> PointCloud::FromData( return nullptr; } - if (points.size() % 3 != 0) { - LOG(ERROR) << "Points must be (x, y, z) tuples, so the size must be " - << "divisible by 3, got " << points.size(); + if (points.size() % 4 != 0) { + LOG(ERROR) << "Points must be (x, y, z, c) tuples, so the size must be " + << "divisible by 4, got " << points.size(); return nullptr; } @@ -72,7 +72,7 @@ std::unique_ptr<PointCloud> PointCloud::FromDeserializer( } int PointCloud::GetPointCount() const { - return static_cast<int>(points_.size() / 3); + return static_cast<int>(points_.size() / 4); } const std::vector<float>& PointCloud::GetPoints() const { return points_; } @@ -89,7 +89,7 @@ bool PointCloud::Serialize(Serializer* serializer) const { return false; } - // No error checking (e.g. points_.size() % 3 == 0), because serialization + // No error checking (e.g. points_.size() % 4 == 0), because serialization // shouldn't be blocked by this. string base64_encoded_points; if (!EncodeFloatArrayBase64(points_, &base64_encoded_points)) { @@ -98,7 +98,7 @@ bool PointCloud::Serialize(Serializer* serializer) const { } // Write required fields. - int point_count = static_cast<int>(points_.size() / 3); + int point_count = static_cast<int>(points_.size() / 4); if (!serializer->WriteProperty( DynamicDepthConst::PointCloud(), kPointCount, ::dynamic_depth::strings::SimpleItoa(point_count))) { @@ -131,13 +131,13 @@ bool PointCloud::ParseFields(const Deserializer& deserializer) { return false; } - if (points.size() % 3 != 0) { + if (points.size() % 4 != 0) { LOG(ERROR) << "Parsed " << points.size() << " values but expected the size " - << "to be divisible by 3 for (x, y, z) tuple representation"; + << "to be divisible by 4 for (x, y, z, c) tuple representation"; return false; } - int parsed_points_count = static_cast<int>(points.size() / 3); + int parsed_points_count = static_cast<int>(points.size() / 4); if (parsed_points_count != point_count) { LOG(ERROR) << "Parsed PointCount = " << point_count << " but " << parsed_points_count << " points were found"; @@ -161,4 +161,3 @@ bool PointCloud::ParseFields(const Deserializer& deserializer) { } } // namespace dynamic_depth -} // namespace photos_editing_formats |