VRS
A file format for sensor data.
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
vrs::datalayout_conventions::ImageSpec Class Reference

DataLayout definitions use to describe what's in an image content block. More...

#include <DataLayoutConventions.h>

Inheritance diagram for vrs::datalayout_conventions::ImageSpec:
vrs::AutoDataLayout vrs::DataLayout

Public Member Functions

ContentBlock getImageContentBlock (const ImageContentBlockSpec &base, size_t blockSize=ContentBlock::kSizeUnknown)
 
- Public Member Functions inherited from vrs::DataLayout
DataLayoutoperator= (const DataLayout &)=delete
 
 DataLayout (const DataLayout &)=delete
 
virtual ~DataLayout ()
 
ContentBlock getContentBlock () const
 
vector< int8_t > & getFixedData ()
 
vector< int8_t > & getVarData ()
 
size_t getFixedDataSizeNeeded () const
 
size_t getVarDataSizeFromIndex () const
 
size_t getVarDataSizeNeeded () const
 
void collectVariableDataAndUpdateIndex ()
 
void collectVariableDataAndUpdateIndex (void *destination)
 
void getRawData (vector< int8_t > &outRawData) const
 
void stageCurrentValues ()
 
bool copyClonedDataPieceValues (const DataLayout &originalLayout)
 
bool mapLayout (DataLayout &targetLayout)
 
bool isMapped () const
 
bool hasAllRequiredPieces () const
 
void requireAllPieces ()
 Mark all the fields of the layout as required.
 
void printLayout (ostream &out, const string &indent="") const
 
void printLayoutCompact (ostream &out, const string &indent="") const
 
string asJson (JsonFormatProfile profile) const
 
string asJson (const JsonFormatProfileSpec &profile=JsonFormatProfileSpec()) const
 
string getListOfPiecesSpec () const
 Get a text list of fields, types & names, one per line. Useful for tests.
 
bool isSame (const DataLayout &otherLayout) const
 
template<class T >
const DataPieceValue< T > * findDataPieceValue (const string &label) const
 
template<class T >
DataPieceValue< T > * findDataPieceValue (const string &label)
 
template<class T >
const DataPieceArray< T > * findDataPieceArray (const string &label, size_t arraySize) const
 
template<class T >
DataPieceArray< T > * findDataPieceArray (const string &label, size_t arraySize)
 
template<class T >
const DataPieceVector< T > * findDataPieceVector (const string &label) const
 
template<class T >
DataPieceVector< T > * findDataPieceVector (const string &label)
 
template<class T >
const DataPieceStringMap< T > * findDataPieceStringMap (const string &label) const
 
template<class T >
DataPieceStringMap< T > * findDataPieceStringMap (const string &label)
 
const DataPieceStringfindDataPieceString (const string &label) const
 
DataPieceStringfindDataPieceString (const string &label)
 
void forEachDataPiece (const std::function< void(const DataPiece *)> &, DataPieceType type=DataPieceType::Undefined) const
 
void forEachDataPiece (const std::function< void(DataPiece *)> &, DataPieceType type=DataPieceType::Undefined)
 Same as above, but as a non-const version.
 
bool isVarDataIndexValid () const
 
size_t getDeclaredFixedDataPiecesCount () const
 
size_t getDeclaredVarDataPiecesCount () const
 
size_t getAvailableFixedDataPiecesCount () const
 
size_t getAvailableVarDataPiecesCount () const
 

Public Attributes

DataPieceValue< ImageSpecTypewidth {kImageWidth}
 
DataPieceValue< ImageSpecTypeheight {kImageHeight}
 
DataPieceValue< ImageSpecTypestride {kImageStride}
 
DataPieceValue< ImageSpecTypestride2 {kImageStride2}
 
DataPieceEnum< PixelFormat, ImageSpecTypepixelFormat {kImagePixelFormat}
 
DataPieceString codecName {kImageCodecName}
 
DataPieceValue< ImageSpecTypecodecQuality {kImageCodecQuality}
 
DataPieceValue< ImageSpecTypebytesPerPixels {kImageBytesPerPixel}
 
DataPieceValue< uint8_t > bytesPerPixels8 {kImageBytesPerPixel}
 
AutoDataLayoutEnd end
 

Additional Inherited Members

- Static Public Member Functions inherited from vrs::DataLayout
static unique_ptr< DataLayoutmakeFromJson (const string &json)
 
- Static Public Attributes inherited from vrs::DataLayout
static const size_t kNotFound = numeric_limits<size_t>::max()
 Special OffsetAndLength offset value marking that a piece of data isn't available.
 
static const size_t kVariableSize = numeric_limits<size_t>::max() - 1
 Special value used for a DataPiece size, telling that that DataPiece has a variable size.
 
- Protected Member Functions inherited from vrs::DataLayout
template<class T >
T * getFixedData (size_t offset, size_t size)
 
const IndexEntrygetVarSizeIndex () const
 
IndexEntrygetVarSizeIndex ()
 
template<class T >
T * getVarData (size_t varPieceIndex, size_t &outCount)
 
void initLayout ()
 
void serialize (JsonWrapper &rj, const JsonFormatProfileSpec &profile) const
 
- Static Protected Member Functions inherited from vrs::DataLayout
static bool mapPieces (const vector< DataPiece * > &searchPieces, const vector< DataPiece * > &givenPieces)
 
- Protected Attributes inherited from vrs::DataLayout
vector< DataPiece * > fixedSizePieces_
 Ordered fixed-size DataPieces.
 
vector< DataPiece * > varSizePieces_
 Ordered variable-size DataPieces.
 
vector< int8_t > fixedData_
 Buffer to hold fixed-size pieces, and the index of var size pieces (if any).
 
size_t fixedDataSizeNeeded_ {}
 Byte count for all the fixed size pieces + var size index.
 
vector< int8_t > varData_
 Buffer holding variable-size pieces, after they've been collected, or read from disk.
 
bool hasAllRequiredPieces_ {true}
 Tells all the required pieces have been mapped successfully.
 
DataLayoutmappedDataLayout_ {}
 DataLayout this layout has been mapped to, if any.
 

Detailed Description

DataLayout definitions use to describe what's in an image content block.

These names and types are a convention that enables us to find image block spec within a DataLayout block, which is either before the image content block in the same record, or in the last Configuration record. Note that once a configuration location is found, the next time around, the same location will be used again. Since RecordFormats are static for a single record, this won't create any surprise, but if you use different configuration record formats, this might make the search fail (the last record doesn't include the spec), or return the values for a record that is no longer the last one, though it is guarantied to be the last one of that format.

Note that the values used are not static, so that if the configuration changes, the latest value is used, without having to search each time we have a new image block.

Member Function Documentation

◆ getImageContentBlock()

ContentBlock vrs::datalayout_conventions::ImageSpec::getImageContentBlock ( const ImageContentBlockSpec base,
size_t  blockSize = ContentBlock::kSizeUnknown 
)

Helper method to determine the image content block based on available values. Will interpret legacy specifications, when a pixel format wasn't specified. imageFormat: image format expected, RAW or VIDEO. blockSize: content block size, required for VIDEO blocks. return An image content type on success, or an empty content block on failure.


The documentation for this class was generated from the following files: