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);
46
50enum class ImageFormat : uint8_t {
51 UNDEFINED = 0,
52 RAW,
53 JPG,
54 PNG,
55 VIDEO,
56 JXL,
58 COUNT
59};
60
61VRS_API string toString(ImageFormat imageFormat);
62
64enum class PixelFormat : uint8_t {
65 UNDEFINED = 0,
66
67 GREY8 = 1,
68 BGR8,
69 DEPTH32F,
70 RGB8,
73 RGBA8,
74 RGB10,
75 RGB12,
76 GREY10,
77 GREY12,
78 GREY16,
79 RGB32F,
80 SCALAR64F,
81 YUY2,
84 RGBA32F,
86 RAW10,
95
96 COUNT,
97};
98
99VRS_API string toString(PixelFormat pixelFormat);
100
102enum class AudioFormat : uint8_t {
103 UNDEFINED = 0,
104 PCM = 1,
105 OPUS = 2,
106 COUNT
107};
108
110VRS_API string toString(AudioFormat audioFormat);
111
113enum class AudioSampleFormat : uint8_t {
114 UNDEFINED = 0,
115 S8,
116 U8,
117 A_LAW,
118 MU_LAW,
119 S16_LE,
120 U16_LE,
121 S16_BE,
122 U16_BE,
123 S24_LE,
124 U24_LE,
125 S24_BE,
126 U24_BE,
127 S32_LE,
128 U32_LE,
129 S32_BE,
130 U32_BE,
131 F32_LE,
132 F32_BE,
133 F64_LE,
134 F64_BE,
135 COUNT
136};
137
139VRS_API string toString(AudioSampleFormat audioSampleFormat);
140
141class ContentParser; // to workaround not being able to forward declare istringstream.
142class RecordFormat;
143
146 public:
147 static constexpr uint8_t kQualityUndefined = 255;
148 static constexpr double kInvalidTimestamp = -1E-308; // arbitrary unrealistic value
149
150 ImageContentBlockSpec() = default;
151
153 ImageContentBlockSpec(ImageContentBlockSpec&&) noexcept = default;
155 ImageContentBlockSpec imageSpec,
156 double keyFrameTimestamp,
157 uint32_t keyFrameIndex);
158
161 ImageFormat imageFormat,
162 PixelFormat pixelFormat,
163 uint32_t width = 0,
164 uint32_t height = 0,
165 uint32_t stride = 0,
166 uint32_t stride2 = 0,
167 string codecName = {},
168 uint8_t codecQuality = kQualityUndefined,
169 double keyFrameTimestamp = kInvalidTimestamp,
170 uint32_t keyFrameIndex = 0);
171
173 /* implicit */ ImageContentBlockSpec(
174 ImageFormat imageFormat,
175 uint32_t width = 0,
176 uint32_t height = 0);
177
180 PixelFormat pixelFormat,
181 uint32_t width,
182 uint32_t height,
183 uint32_t stride = 0,
184 uint32_t stride2 = 0
185 );
186
189 ImageFormat imageFormat,
190 string codecName,
191 uint8_t codecQuality = kQualityUndefined,
192 PixelFormat pixelFormat = PixelFormat::UNDEFINED,
193 uint32_t width = 0,
194 uint32_t height = 0,
195 uint32_t stride = 0,
196 uint32_t stride2 = 0);
197
200 string codecName,
201 uint8_t codecQuality,
202 PixelFormat pixelFormat,
203 uint32_t width,
204 uint32_t height,
205 uint32_t stride = 0,
206 uint32_t stride2 = 0);
207
209 explicit ImageContentBlockSpec(const string& formatStr);
210
211 ~ImageContentBlockSpec() = default;
212
213 void init(
214 PixelFormat pixelFormat,
215 uint32_t width = 0,
216 uint32_t height = 0,
217 uint32_t stride = 0,
218 uint32_t stride2 = 0,
219 string codecName = {},
220 uint8_t codecQuality = kQualityUndefined,
221 double keyFrameTimestamp = kInvalidTimestamp,
222 uint32_t keyFrameIndex = 0);
223
225 void set(ContentParser& parser);
227 void clear();
228
230 ImageContentBlockSpec core() const;
231
234 string asString() const;
235
238 size_t getBlockSize() const;
239
242 size_t getRawImageSize() const;
243
246 ImageContentBlockSpec& operator=(ImageContentBlockSpec&&) noexcept = default;
247
249 bool operator==(const ImageContentBlockSpec& rhs) const;
250 bool operator!=(const ImageContentBlockSpec& rhs) const;
251
253 ImageFormat getImageFormat() const {
254 return imageFormat_;
255 }
256
258 string getImageFormatAsString() const;
259
262 return pixelFormat_;
263 }
265 string getPixelFormatAsString() const;
267 uint32_t getWidth() const {
268 return width_;
269 }
271 uint32_t getHeight() const {
272 return height_;
273 }
275 uint32_t getStride() const;
278 uint32_t getRawStride() const {
279 return stride_;
280 }
281 uint32_t getRawStride2() const {
282 return stride2_;
283 }
285 uint32_t getDefaultStride() const;
287 uint32_t getDefaultStride2() const;
288
290 uint32_t getPlaneCount() const {
291 return getPlaneCount(pixelFormat_);
292 }
293
296 uint32_t getPlaneStride(uint32_t planeIndex) const;
297
300 uint32_t getPlaneHeight(uint32_t planeIndex) const;
301
306 uint8_t getChannelCountPerPixel() const {
307 return getChannelCountPerPixel(pixelFormat_);
308 }
313 size_t getBytesPerPixel() const {
314 return getBytesPerPixel(pixelFormat_);
315 }
316
319 const string& getCodecName() const {
320 return codecName_;
321 }
325 uint8_t getCodecQuality() const {
326 return isQualityValid(codecQuality_) ? codecQuality_ : kQualityUndefined;
327 }
328
330 inline static bool isQualityValid(uint8_t quality) {
331 return quality <= 100;
332 }
333
335 double getKeyFrameTimestamp() const {
336 return keyFrameTimestamp_;
337 }
341 uint32_t getKeyFrameIndex() const {
342 return keyFrameIndex_;
343 }
344
346 static uint8_t getChannelCountPerPixel(PixelFormat pixel);
348 static size_t getBytesPerPixel(PixelFormat pixel);
349
351 static string getPixelFormatAsString(PixelFormat pixelFormat) {
352 return toString(pixelFormat);
353 }
354
356 static uint32_t getPlaneCount(PixelFormat pixelFormat);
357
360 bool sanityCheckStrides() const;
361
362 private:
363 ImageFormat imageFormat_{ImageFormat::UNDEFINED};
364 PixelFormat pixelFormat_{PixelFormat::UNDEFINED};
365 uint32_t width_{0};
366 uint32_t height_{0};
367 uint32_t stride_{0}; // Stride (bytes between lines) for the first pixel plane
368 uint32_t stride2_{0}; // Stride for the other planes (same for all)
369 // for ImageFormat::VIDEO
370 string codecName_;
371 double keyFrameTimestamp_{kInvalidTimestamp};
372 uint32_t keyFrameIndex_{0};
373 uint8_t codecQuality_{kQualityUndefined};
374};
375
378 public:
379 AudioContentBlockSpec() = default;
382 AudioContentBlockSpec(AudioContentBlockSpec&&) noexcept = default;
384 explicit AudioContentBlockSpec(AudioFormat audioFormat, uint8_t channelCount = 0);
386 AudioFormat audioFormat,
387 AudioSampleFormat sampleFormat,
388 uint8_t channelCount = 0,
389 uint8_t sampleFrameStride = 0,
390 uint32_t sampleFrameRate = 0,
391 uint32_t sampleFrameCount = 0,
392 uint8_t stereoPairCount = 0);
393 ~AudioContentBlockSpec() = default;
394
397 explicit AudioContentBlockSpec(const string& formatStr);
398
401 void set(ContentParser& parser);
403 void clear();
404
405 AudioContentBlockSpec& operator=(const AudioContentBlockSpec&) = default;
406 AudioContentBlockSpec& operator=(AudioContentBlockSpec&&) noexcept = default;
407
408 bool operator==(const AudioContentBlockSpec& rhs) const;
409 bool operator!=(const AudioContentBlockSpec& rhs) const {
410 return !operator==(rhs);
411 }
414 string asString() const;
415
417 size_t getBlockSize() const;
418
420 size_t getPcmBlockSize() const;
421
423 bool isCompatibleWith(const AudioContentBlockSpec& rhs) const;
426 return audioFormat_;
427 }
430 return sampleFormat_;
431 }
433 string getSampleFormatAsString() const;
435 bool isLittleEndian() const {
436 return isLittleEndian(sampleFormat_);
437 }
439 bool isIEEEFloat() const {
440 return isIEEEFloat(sampleFormat_);
441 }
443 uint8_t getBitsPerSample() const {
444 return getBitsPerSample(sampleFormat_);
445 }
447 uint8_t getBytesPerSample() const {
448 return (getBitsPerSample(sampleFormat_) + 7) / 8; // round up
449 }
451 uint8_t getSampleFrameStride() const;
453 uint8_t getChannelCount() const {
454 return channelCount_;
455 }
457 uint32_t getSampleRate() const {
458 return sampleFrameRate_;
459 }
461 uint32_t getSampleCount() const {
462 return sampleFrameCount_;
463 }
465 void setSampleCount(uint32_t sampleCount) {
466 sampleFrameCount_ = sampleCount;
467 }
468
469 uint8_t getStereoPairCount() const {
470 return stereoPairCount_;
471 }
472
475 bool isSampleBlockFormatDefined() const;
476
478 static bool isLittleEndian(AudioSampleFormat sampleFormat);
480 static bool isIEEEFloat(AudioSampleFormat sampleFormat);
482 static uint8_t getBitsPerSample(AudioSampleFormat sampleFormat);
484 static uint8_t getBytesPerSample(AudioSampleFormat sampleFormat);
486 static string getSampleFormatAsString(AudioSampleFormat sampleFormat) {
487 return toString(sampleFormat);
488 }
489
490 private:
491 AudioFormat audioFormat_{};
492 AudioSampleFormat sampleFormat_{};
493 uint8_t sampleFrameStride_{};
494 uint8_t channelCount_{};
495 uint32_t sampleFrameRate_{};
496 uint32_t sampleFrameCount_{};
497 uint8_t stereoPairCount_{};
498};
499
512class VRS_API ContentBlock {
513 public:
515 static const size_t kSizeUnknown;
516
518 /* implicit */ ContentBlock(ContentType type = ContentType::EMPTY, size_t size = kSizeUnknown);
519
521 explicit ContentBlock(const string& formatStr);
522
524 /* implicit */ ContentBlock(ImageFormat imageFormat, uint32_t width = 0, uint32_t height = 0);
525
528 std::string codecName,
529 uint8_t codecQuality,
530 PixelFormat pixelFormat = PixelFormat::UNDEFINED,
531 uint32_t width = 0,
532 uint32_t height = 0,
533 uint32_t stride = 0,
534 uint32_t stride2 = 0);
535
538 PixelFormat pixelFormat,
539 uint32_t width,
540 uint32_t height,
541 uint32_t stride = 0,
542 uint32_t stride2 = 0);
543
544 /* implicit */ ContentBlock(const ImageContentBlockSpec& imageSpec, size_t size = kSizeUnknown);
545 /* implicit */ ContentBlock(
546 ImageContentBlockSpec&& imageSpec,
547 size_t size = kSizeUnknown) noexcept;
549 const ContentBlock& imageContentBlock,
550 double keyFrameTimestamp,
551 uint32_t keyFrameIndex);
552
554 /* implicit */ ContentBlock(AudioFormat audioFormat, uint8_t channelCount = 0);
555 /* implicit */ ContentBlock(const AudioContentBlockSpec& audioSpec, size_t size);
556
559 AudioFormat audioFormat,
560 AudioSampleFormat sampleFormat,
561 uint8_t numChannels = 0,
562 uint8_t sampleFrameStride = 0,
563 uint32_t sampleRate = 0,
564 uint32_t sampleCount = 0,
565 uint8_t stereoPairCount = 0);
566
568 ContentBlock(const ContentBlock&) = default;
569 ContentBlock(ContentBlock&&) noexcept = default;
570
572 ContentBlock(const ContentBlock& other, size_t size)
573 : contentType_{other.contentType_}, size_{size} {
574 if (contentType_ == ContentType::IMAGE) {
575 imageSpec_ = other.imageSpec_;
576 } else if (contentType_ == ContentType::AUDIO) {
577 audioSpec_ = other.audioSpec_;
578 } else if (contentType_ == ContentType::CUSTOM) {
579 customContentBlockFormat_ = other.customContentBlockFormat_;
580 }
581 }
582
583 ~ContentBlock() = default;
584
585 ContentBlock& operator=(const ContentBlock& rhs) = default;
586 ContentBlock& operator=(ContentBlock&& rhs) noexcept = default;
587
589 string asString() const;
590
592 size_t getBlockSize() const;
593
596 return contentType_;
597 }
598
602 return customContentBlockFormat_;
603 }
604
605 bool operator==(const ContentBlock& rhs) const;
606
607 bool operator!=(const ContentBlock& rhs) const {
608 return !operator==(rhs);
609 }
610
612 RecordFormat operator+(const ContentBlock&) const;
613
615 const ImageContentBlockSpec& image() const;
617 const AudioContentBlockSpec& audio() const;
618
619 protected:
620 ContentType contentType_ = ContentType::EMPTY;
621 size_t size_ = kSizeUnknown;
622 ImageContentBlockSpec imageSpec_;
623 AudioContentBlockSpec audioSpec_;
624 string customContentBlockFormat_;
625};
626
627class VRS_API CustomContentBlock : public ContentBlock {
628 public:
629 explicit CustomContentBlock(const string& customContentBlockFormat, size_t size = kSizeUnknown);
630 explicit CustomContentBlock(size_t size = kSizeUnknown);
631};
632
634using RecordFormatMap = map<pair<Record::Type, uint32_t>, RecordFormat>;
635
644class VRS_API ContentBlockId {
645 public:
647 RecordableTypeId typeIdIn,
648 Record::Type recordTypeIn,
649 uint32_t formatVersionIn,
650 size_t blockIndexIn)
651 : typeId(typeIdIn),
652 recordType(recordTypeIn),
653 formatVersion(formatVersionIn),
654 blockIndex(blockIndexIn) {}
655
656 RecordableTypeId getRecordableTypeId() const {
657 return typeId;
658 }
659
660 Record::Type getRecordType() const {
661 return recordType;
662 }
663
664 uint32_t getFormatVersion() const {
665 return formatVersion;
666 }
667
668 size_t getBlockIndex() const {
669 return blockIndex;
670 }
671
672 private:
673 RecordableTypeId typeId;
674 Record::Type recordType;
675 uint32_t formatVersion;
676 size_t blockIndex;
677};
678
688class VRS_API RecordFormat {
689 public:
691 RecordFormat() = default;
693 RecordFormat(const RecordFormat&) = default;
694 /* implicit */ RecordFormat(RecordFormat&&) noexcept = default;
695 ~RecordFormat() = default;
696
697 RecordFormat& operator=(const RecordFormat&) = default;
698 RecordFormat& operator=(RecordFormat&&) noexcept = default;
699
703 explicit RecordFormat(const string& format) {
704 set(format);
705 }
709 explicit RecordFormat(const char* format) {
710 set(format);
711 }
713 /* implicit */ RecordFormat(const ContentBlock& block) {
714 blocks_.emplace_back(block);
715 }
717 /* implicit */ RecordFormat(ContentBlock&& block) noexcept {
718 blocks_.emplace_back(std::move(block));
719 }
721 RecordFormat(const ContentBlock& first, const ContentBlock& second) {
722 blocks_.emplace_back(first);
723 blocks_.emplace_back(second);
724 }
726 RecordFormat(ContentBlock&& first, ContentBlock&& second) noexcept {
727 blocks_.emplace_back(std::move(first));
728 blocks_.emplace_back(std::move(second));
729 }
734 /* implicit */ RecordFormat(ContentType type, size_t size = ContentBlock::kSizeUnknown) {
735 blocks_.emplace_back(type, size);
736 }
737
740 blocks_.emplace_back(block);
741 return *this;
742 }
745 blocks_.emplace_back(std::move(block));
746 return *this;
747 }
748
749 bool operator==(const RecordFormat& rhs) const;
750 bool operator!=(const RecordFormat& rhs) const {
751 return !operator==(rhs);
752 }
753
754 void clear() {
755 blocks_.clear();
756 }
757
760 void set(const string& format);
763 string asString() const;
764
767 size_t getRecordSize() const;
770 size_t getUsedBlocksCount() const;
774 size_t getBlocksOfTypeCount(ContentType type) const;
778 const ContentBlock& getContentBlock(size_t index) const;
782 return getContentBlock(0);
783 }
788 size_t getRemainingBlocksSize(size_t firstBlock) const;
795 size_t getBlockSize(size_t blockIndex, size_t remainingSize) const;
796
797 // Static VRS dedicated helper methods, for RecordFormat & DataLayout purposes.
798
800 static string getRecordFormatTagName(Record::Type recordType, uint32_t formatVersion);
801 static string getDataLayoutTagName(Record::Type type, uint32_t version, size_t blockIndex);
804 static bool parseRecordFormatTagName(
805 const string& tagName,
806 Record::Type& recordType,
807 uint32_t& formatVersion);
808
811 static bool addRecordFormat(
812 map<string, string>& inOutRecordFormatRegister,
813 Record::Type recordType,
814 uint32_t formatVersion,
815 const RecordFormat& format,
816 const vector<const DataLayout*>& layouts);
817
818 static void getRecordFormats(
819 const map<string, string>& recordFormatRegister,
820 RecordFormatMap& outFormats);
821
822 static unique_ptr<DataLayout> getDataLayout(
823 const map<string, string>& recordFormatRegister,
824 const ContentBlockId& blockId);
825
826 private:
827 vector<ContentBlock> blocks_;
828};
829
830} // namespace vrs
Specification of an audio content block.
Definition RecordFormat.h:377
uint8_t getChannelCount() const
Get the number of audio channels in each sample frame (not in the content block).
Definition RecordFormat.h:453
void setSampleCount(uint32_t sampleCount)
Set the number of audio sample frames in the content block.
Definition RecordFormat.h:465
uint8_t getBitsPerSample() const
Get the number of bits per audio sample.
Definition RecordFormat.h:443
AudioContentBlockSpec(const AudioContentBlockSpec &)=default
Default copy constructor.
bool isLittleEndian() const
Tell if the audio sample format is little endian.
Definition RecordFormat.h:435
uint32_t getSampleCount() const
Get the number of audio sample frames in the content block.
Definition RecordFormat.h:461
uint8_t getBytesPerSample() const
Get the number of bytes per audio sample.
Definition RecordFormat.h:447
uint32_t getSampleRate() const
Get the audio frame sample rate.
Definition RecordFormat.h:457
bool isIEEEFloat() const
Tell if the audio sample format is an IEEE float.
Definition RecordFormat.h:439
AudioFormat getAudioFormat() const
Get audio format.
Definition RecordFormat.h:425
AudioSampleFormat getSampleFormat() const
Get audio sample format.
Definition RecordFormat.h:429
static string getSampleFormatAsString(AudioSampleFormat sampleFormat)
Get an audio sample format as a string.
Definition RecordFormat.h:486
Specification of a VRS record content block.
Definition RecordFormat.h:512
ContentBlock(const ContentBlock &)=default
Default copy constructor.
ContentType getContentType() const
Get the ContentType of the block.
Definition RecordFormat.h:595
string getCustomContentBlockFormat() const
Definition RecordFormat.h:601
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:515
Helper to identify a particular content block within a file.
Definition RecordFormat.h:644
RecordFormat string parsing helper class.
Definition RecordFormat.cpp:37
Definition RecordFormat.h:627
Specification of an image content block.
Definition RecordFormat.h:145
ImageContentBlockSpec & operator=(const ImageContentBlockSpec &)=default
Default copy assignment.
uint8_t getCodecQuality() const
Definition RecordFormat.h:325
uint32_t getKeyFrameIndex() const
Definition RecordFormat.h:341
size_t getBytesPerPixel() const
Definition RecordFormat.h:313
uint32_t getHeight() const
Get image height, or 0 if unknown/unspecified.
Definition RecordFormat.h:271
PixelFormat getPixelFormat() const
Get Pixel format.
Definition RecordFormat.h:261
static string getPixelFormatAsString(PixelFormat pixelFormat)
Get pixel format presented as a readable string, from which it can be reconstructed.
Definition RecordFormat.h:351
const string & getCodecName() const
Definition RecordFormat.h:319
uint32_t getRawStride() const
Definition RecordFormat.h:278
double getKeyFrameTimestamp() const
Get timestamp of the key frame of the group of frames this video frame belongs to.
Definition RecordFormat.h:335
static bool isQualityValid(uint8_t quality)
Validate that a quality value is valid.
Definition RecordFormat.h:330
uint8_t getChannelCountPerPixel() const
Definition RecordFormat.h:306
uint32_t getPlaneCount() const
Get the number of planes for this pixel format.
Definition RecordFormat.h:290
uint32_t getWidth() const
Get image width, or 0 if unknown/unspecified.
Definition RecordFormat.h:267
Description of the format of a VRS record as a succession of typed blocks of content.
Definition RecordFormat.h:688
RecordFormat(const RecordFormat &)=default
Default copy constructor.
RecordFormat(ContentBlock &&first, ContentBlock &&second) noexcept
Build a RecordFormat from two ContentBlock definitions.
Definition RecordFormat.h:726
RecordFormat & operator+(ContentBlock &&block)
Append a ContentBlock to this RecordFormat.
Definition RecordFormat.h:744
RecordFormat(const char *format)
Definition RecordFormat.h:709
RecordFormat(const ContentBlock &block)
Build a RecordFormat from a single ContentBlock.
Definition RecordFormat.h:713
RecordFormat(ContentType type, size_t size=ContentBlock::kSizeUnknown)
Definition RecordFormat.h:734
RecordFormat()=default
Empty record format definition.
RecordFormat(ContentBlock &&block) noexcept
Build a RecordFormat from a single ContentBlock.
Definition RecordFormat.h:717
const ContentBlock & getFirstContentBlock() const
Definition RecordFormat.h:781
RecordFormat(const ContentBlock &first, const ContentBlock &second)
Build a RecordFormat from two ContentBlock definitions.
Definition RecordFormat.h:721
RecordFormat & operator+(const ContentBlock &block)
Append a ContentBlock to this RecordFormat.
Definition RecordFormat.h:739
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:634
PixelFormat
Pixel format type, then the image format is ImageFormat::RAW.
Definition RecordFormat.h:64
@ 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:113
@ 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:50
@ 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:102
@ 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.