VRS
A file format for sensor data.
Loading...
Searching...
No Matches
RecordFormat.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#pragma once
18
19#include <map>
20#include <memory>
21#include <string>
22#include <vector>
23
24#include <vrs/Record.h>
25#include <vrs/VrsExport.h>
26
27namespace vrs {
28
29using std::map;
30using std::pair;
31using std::string;
32using std::unique_ptr;
33using std::vector;
34
36enum class ContentType : uint8_t {
37 CUSTOM = 0,
38 EMPTY,
40 IMAGE,
41 AUDIO,
42 COUNT
43};
44
45VRS_API string toString(ContentType contentType);
46template <>
47VRS_API ContentType toEnum<ContentType>(const string& name);
48
52enum class ImageFormat : uint8_t {
53 UNDEFINED = 0,
54 RAW,
55 JPG,
56 PNG,
57 VIDEO,
58 JXL,
60 COUNT
61};
62
63VRS_API string toString(ImageFormat imageFormat);
64template <>
65VRS_API ImageFormat toEnum<ImageFormat>(const string& name);
66
68enum class PixelFormat : uint8_t {
69 UNDEFINED = 0,
70
71 GREY8 = 1,
72 BGR8,
73 DEPTH32F,
74 RGB8,
77 RGBA8,
78 RGB10,
79 RGB12,
80 GREY10,
81 GREY12,
82 GREY16,
83 RGB32F,
84 SCALAR64F,
85 YUY2,
88 RGBA32F,
90 RAW10,
99
100 COUNT,
101};
102
103VRS_API string toString(PixelFormat pixelFormat);
104template <>
105VRS_API PixelFormat toEnum<PixelFormat>(const string& name);
106
108enum class AudioFormat : uint8_t {
109 UNDEFINED = 0,
110 PCM = 1,
111 OPUS = 2,
112 COUNT
113};
114
116VRS_API string toString(AudioFormat audioFormat);
117template <>
118VRS_API AudioFormat toEnum<AudioFormat>(const string& name);
119
121enum class AudioSampleFormat : uint8_t {
122 UNDEFINED = 0,
123 S8,
124 U8,
125 A_LAW,
126 MU_LAW,
127 S16_LE,
128 U16_LE,
129 S16_BE,
130 U16_BE,
131 S24_LE,
132 U24_LE,
133 S24_BE,
134 U24_BE,
135 S32_LE,
136 U32_LE,
137 S32_BE,
138 U32_BE,
139 F32_LE,
140 F32_BE,
141 F64_LE,
142 F64_BE,
143 COUNT
144};
145
147VRS_API string toString(AudioSampleFormat audioSampleFormat);
148template <>
149VRS_API AudioSampleFormat toEnum<AudioSampleFormat>(const string& name);
150
151class ContentParser; // to workaround not being able to forward declare istringstream.
152class RecordFormat;
153
156 public:
157 static constexpr uint8_t kQualityUndefined = 255;
158 static constexpr double kInvalidTimestamp = -1E-308; // arbitrary unrealistic value
159
160 ImageContentBlockSpec() = default;
161
163 ImageContentBlockSpec(ImageContentBlockSpec&&) noexcept = default;
165 ImageContentBlockSpec imageSpec,
166 double keyFrameTimestamp,
167 uint32_t keyFrameIndex);
168
171 ImageFormat imageFormat,
172 PixelFormat pixelFormat,
173 uint32_t width = 0,
174 uint32_t height = 0,
175 uint32_t stride = 0,
176 uint32_t stride2 = 0,
177 string codecName = {},
178 uint8_t codecQuality = kQualityUndefined,
179 double keyFrameTimestamp = kInvalidTimestamp,
180 uint32_t keyFrameIndex = 0);
181
183 /* implicit */ ImageContentBlockSpec(
184 ImageFormat imageFormat,
185 uint32_t width = 0,
186 uint32_t height = 0);
187
190 PixelFormat pixelFormat,
191 uint32_t width,
192 uint32_t height,
193 uint32_t stride = 0,
194 uint32_t stride2 = 0
195 );
196
199 ImageFormat imageFormat,
200 string codecName,
201 uint8_t codecQuality = kQualityUndefined,
202 PixelFormat pixelFormat = PixelFormat::UNDEFINED,
203 uint32_t width = 0,
204 uint32_t height = 0,
205 uint32_t stride = 0,
206 uint32_t stride2 = 0);
207
210 string codecName,
211 uint8_t codecQuality,
212 PixelFormat pixelFormat,
213 uint32_t width,
214 uint32_t height,
215 uint32_t stride = 0,
216 uint32_t stride2 = 0);
217
219 explicit ImageContentBlockSpec(const string& formatStr);
220
221 ~ImageContentBlockSpec() = default;
222
223 void init(
224 PixelFormat pixelFormat,
225 uint32_t width = 0,
226 uint32_t height = 0,
227 uint32_t stride = 0,
228 uint32_t stride2 = 0,
229 string codecName = {},
230 uint8_t codecQuality = kQualityUndefined,
231 double keyFrameTimestamp = kInvalidTimestamp,
232 uint32_t keyFrameIndex = 0);
233
235 void set(ContentParser& parser);
237 void clear();
238
240 ImageContentBlockSpec core() const;
241
244 string asString() const;
245
248 size_t getBlockSize() const;
249
252 size_t getRawImageSize() const;
253
256 ImageContentBlockSpec& operator=(ImageContentBlockSpec&&) noexcept = default;
257
259 bool operator==(const ImageContentBlockSpec& rhs) const;
260 bool operator!=(const ImageContentBlockSpec& rhs) const;
261
263 ImageFormat getImageFormat() const {
264 return imageFormat_;
265 }
266
268 string getImageFormatAsString() const;
269
272 return pixelFormat_;
273 }
275 string getPixelFormatAsString() const;
277 uint32_t getWidth() const {
278 return width_;
279 }
281 uint32_t getHeight() const {
282 return height_;
283 }
285 uint32_t getStride() const;
288 uint32_t getRawStride() const {
289 return stride_;
290 }
291 uint32_t getRawStride2() const {
292 return stride2_;
293 }
295 uint32_t getDefaultStride() const;
297 uint32_t getDefaultStride2() const;
298
300 uint32_t getPlaneCount() const {
301 return getPlaneCount(pixelFormat_);
302 }
303
306 uint32_t getPlaneStride(uint32_t planeIndex) const;
307
310 uint32_t getPlaneHeight(uint32_t planeIndex) const;
311
316 uint8_t getChannelCountPerPixel() const {
317 return getChannelCountPerPixel(pixelFormat_);
318 }
323 size_t getBytesPerPixel() const {
324 return getBytesPerPixel(pixelFormat_);
325 }
326
329 const string& getCodecName() const {
330 return codecName_;
331 }
335 uint8_t getCodecQuality() const {
336 return isQualityValid(codecQuality_) ? codecQuality_ : kQualityUndefined;
337 }
338
340 inline static bool isQualityValid(uint8_t quality) {
341 return quality <= 100;
342 }
343
345 double getKeyFrameTimestamp() const {
346 return keyFrameTimestamp_;
347 }
351 uint32_t getKeyFrameIndex() const {
352 return keyFrameIndex_;
353 }
354
356 static uint8_t getChannelCountPerPixel(PixelFormat pixel);
358 static size_t getBytesPerPixel(PixelFormat pixel);
359
361 static string getPixelFormatAsString(PixelFormat pixelFormat) {
362 return toString(pixelFormat);
363 }
364
366 static uint32_t getPlaneCount(PixelFormat pixelFormat);
367
370 bool sanityCheckStrides() const;
371
372 private:
373 ImageFormat imageFormat_{ImageFormat::UNDEFINED};
374 PixelFormat pixelFormat_{PixelFormat::UNDEFINED};
375 uint32_t width_{0};
376 uint32_t height_{0};
377 uint32_t stride_{0}; // Stride (bytes between lines) for the first pixel plane
378 uint32_t stride2_{0}; // Stride for the other planes (same for all)
379 // for ImageFormat::VIDEO
380 string codecName_;
381 double keyFrameTimestamp_{kInvalidTimestamp};
382 uint32_t keyFrameIndex_{0};
383 uint8_t codecQuality_{kQualityUndefined};
384};
385
388 public:
389 AudioContentBlockSpec() = default;
392 AudioContentBlockSpec(AudioContentBlockSpec&&) noexcept = default;
394 explicit AudioContentBlockSpec(AudioFormat audioFormat, uint8_t channelCount = 0);
396 AudioFormat audioFormat,
397 AudioSampleFormat sampleFormat,
398 uint8_t channelCount = 0,
399 uint8_t sampleFrameStride = 0,
400 uint32_t sampleFrameRate = 0,
401 uint32_t sampleFrameCount = 0,
402 uint8_t stereoPairCount = 0);
403 ~AudioContentBlockSpec() = default;
404
407 explicit AudioContentBlockSpec(const string& formatStr);
408
411 void set(ContentParser& parser);
413 void clear();
414
415 AudioContentBlockSpec& operator=(const AudioContentBlockSpec&) = default;
416 AudioContentBlockSpec& operator=(AudioContentBlockSpec&&) noexcept = default;
417
418 bool operator==(const AudioContentBlockSpec& rhs) const;
419 bool operator!=(const AudioContentBlockSpec& rhs) const {
420 return !operator==(rhs);
421 }
424 string asString() const;
425
427 size_t getBlockSize() const;
428
430 size_t getPcmBlockSize() const;
431
433 bool isCompatibleWith(const AudioContentBlockSpec& rhs) const;
436 return audioFormat_;
437 }
440 return sampleFormat_;
441 }
443 string getSampleFormatAsString() const;
445 bool isLittleEndian() const {
446 return isLittleEndian(sampleFormat_);
447 }
449 bool isIEEEFloat() const {
450 return isIEEEFloat(sampleFormat_);
451 }
453 uint8_t getBitsPerSample() const {
454 return getBitsPerSample(sampleFormat_);
455 }
457 uint8_t getBytesPerSample() const {
458 return (getBitsPerSample(sampleFormat_) + 7) / 8; // round up
459 }
461 uint8_t getSampleFrameStride() const;
463 uint8_t getChannelCount() const {
464 return channelCount_;
465 }
467 uint32_t getSampleRate() const {
468 return sampleFrameRate_;
469 }
471 uint32_t getSampleCount() const {
472 return sampleFrameCount_;
473 }
475 void setSampleCount(uint32_t sampleCount) {
476 sampleFrameCount_ = sampleCount;
477 }
478
479 uint8_t getStereoPairCount() const {
480 return stereoPairCount_;
481 }
482
485 bool isSampleBlockFormatDefined() const;
486
488 static bool isLittleEndian(AudioSampleFormat sampleFormat);
490 static bool isIEEEFloat(AudioSampleFormat sampleFormat);
492 static uint8_t getBitsPerSample(AudioSampleFormat sampleFormat);
494 static uint8_t getBytesPerSample(AudioSampleFormat sampleFormat);
496 static string getSampleFormatAsString(AudioSampleFormat sampleFormat) {
497 return toString(sampleFormat);
498 }
499
500 private:
501 AudioFormat audioFormat_{};
502 AudioSampleFormat sampleFormat_{};
503 uint8_t sampleFrameStride_{};
504 uint8_t channelCount_{};
505 uint32_t sampleFrameRate_{};
506 uint32_t sampleFrameCount_{};
507 uint8_t stereoPairCount_{};
508};
509
522class VRS_API ContentBlock {
523 public:
525 static const size_t kSizeUnknown;
526
528 /* implicit */ ContentBlock(ContentType type = ContentType::EMPTY, size_t size = kSizeUnknown);
529
531 explicit ContentBlock(const string& formatStr);
532
534 /* implicit */ ContentBlock(ImageFormat imageFormat, uint32_t width = 0, uint32_t height = 0);
535
538 std::string codecName,
539 uint8_t codecQuality,
540 PixelFormat pixelFormat = PixelFormat::UNDEFINED,
541 uint32_t width = 0,
542 uint32_t height = 0,
543 uint32_t stride = 0,
544 uint32_t stride2 = 0);
545
548 PixelFormat pixelFormat,
549 uint32_t width,
550 uint32_t height,
551 uint32_t stride = 0,
552 uint32_t stride2 = 0);
553
554 /* implicit */ ContentBlock(const ImageContentBlockSpec& imageSpec, size_t size = kSizeUnknown);
555 /* implicit */ ContentBlock(
556 ImageContentBlockSpec&& imageSpec,
557 size_t size = kSizeUnknown) noexcept;
559 const ContentBlock& imageContentBlock,
560 double keyFrameTimestamp,
561 uint32_t keyFrameIndex);
562
564 /* implicit */ ContentBlock(AudioFormat audioFormat, uint8_t channelCount = 0);
565 /* implicit */ ContentBlock(const AudioContentBlockSpec& audioSpec, size_t size);
566
569 AudioFormat audioFormat,
570 AudioSampleFormat sampleFormat,
571 uint8_t numChannels = 0,
572 uint8_t sampleFrameStride = 0,
573 uint32_t sampleRate = 0,
574 uint32_t sampleCount = 0,
575 uint8_t stereoPairCount = 0);
576
578 ContentBlock(const ContentBlock&) = default;
579 ContentBlock(ContentBlock&&) noexcept = default;
580
582 ContentBlock(const ContentBlock& other, size_t size)
583 : contentType_{other.contentType_}, size_{size} {
584 if (contentType_ == ContentType::IMAGE) {
585 imageSpec_ = other.imageSpec_;
586 } else if (contentType_ == ContentType::AUDIO) {
587 audioSpec_ = other.audioSpec_;
588 } else if (contentType_ == ContentType::CUSTOM) {
589 customContentBlockFormat_ = other.customContentBlockFormat_;
590 }
591 }
592
593 ~ContentBlock() = default;
594
595 ContentBlock& operator=(const ContentBlock& rhs) = default;
596 ContentBlock& operator=(ContentBlock&& rhs) noexcept = default;
597
599 string asString() const;
600
602 size_t getBlockSize() const;
603
606 return contentType_;
607 }
608
612 return customContentBlockFormat_;
613 }
614
615 bool operator==(const ContentBlock& rhs) const;
616
617 bool operator!=(const ContentBlock& rhs) const {
618 return !operator==(rhs);
619 }
620
622 RecordFormat operator+(const ContentBlock&) const;
623
625 const ImageContentBlockSpec& image() const;
627 const AudioContentBlockSpec& audio() const;
628
629 protected:
630 ContentType contentType_ = ContentType::EMPTY;
631 size_t size_ = kSizeUnknown;
632 ImageContentBlockSpec imageSpec_;
633 AudioContentBlockSpec audioSpec_;
634 string customContentBlockFormat_;
635};
636
637class VRS_API CustomContentBlock : public ContentBlock {
638 public:
639 explicit CustomContentBlock(const string& customContentBlockFormat, size_t size = kSizeUnknown);
640 explicit CustomContentBlock(size_t size = kSizeUnknown);
641};
642
644using RecordFormatMap = map<pair<Record::Type, uint32_t>, RecordFormat>;
645
654class VRS_API ContentBlockId {
655 public:
657 RecordableTypeId typeIdIn,
658 Record::Type recordTypeIn,
659 uint32_t formatVersionIn,
660 size_t blockIndexIn)
661 : typeId(typeIdIn),
662 recordType(recordTypeIn),
663 formatVersion(formatVersionIn),
664 blockIndex(blockIndexIn) {}
665
666 RecordableTypeId getRecordableTypeId() const {
667 return typeId;
668 }
669
670 Record::Type getRecordType() const {
671 return recordType;
672 }
673
674 uint32_t getFormatVersion() const {
675 return formatVersion;
676 }
677
678 size_t getBlockIndex() const {
679 return blockIndex;
680 }
681
682 private:
683 RecordableTypeId typeId;
684 Record::Type recordType;
685 uint32_t formatVersion;
686 size_t blockIndex;
687};
688
698class VRS_API RecordFormat {
699 public:
701 RecordFormat() = default;
703 RecordFormat(const RecordFormat&) = default;
704 /* implicit */ RecordFormat(RecordFormat&&) noexcept = default;
705 ~RecordFormat() = default;
706
707 RecordFormat& operator=(const RecordFormat&) = default;
708 RecordFormat& operator=(RecordFormat&&) noexcept = default;
709
713 explicit RecordFormat(const string& format) {
714 set(format);
715 }
719 explicit RecordFormat(const char* format) {
720 set(format);
721 }
723 /* implicit */ RecordFormat(const ContentBlock& block) {
724 blocks_.emplace_back(block);
725 }
727 /* implicit */ RecordFormat(ContentBlock&& block) noexcept {
728 blocks_.emplace_back(std::move(block));
729 }
731 RecordFormat(const ContentBlock& first, const ContentBlock& second) {
732 blocks_.emplace_back(first);
733 blocks_.emplace_back(second);
734 }
736 RecordFormat(ContentBlock&& first, ContentBlock&& second) noexcept {
737 blocks_.emplace_back(std::move(first));
738 blocks_.emplace_back(std::move(second));
739 }
744 /* implicit */ RecordFormat(ContentType type, size_t size = ContentBlock::kSizeUnknown) {
745 blocks_.emplace_back(type, size);
746 }
747
750 blocks_.emplace_back(block);
751 return *this;
752 }
755 blocks_.emplace_back(std::move(block));
756 return *this;
757 }
758
759 bool operator==(const RecordFormat& rhs) const;
760 bool operator!=(const RecordFormat& rhs) const {
761 return !operator==(rhs);
762 }
763
764 void clear() {
765 blocks_.clear();
766 }
767
770 void set(const string& format);
773 string asString() const;
774
777 size_t getRecordSize() const;
780 size_t getUsedBlocksCount() const;
784 size_t getBlocksOfTypeCount(ContentType type) const;
788 const ContentBlock& getContentBlock(size_t index) const;
792 return getContentBlock(0);
793 }
798 size_t getRemainingBlocksSize(size_t firstBlock) const;
805 size_t getBlockSize(size_t blockIndex, size_t remainingSize) const;
806
807 // Static VRS dedicated helper methods, for RecordFormat & DataLayout purposes.
808
810 static string getRecordFormatTagName(Record::Type recordType, uint32_t formatVersion);
811 static string getDataLayoutTagName(Record::Type type, uint32_t version, size_t blockIndex);
814 static bool parseRecordFormatTagName(
815 const string& tagName,
816 Record::Type& recordType,
817 uint32_t& formatVersion);
818
821 static bool addRecordFormat(
822 map<string, string>& inOutRecordFormatRegister,
823 Record::Type recordType,
824 uint32_t formatVersion,
825 const RecordFormat& format,
826 const vector<const DataLayout*>& layouts);
827
828 static void getRecordFormats(
829 const map<string, string>& recordFormatRegister,
830 RecordFormatMap& outFormats);
831
832 static unique_ptr<DataLayout> getDataLayout(
833 const map<string, string>& recordFormatRegister,
834 const ContentBlockId& blockId);
835
836 private:
837 vector<ContentBlock> blocks_;
838};
839
840} // namespace vrs
Specification of an audio content block.
Definition RecordFormat.h:387
uint8_t getChannelCount() const
Get the number of audio channels in each sample frame (not in the content block).
Definition RecordFormat.h:463
void setSampleCount(uint32_t sampleCount)
Set the number of audio sample frames in the content block.
Definition RecordFormat.h:475
uint8_t getBitsPerSample() const
Get the number of bits per audio sample.
Definition RecordFormat.h:453
AudioContentBlockSpec(const AudioContentBlockSpec &)=default
Default copy constructor.
bool isLittleEndian() const
Tell if the audio sample format is little endian.
Definition RecordFormat.h:445
uint32_t getSampleCount() const
Get the number of audio sample frames in the content block.
Definition RecordFormat.h:471
uint8_t getBytesPerSample() const
Get the number of bytes per audio sample.
Definition RecordFormat.h:457
uint32_t getSampleRate() const
Get the audio frame sample rate.
Definition RecordFormat.h:467
bool isIEEEFloat() const
Tell if the audio sample format is an IEEE float.
Definition RecordFormat.h:449
AudioFormat getAudioFormat() const
Get audio format.
Definition RecordFormat.h:435
AudioSampleFormat getSampleFormat() const
Get audio sample format.
Definition RecordFormat.h:439
static string getSampleFormatAsString(AudioSampleFormat sampleFormat)
Get an audio sample format as a string.
Definition RecordFormat.h:496
Specification of a VRS record content block.
Definition RecordFormat.h:522
ContentBlock(const ContentBlock &)=default
Default copy constructor.
ContentType getContentType() const
Get the ContentType of the block.
Definition RecordFormat.h:605
string getCustomContentBlockFormat() const
Definition RecordFormat.h:611
ContentBlock(std::string codecName, uint8_t codecQuality, PixelFormat pixelFormat=PixelFormat::UNDEFINED, uint32_t width=0, uint32_t height=0, uint32_t stride=0, uint32_t stride2=0)
Image formats with custom codec encoding.
static const size_t kSizeUnknown
Special value used to represent an unknown block size.
Definition RecordFormat.h:525
Helper to identify a particular content block within a file.
Definition RecordFormat.h:654
RecordFormat string parsing helper class.
Definition RecordFormat.cpp:37
Definition RecordFormat.h:637
Specification of an image content block.
Definition RecordFormat.h:155
ImageContentBlockSpec & operator=(const ImageContentBlockSpec &)=default
Default copy assignment.
uint8_t getCodecQuality() const
Definition RecordFormat.h:335
uint32_t getKeyFrameIndex() const
Definition RecordFormat.h:351
size_t getBytesPerPixel() const
Definition RecordFormat.h:323
uint32_t getHeight() const
Get image height, or 0 if unknown/unspecified.
Definition RecordFormat.h:281
PixelFormat getPixelFormat() const
Get Pixel format.
Definition RecordFormat.h:271
static string getPixelFormatAsString(PixelFormat pixelFormat)
Get pixel format presented as a readable string, from which it can be reconstructed.
Definition RecordFormat.h:361
const string & getCodecName() const
Definition RecordFormat.h:329
uint32_t getRawStride() const
Definition RecordFormat.h:288
double getKeyFrameTimestamp() const
Get timestamp of the key frame of the group of frames this video frame belongs to.
Definition RecordFormat.h:345
static bool isQualityValid(uint8_t quality)
Validate that a quality value is valid.
Definition RecordFormat.h:340
uint8_t getChannelCountPerPixel() const
Definition RecordFormat.h:316
uint32_t getPlaneCount() const
Get the number of planes for this pixel format.
Definition RecordFormat.h:300
uint32_t getWidth() const
Get image width, or 0 if unknown/unspecified.
Definition RecordFormat.h:277
Description of the format of a VRS record as a succession of typed blocks of content.
Definition RecordFormat.h:698
RecordFormat(const RecordFormat &)=default
Default copy constructor.
RecordFormat(ContentBlock &&first, ContentBlock &&second) noexcept
Build a RecordFormat from two ContentBlock definitions.
Definition RecordFormat.h:736
RecordFormat & operator+(ContentBlock &&block)
Append a ContentBlock to this RecordFormat.
Definition RecordFormat.h:754
RecordFormat(const char *format)
Definition RecordFormat.h:719
RecordFormat(const ContentBlock &block)
Build a RecordFormat from a single ContentBlock.
Definition RecordFormat.h:723
RecordFormat(ContentType type, size_t size=ContentBlock::kSizeUnknown)
Definition RecordFormat.h:744
RecordFormat()=default
Empty record format definition.
RecordFormat(ContentBlock &&block) noexcept
Build a RecordFormat from a single ContentBlock.
Definition RecordFormat.h:727
const ContentBlock & getFirstContentBlock() const
Definition RecordFormat.h:791
RecordFormat(const ContentBlock &first, const ContentBlock &second)
Build a RecordFormat from two ContentBlock definitions.
Definition RecordFormat.h:731
RecordFormat & operator+(const ContentBlock &block)
Append a ContentBlock to this RecordFormat.
Definition RecordFormat.h:749
Type
Definition Record.h:91
Definition Compressor.cpp:113
map< pair< Record::Type, uint32_t >, RecordFormat > RecordFormatMap
Map a pair of record type/format version to a record format, for a particular stream.
Definition RecordFormat.h:644
PixelFormat
Pixel format type, then the image format is ImageFormat::RAW.
Definition RecordFormat.h:68
@ GREY12
uses 16 bit little-endian values. 4 most significant bits are unused and set to 0.
@ GREY10
uses 16 bit little-endian values. 6 most significant bits are unused and set to 0.
@ RGB8
3 uint8_t values, red + green + blue.
@ DEPTH32F
1 32 bit float value, representing a depth.
@ YUV_420_NV21
Y plane + half width/half height chroma plane with weaved V and U values.
@ RAW10
https://developer.android.com/reference/android/graphics/ImageFormat#RAW10
@ RAW10_BAYER_RGGB
10 bit per pixel, RGGB bayer pattern.
@ YUV_I420_PLANAR
same as YUV_I420_SPLIT, but more conventional name.
@ YUV_I420_SPLIT
3 uint8_t values, 4:2:0. The 3 planes are stored separately.
@ RGBA32F
1 32 bit float value.
@ BAYER8_RGGB
8 bit per pixel, RGGB bayer pattern.
@ RAW10_BAYER_BGGR
10 bit per pixel, BGGR bayer pattern.
@ BAYER8_GBRG
8 bit per pixel, GBRG bayer pattern.
@ RGB10
uses 16 bit little-endian values. 6 most significant bits are unused and set to 0.
@ BAYER10_GBRG
10 bit per pixel, GBRG bayer pattern.
@ RGBA8
4 uint8_t values, red + blue + green + alpha.
@ GREY8
1 uint8_t.
@ YUY2
4 uint8_t values, 4:2:2, single plane.
@ YUV_420_NV12
Y plane + half width/half height chroma plane with weaved U and V values.
@ RGB12
uses 16 bit little-endian values. 4 most significant bits are unused and set to 0.
@ BAYER8_BGGR
8 bit per pixel, BGGR bayer pattern.
@ RGB32F
1 32 bit float value.
@ GREY10PACKED
10 bit per pixel, packed in successive little-endian bits, in 40 bits blocks.
@ SCALAR64F
1 64 bit float value, representing high precision image data.
@ BGR8
3 uint8_t values, blue + green + red.
@ GREY16
uses 16 bit little-endian values.
AudioSampleFormat
Audio sample format, when the audio type is AudioFormat::PCM.
Definition RecordFormat.h:121
@ U32_LE
LPCM, unsigned, 32 bit little endian.
@ F64_BE
LPCM, 64 bit float big endian.
@ U16_BE
LPCM, unsigned, 16 bit big endian.
@ U32_BE
LPCM, unsigned, 32 bit big endian.
@ F64_LE
LPCM, 64 bit float little endian.
@ S32_BE
LPCM, signed, 32 bit big endian.
@ U8
LPCM, unsigned, 8 bit.
@ S16_BE
LPCM, signed, 16 bit big endian.
@ F32_LE
LPCM, 32 bit float little endian.
@ S24_LE
LPCM, signed, 24 bit little endian.
@ S16_LE
LPCM, signed, 16 bit little endian.
@ U24_BE
LPCM, unsigned, 24 bit big endian.
@ S24_BE
LPCM, signed, 24 bit big endian.
@ S8
LPCM, signed, 8 bit.
@ MU_LAW
mu-law PCM, 8 bit.
@ U24_LE
LPCM, unsigned, 24 bit little endian.
@ U16_LE
LPCM, unsigned, 16 bit little endian.
@ F32_BE
LPCM, 32 bit float big endian.
@ A_LAW
a-law PCM, 8 bit.
@ S32_LE
LPCM, signed, 32 bit little endian.
ImageFormat
Definition RecordFormat.h:52
@ UNDEFINED
Unknown/unspecified.
@ CUSTOM_CODEC
Images encoded with a custom or experimental codec.
@ PNG
PNG data.
@ RAW
Raw pixel data.
@ JPG
JPEG data.
@ JXL
JPEG-XL data.
@ VIDEO
Video codec encoded images.
AudioFormat
Audio format type.
Definition RecordFormat.h:108
@ PCM
Raw PCM audio data.
@ OPUS
Audio data compressed using Opus. https://opus-codec.org/.
RecordableTypeId
VRS stream type or class identifier enum.
Definition StreamId.h:51
ContentType
Type of a record's block.
Definition RecordFormat.h:36
@ IMAGE
Image block.
@ DATA_LAYOUT
DataLayout block.
@ CUSTOM
Custom format, or unknown/unspecified data format.
@ EMPTY
No data (internal).
@ AUDIO
Audio block.