VRS
A file format for sensor data.
Loading...
Searching...
No Matches
SharedDefinitions.h
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <vrs/DataLayout.h>
18#include <vrs/DataLayoutConventions.h>
19#include <vrs/DataPieces.h>
20
21namespace vrs_sample_apps {
22
23using namespace vrs; // we should not do this in a header, but for readability, we do in this sample
24
25// This file contains definitions shared between our reader & writer code
26
27constexpr const char* kSampleFileName = "sample_file.vrs";
28
29// DataLayout definitions: these are groups of data fields that will store in different records.
30
33 using ImageSpecType = datalayout_conventions::ImageSpecType;
34
35 // Spec of a raw image, stored in data records (controlled by most recent config record)
38 // Prefer to specify a storage type when storing an enum, to make the storage format explicit.
40
41 // Additional configuration information for the camera
42 DataPieceVector<float> cameraCalibration{"camera_calibration"};
43
44 AutoDataLayoutEnd endLayout;
45};
46
49 // Additional data provided with each frame
50 DataPieceValue<uint64_t> exposureTime{"exposure_time"};
51 DataPieceValue<float> exposure{"exposure"};
52 DataPieceValue<uint64_t> frameCounter{"frame_counter"};
53 DataPieceValue<float> cameraTemperature{"camera_temperature"};
54
55 AutoDataLayoutEnd endLayout;
56};
57
60 DataPieceValue<double> motionStreamParam{"some_motion_stream_param"};
61
62 AutoDataLayoutEnd endLayout;
63};
64
67 DataPieceVector<Matrix3Dd> motionData{"motion_data"};
68
69 AutoDataLayoutEnd endLayout;
70};
71
72// Some constants for our audio streams
73const uint8_t kNumChannels = 1;
74const uint32_t kSampleRate = 44100;
75const size_t kAudioBlockSize = 256;
76
77// Number of data records we will create in each of our test file streams
78const size_t kDataRecordCount = 100;
79
80// Definition of the Recordable Class flavors we will use for our sample streams
81constexpr const char* kCameraStreamFlavor = "sample/camera";
82constexpr const char* kAudioStreamFlavor = "sample/audio";
83constexpr const char* kMotionStreamFlavor = "sample/motion";
84
85// Some arbitrary definitions to play with
86#define CALIBRATION_VALUES \
87 { 23, 53, 343, 3, 12, 8 }
88constexpr double kMotionValue = 25;
89
90} // namespace vrs_sample_apps
For use within an AutoDataLayout class, to end the AutoDataLayout's construction.
Definition DataLayout.h:590
Specialized DataLayout class to declare a DataLayout in struct format.
Definition DataLayout.h:584
DataPieceValue specialization class to store enums more conveniently and safely.
Definition DataPieceValue.h:283
DataPiece for a single value of type T. The value is stored in DataLayout's fixed size buffer.
Definition DataPieceValue.h:37
Vector of type T and variable size.
Definition DataPieceVector.h:37
constexpr const char * kImageWidth
DataLayout convention name for the image width.
Definition DataLayoutConventions.h:30
uint32_t ImageSpecType
Data type to use for the kImageXXX fields above.
Definition DataLayoutConventions.h:48
constexpr const char * kImageHeight
DataLayout convention name for the image height.
Definition DataLayoutConventions.h:32
constexpr const char * kImagePixelFormat
DataLayout convention name for the pixel format specification (see vrs::ImageFormat).
Definition DataLayoutConventions.h:38
Definition Compressor.cpp:113
Sample metadata for configuration records of an image stream.
Definition SharedDefinitions.h:32
Sample metadata for data records of an image stream.
Definition SharedDefinitions.h:48
Sample metadata for configuration records of a metadata stream.
Definition SharedDefinitions.h:59
Sample metadata for data records of a metadata stream.
Definition SharedDefinitions.h:66