summaryrefslogtreecommitdiff
path: root/internal/dynamic_depth/const.cc
blob: 0a7396d83090e0d2d5cd340613144a9fba80f55d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include "dynamic_depth/const.h"

#include "android-base/logging.h"
#include "base/port.h"

namespace photos_editing_formats {
namespace dynamic_depth {
namespace {

// Element names.
constexpr char kAppInfo[] = "AppInfo";
constexpr char kCamera[] = "Camera";
constexpr char kDepthMap[] = "DepthMap";
constexpr char kDevice[] = "Device";
constexpr char kEarthPose[] = "EarthPose";
constexpr char kImagingModel[] = "ImagingModel";
constexpr char kImage[] = "Image";
constexpr char kItem[] = "Item";
constexpr char kLightEstimate[] = "LightEstimate";
constexpr char kPlane[] = "Plane";
constexpr char kPointCloud[] = "PointCloud";
constexpr char kPose[] = "Pose";
constexpr char kProfile[] = "Profile";
constexpr char kVendorInfo[] = "VendorInfo";

// Type names.
constexpr char kCameras[] = "Cameras";
constexpr char kContainer[] = "Container";
constexpr char kPlanes[] = "Planes";
constexpr char kProfiles[] = "Profiles";

}  // namespace

// Redeclare static constexpr variables.
// https://stackoverflow.com/questions/8016780/
//     undefined-reference-to-static-constexpr-char
constexpr std::array<const char*, DynamicDepthConst::kNumDistortionTypes>
    DynamicDepthConst::kDistortionTypeNames;

// Dynamic Depth element names.
const char* DynamicDepthConst::AppInfo() { return kAppInfo; }

const char* DynamicDepthConst::Camera() { return kCamera; }

const char* DynamicDepthConst::DepthMap() { return kDepthMap; }

const char* DynamicDepthConst::Device() { return kDevice; }

const char* DynamicDepthConst::EarthPose() { return kEarthPose; }

const char* DynamicDepthConst::ImagingModel() { return kImagingModel; }

const char* DynamicDepthConst::Image() { return kImage; }

const char* DynamicDepthConst::Item() { return kItem; }

const char* DynamicDepthConst::LightEstimate() { return kLightEstimate; }

const char* DynamicDepthConst::Plane() { return kPlane; }

const char* DynamicDepthConst::PointCloud() { return kPointCloud; }

const char* DynamicDepthConst::Pose() { return kPose; }

const char* DynamicDepthConst::Profile() { return kProfile; }

const char* DynamicDepthConst::VendorInfo() { return kVendorInfo; }

// Dynamic Depth type names.
const char* DynamicDepthConst::Cameras() { return kCameras; }

const char* DynamicDepthConst::Container() { return kContainer; }

const char* DynamicDepthConst::Planes() { return kPlanes; }

const char* DynamicDepthConst::Profiles() { return kProfiles; }

// Returns the namespace to which the given Dynamic Depth element or type
// belongs. AppInfo and VendorInfo are not included because they can belong to
// either the Device or Camera elements.
const std::string DynamicDepthConst::Namespace(const std::string& node_name) {
  if (node_name == kPose) {
    LOG(WARNING) << kPose << " maps to " << kDevice << ", " << kCamera
                 << ", and " << kPlane << "; should be manually chosen. "
                 << "Returning empty";
    return "";
  }

  // Elements.
  if (node_name == kImagingModel || node_name == kImage ||
      node_name == kDepthMap || node_name == kPointCloud ||
      node_name == kLightEstimate) {
    return kCamera;
  }

  if (node_name == kItem) {
    return kContainer;
  }

  if (node_name == kCamera || node_name == kEarthPose ||
      node_name == kProfile || node_name == kPlane) {
    return kDevice;
  }

  // Types.
  if (node_name == kCameras || node_name == kContainer ||
      node_name == kPlanes || node_name == kProfiles) {
    return kDevice;
  }

  return "";
}
}  // namespace dynamic_depth
}  // namespace photos_editing_formats