Varjo Native SDK
Varjo_types_datastream.h File Reference

Go to the source code of this file.

Data Structures

struct  varjo_StreamConfig
 Data stream configuration. More...
 
struct  varjo_CameraIntrinsics
 Camera intrinsics parameter for undistorting a distorted camera frame. More...
 
struct  varjo_WBNormalizationData
 White balance normalization data for color matching VR content with camera image. More...
 
struct  varjo_StreamFrame
 A single frame that will arrive to FrameListener callback after the user has subscribed to a stream. More...
 

Typedefs

typedef uint64_t varjo_ChannelFlag
 Bitfield for different data stream channels. More...
 
typedef int64_t varjo_ChannelIndex
 Values for indexing buffers and settings of data streams. More...
 
typedef int64_t varjo_IntrinsicsModel
 Camera intrinsics model type. More...
 
typedef int64_t varjo_BufferType
 Memory buffer type. More...
 
typedef uint64_t varjo_DataFlag
 Frame data flag buffer type. More...
 
typedef int64_t varjo_StreamType
 Data stream types. More...
 
typedef int64_t varjo_StreamId
 Stream ID to identify a data stream configuration. More...
 
typedef int64_t varjo_BufferId
 Buffer ID to lock and use a data stream buffer. More...
 
typedef void() varjo_FrameListener(const struct varjo_StreamFrame *frame, struct varjo_Session *session, void *userData)
 Camera frame stream callback function. More...
 

Variables

static const varjo_ChannelFlag varjo_ChannelFlag_None = 0
 Disables data buffers and only provides metadata. More...
 
static const varjo_ChannelFlag varjo_ChannelFlag_First = 1 << 0
 First channel. More...
 
static const varjo_ChannelFlag varjo_ChannelFlag_Second = 1 << 1
 Second channel. More...
 
static const varjo_ChannelFlag varjo_ChannelFlag_Left = 1 << 0
 Helper aliases and aggregates for varjo_ChannelFlag. More...
 
static const varjo_ChannelFlag varjo_ChannelFlag_Right = 1 << 1
 Right camera channel. Alias for varjo_ChannelFlag_Second. More...
 
static const varjo_ChannelFlag varjo_ChannelFlag_All = ~0
 Aggregate of every available channel. More...
 
static const varjo_ChannelIndex varjo_ChannelIndex_First = 0
 First channel. More...
 
static const varjo_ChannelIndex varjo_ChannelIndex_Second = 1
 Second channel. More...
 
static const varjo_ChannelIndex varjo_ChannelIndex_Left = 0
 Helper aliases for varjo_ChannelIndex. More...
 
static const varjo_ChannelIndex varjo_ChannelIndex_Right = 1
 Right camera channel. Alias for varjo_ChannelIndex_Second. More...
 
static const varjo_IntrinsicsModel varjo_IntrinsicsModel_Omnidir = 1
 OpenCV compatible Omnidir calibration model. More...
 
static const varjo_BufferType varjo_BufferType_CPU = 1
 Data is available in a CPU memory buffer. More...
 
static const varjo_BufferType varjo_BufferType_GPU = 2
 Data is available in a GPU memory buffer. More...
 
static const varjo_DataFlag varjo_DataFlag_Buffer = 1 << 0
 
static const varjo_DataFlag varjo_DataFlag_Intrinsics = 1 << 1
 
static const varjo_DataFlag varjo_DataFlag_Extrinsics = 1 << 2
 
static const varjo_StreamType varjo_StreamType_DistortedColor = 1
 Distorted (i.e. More...
 
static const varjo_StreamType varjo_StreamType_EnvironmentCubemap = 2
 HDR lighting estimate stream as a cubemap. More...
 
static const int64_t varjo_InvalidId = -1
 Invalid id for any ID type (e.g. More...
 

Data Structure Documentation

◆ varjo_StreamConfig

struct varjo_StreamConfig

Data stream configuration.

Data Fields
varjo_BufferType bufferType Buffer type: CPU or GPU memory buffer.
varjo_ChannelFlag channelFlags Bitfield of provided camera channels.
varjo_TextureFormat format Texture format.
int32_t frameRate Frame rate in frames per second.
int32_t height Texture height;.
int32_t rowStride Buffer row stride in bytes.
varjo_StreamId streamId Id.
struct varjo_Matrix streamTransform Transform from HMD pose center to stream origin in view coordinates.
varjo_StreamType streamType Stream type.
int32_t width Texture width.

◆ varjo_CameraIntrinsics

struct varjo_CameraIntrinsics

Camera intrinsics parameter for undistorting a distorted camera frame.

Data Fields
double distortionCoefficients[6] Intrinsics model coefficients. For omnidir: 2 radial, skew, xi, 2 tangential.
double focalLengthX Camera focal length X.
double focalLengthY Camera focal length Y.
varjo_IntrinsicsModel model Intrisics calibration model.
double principalPointX Camera principal point X.
double principalPointY Camera principal point Y.

◆ varjo_BufferMetadata

struct varjo_BufferMetadata

Buffer for data streams.

Data Fields
int32_t byteSize Buffer size in bytes.
varjo_TextureFormat format Texture format.
int32_t height Image height.
int32_t rowStride Buffer row stride in bytes.
varjo_BufferType type CPU or GPU.
int32_t width Image width.

◆ varjo_WBNormalizationData

struct varjo_WBNormalizationData

White balance normalization data for color matching VR content with camera image.

It is assumed that VR content is rendered as if it uses a fixed 6500K white balance. Color conversion to camera white balance color temperature is done with the following formula:

finalColor = saturate(color * invCCM * diag(whiteBalanceColorGains)) * ccm

where saturate(x) means clamping out-of-bounds values to [0, 2^B-1] range assuming B-bit image and diag(x) is a diagonal matrix with x values on the diagonal.

Data Fields
struct varjo_Matrix3x3 ccm CCM for VST color temperature.
struct varjo_Matrix3x3 invCCM Inverse CCM for 6500K color temperature.
double whiteBalanceColorGains[3] White balance RGB gains to convert from 6500K to VST color temperature.

◆ varjo_DistortedColorFrameMetadata

struct varjo_DistortedColorFrameMetadata

Metadata for distorted color stream.

Data Fields
double cameraCalibrationConstant The luminance (in cd/m^2) which saturates a pixel is equal to 2^ev * cameraCalibrationConstant.
double ev EV (exposure value) at ISO100.
double exposureTime Exposure time in seconds.
varjo_Nanoseconds timestamp Timestamp at end of exposure.
struct varjo_WBNormalizationData wbNormalizationData White balance normalization data.
double whiteBalanceTemperature Camera white balance color temperature in Kelvin degrees.

◆ varjo_EnvironmentCubemapFrameMetadata

struct varjo_EnvironmentCubemapFrameMetadata

Metadata for environment cubemap stream.

Please refer to varjo_DistortedColorFrameMetadata documentation on how to access the buffer.

Data Fields
varjo_Nanoseconds timestamp Timestamp when the cubemap was last updated.

◆ varjo_StreamFrameMetadata

union varjo_StreamFrameMetadata

Wrapper union for different types of streams.

Data Fields
struct varjo_DistortedColorFrameMetadata distortedColor
struct varjo_EnvironmentCubemapFrameMetadata environmentCubemap
int64_t reserved[64]

◆ varjo_StreamFrame

struct varjo_StreamFrame

A single frame that will arrive to FrameListener callback after the user has subscribed to a stream.

Data Fields
varjo_ChannelFlag channels Channels that this frame contains.
varjo_DataFlag dataFlags Data that this frame contains.
int64_t frameNumber Monotonically increasing frame number.
struct varjo_Matrix hmdPose HMD world pose. Invert the pose, if you need the HMD center view matrix.
varjo_StreamId id Id of the stream.
union varjo_StreamFrameMetadata metadata Frame data. Use 'type' to determine which element to access.
varjo_StreamType type Type of the stream.

Typedef Documentation

◆ varjo_BufferId

typedef int64_t varjo_BufferId

Buffer ID to lock and use a data stream buffer.

◆ varjo_BufferType

typedef int64_t varjo_BufferType

Memory buffer type.

◆ varjo_ChannelFlag

typedef uint64_t varjo_ChannelFlag

Bitfield for different data stream channels.

◆ varjo_ChannelIndex

typedef int64_t varjo_ChannelIndex

Values for indexing buffers and settings of data streams.

◆ varjo_DataFlag

typedef uint64_t varjo_DataFlag

Frame data flag buffer type.

◆ varjo_FrameListener

typedef void() varjo_FrameListener(const struct varjo_StreamFrame *frame, struct varjo_Session *session, void *userData)

Camera frame stream callback function.

Parameters
frameIncoming frame.
sessionVarjo session pointer for this callback.
userDataUser controlled pointer that can be supplied when subscribing to a data stream.

◆ varjo_IntrinsicsModel

typedef int64_t varjo_IntrinsicsModel

Camera intrinsics model type.

◆ varjo_StreamId

typedef int64_t varjo_StreamId

Stream ID to identify a data stream configuration.

◆ varjo_StreamType

typedef int64_t varjo_StreamType

Data stream types.

Variable Documentation

◆ varjo_BufferType_CPU

const varjo_BufferType varjo_BufferType_CPU = 1
static

Data is available in a CPU memory buffer.

◆ varjo_BufferType_GPU

const varjo_BufferType varjo_BufferType_GPU = 2
static

Data is available in a GPU memory buffer.

◆ varjo_ChannelFlag_All

const varjo_ChannelFlag varjo_ChannelFlag_All = ~0
static

Aggregate of every available channel.

◆ varjo_ChannelFlag_First

const varjo_ChannelFlag varjo_ChannelFlag_First = 1 << 0
static

First channel.

◆ varjo_ChannelFlag_Left

const varjo_ChannelFlag varjo_ChannelFlag_Left = 1 << 0
static

Helper aliases and aggregates for varjo_ChannelFlag.

Left camera channel. Alias for varjo_ChannelFlag_First.

◆ varjo_ChannelFlag_None

const varjo_ChannelFlag varjo_ChannelFlag_None = 0
static

Disables data buffers and only provides metadata.

◆ varjo_ChannelFlag_Right

const varjo_ChannelFlag varjo_ChannelFlag_Right = 1 << 1
static

Right camera channel. Alias for varjo_ChannelFlag_Second.

◆ varjo_ChannelFlag_Second

const varjo_ChannelFlag varjo_ChannelFlag_Second = 1 << 1
static

Second channel.

◆ varjo_ChannelIndex_First

const varjo_ChannelIndex varjo_ChannelIndex_First = 0
static

First channel.

◆ varjo_ChannelIndex_Left

const varjo_ChannelIndex varjo_ChannelIndex_Left = 0
static

Helper aliases for varjo_ChannelIndex.

Left camera channel. Alias for varjo_ChannelIndex_First.

◆ varjo_ChannelIndex_Right

const varjo_ChannelIndex varjo_ChannelIndex_Right = 1
static

Right camera channel. Alias for varjo_ChannelIndex_Second.

◆ varjo_ChannelIndex_Second

const varjo_ChannelIndex varjo_ChannelIndex_Second = 1
static

Second channel.

◆ varjo_DataFlag_Buffer

const varjo_DataFlag varjo_DataFlag_Buffer = 1 << 0
static

◆ varjo_DataFlag_Extrinsics

const varjo_DataFlag varjo_DataFlag_Extrinsics = 1 << 2
static

◆ varjo_DataFlag_Intrinsics

const varjo_DataFlag varjo_DataFlag_Intrinsics = 1 << 1
static

◆ varjo_IntrinsicsModel_Omnidir

const varjo_IntrinsicsModel varjo_IntrinsicsModel_Omnidir = 1
static

OpenCV compatible Omnidir calibration model.

◆ varjo_InvalidId

const int64_t varjo_InvalidId = -1
static

Invalid id for any ID type (e.g.

StreamId, BufferId).

◆ varjo_StreamType_DistortedColor

const varjo_StreamType varjo_StreamType_DistortedColor = 1
static

Distorted (i.e.

uncorrected) color data stream from visible light RGB camera.

Color data frames contain the following additional data for each channel:

◆ varjo_StreamType_EnvironmentCubemap

const varjo_StreamType varjo_StreamType_EnvironmentCubemap = 2
static

HDR lighting estimate stream as a cubemap.

Values are linear, RGB=(1, 1, 1) corresponds to a luminance of 100 cd/m^2. Alpha channel indicates cubemap coverage.

Contains a single frame with the following additional data:

Cubemap layout:

| top |
| left | front | right | back |
| bottom |

CPU buffer contains the faces packed into a single column:

| right |
| left |
| top |
| bottom |
| front |
| back |