libvmx
VMX Codec
Loading...
Searching...
No Matches
vmxcodec.h File Reference
#include <cstdint>
#include <cstring>
#include "thread_tasks.h"

Go to the source code of this file.

Data Structures

struct  VMX_SIZE
struct  VMX_SLICE_DATA
struct  VMX_SLICE_SET
struct  VMX_PLANE
struct  VMX_INSTANCE

Macros

#define VMX_API   extern "C" __attribute__((visibility("default")))

Typedefs

typedef unsigned long long buffer_t
typedef unsigned char BYTE

Enumerations

enum  VMX_FORMAT { VMX_FORMAT_PROGRESSIVE , VMX_FORMAT_INTERLACED }
enum  VMX_ERR {
  VMX_ERR_OK , VMX_ERR_UNKNOWN , VMX_ERR_INVALID_CODEC_FORMAT , VMX_ERR_INVALID_SLICE_COUNT ,
  VMX_ERR_BUFFER_OVERFLOW , VMX_ERR_INVALID_INSTANCE , VMX_ERR_INVALID_PARAMETERS
}
enum  VMX_PROFILE {
  VMX_PROFILE_DEFAULT = 0 , VMX_PROFILE_LQ = 33 , VMX_PROFILE_SQ = 66 , VMX_PROFILE_HQ = 99 ,
  VMX_PROFILE_OMT_LQ = 133 , VMX_PROFILE_OMT_SQ = 166 , VMX_PROFILE_OMT_HQ = 199
}
enum  VMX_COLORSPACE { VMX_COLORSPACE_UNDEFINED = 0 , VMX_COLORSPACE_BT601 = 601 , VMX_COLORSPACE_BT709 = 709 }
enum  VMX_CODEC_FORMAT { VMX_CODEC_FORMAT_NONE , VMX_CODEC_FORMAT_PROGRESSIVE , VMX_CODEC_FORMAT_INTERLACED , VMX_CODEC_FORMAT_EXTENDED }
enum  VMX_IMAGE_FORMAT {
  VMX_IMAGE_UYVY , VMX_IMAGE_YUY2 , VMX_IMAGE_NV12 , VMX_IMAGE_YV12 ,
  VMX_IMAGE_YUVPLANAR422 , VMX_IMAGE_BGRA , VMX_IMAGE_BGRX , VMX_IMAGE_UYVA ,
  VMX_IMAGE_P216 , VMX_IMAGE_PA16
}

Functions

VMX_API VMX_INSTANCEVMX_Create (VMX_SIZE dimensions, VMX_PROFILE profile, VMX_COLORSPACE colorSpace)
VMX_API void VMX_Destroy (VMX_INSTANCE *instance)
VMX_API void VMX_SetQuality (VMX_INSTANCE *instance, int q)
VMX_API int VMX_GetQuality (VMX_INSTANCE *instance)
VMX_API void VMX_GetEncodingParameters (VMX_INSTANCE *instance, int *frameMin, int *frameMax, int *minQuality, int *dcShift)
VMX_API void VMX_SetEncodingParameters (VMX_INSTANCE *instance, int frameMin, int frameMax, int minQuality, int dcShift)
VMX_API VMX_ERR VMX_DecodeBGRA (VMX_INSTANCE *instance, BYTE *dst, int stride)
VMX_API VMX_ERR VMX_DecodeBGRX (VMX_INSTANCE *instance, BYTE *dst, int stride)
VMX_API VMX_ERR VMX_DecodeP216 (VMX_INSTANCE *instance, BYTE *dst, int stride)
VMX_API VMX_ERR VMX_DecodePA16 (VMX_INSTANCE *instance, BYTE *dst, int stride)
VMX_API VMX_ERR VMX_DecodeUYVY (VMX_INSTANCE *instance, BYTE *dst, int stride)
VMX_API VMX_ERR VMX_DecodeUYVA (VMX_INSTANCE *instance, BYTE *dst, int stride)
VMX_API VMX_ERR VMX_DecodeYUY2 (VMX_INSTANCE *instance, BYTE *dst, int stride)
VMX_API VMX_ERR VMX_DecodePreviewBGRA (VMX_INSTANCE *instance, BYTE *dst, int stride)
VMX_API VMX_ERR VMX_DecodePreviewBGRX (VMX_INSTANCE *instance, BYTE *dst, int stride)
VMX_API VMX_ERR VMX_DecodePreviewUYVY (VMX_INSTANCE *instance, BYTE *dst, int stride)
VMX_API VMX_ERR VMX_DecodePreviewUYVA (VMX_INSTANCE *instance, BYTE *dst, int stride)
VMX_API VMX_ERR VMX_DecodePreviewYUY2 (VMX_INSTANCE *instance, BYTE *dst, int stride)
VMX_API VMX_ERR VMX_EncodeBGRA (VMX_INSTANCE *instance, BYTE *src, int stride, int interlaced)
VMX_API VMX_ERR VMX_EncodeBGRX (VMX_INSTANCE *instance, BYTE *src, int stride, int interlaced)
VMX_API VMX_ERR VMX_EncodeUYVY (VMX_INSTANCE *instance, BYTE *src, int stride, int interlaced)
VMX_API VMX_ERR VMX_EncodeUYVA (VMX_INSTANCE *instance, BYTE *src, int stride, int interlaced)
VMX_API VMX_ERR VMX_EncodeYUY2 (VMX_INSTANCE *instance, BYTE *src, int stride, int interlaced)
VMX_API VMX_ERR VMX_EncodeNV12 (VMX_INSTANCE *instance, BYTE *srcY, int srcStrideY, BYTE *srcUV, int srcStrideUV, int interlaced)
VMX_API VMX_ERR VMX_EncodeYV12 (VMX_INSTANCE *instance, BYTE *srcY, int srcStrideY, BYTE *srcU, int srcStrideU, BYTE *srcV, int srcStrideV, int interlaced)
VMX_API VMX_ERR VMX_EncodeP216 (VMX_INSTANCE *instance, BYTE *src, int stride, int interlaced)
VMX_API VMX_ERR VMX_EncodePA16 (VMX_INSTANCE *instance, BYTE *src, int stride, int interlaced)
VMX_API VMX_ERR VMX_EncodePlanar (VMX_INSTANCE *instance, int interlaced)
VMX_API VMX_ERR VMX_LoadFrom (VMX_INSTANCE *instance, BYTE *data, int dataLen)
VMX_API int VMX_SaveTo (VMX_INSTANCE *instance, BYTE *dst, int maxLen)
VMX_API int VMX_GetEncodedPreviewLength (VMX_INSTANCE *instance)
VMX_API void VMX_BGRXToUYVY (BYTE *pSrc, int srcStride, BYTE *pDst, int dstStride, VMX_SIZE size)
VMX_API int VMX_BGRXToUYVYConditional (BYTE *pSrc, BYTE *pSrcPrev, int srcStride, BYTE *pDst, int dstStride, VMX_SIZE size)
VMX_API float VMX_CalculatePSNR (BYTE *p1, BYTE *p2, int stride, int bytesPerPixel, VMX_SIZE sz)
VMX_API int VMX_GetThreads (VMX_INSTANCE *instance)
VMX_API void VMX_SetThreads (VMX_INSTANCE *instance, int numThreads)
VMX_API int VMX_Test (VMX_INSTANCE *instance, short *src, short *dst)
void VMX_ResetData (VMX_SLICE_DATA *s)
void VMX_ResetStream (VMX_INSTANCE *instance)

Variables

const int VMX_SLICE_HEIGHT = 16
const int VMX_QUALITY_COUNT = 25
const int VMX_MAX_PLANES = 4
const int VMX_DECODE_MATRIX_COUNT = 64
const int VMX_ENCODE_MATRIX_COUNT = 192

Macro Definition Documentation

◆ VMX_API

#define VMX_API   extern "C" __attribute__((visibility("default")))

Typedef Documentation

◆ buffer_t

typedef unsigned long long buffer_t

◆ BYTE

typedef unsigned char BYTE

Enumeration Type Documentation

◆ VMX_CODEC_FORMAT

Enumerator
VMX_CODEC_FORMAT_NONE 
VMX_CODEC_FORMAT_PROGRESSIVE 
VMX_CODEC_FORMAT_INTERLACED 
VMX_CODEC_FORMAT_EXTENDED 

◆ VMX_COLORSPACE

Defines currently supported color spaces used when converting between RGB and YUV Undefined = BT601 for SD (height < 720) and BT709 for HD (height >= 720)

Enumerator
VMX_COLORSPACE_UNDEFINED 
VMX_COLORSPACE_BT601 
VMX_COLORSPACE_BT709 

◆ VMX_ERR

enum VMX_ERR
Enumerator
VMX_ERR_OK 
VMX_ERR_UNKNOWN 
VMX_ERR_INVALID_CODEC_FORMAT 
VMX_ERR_INVALID_SLICE_COUNT 
VMX_ERR_BUFFER_OVERFLOW 
VMX_ERR_INVALID_INSTANCE 
VMX_ERR_INVALID_PARAMETERS 

◆ VMX_FORMAT

enum VMX_FORMAT
Enumerator
VMX_FORMAT_PROGRESSIVE 
VMX_FORMAT_INTERLACED 

◆ VMX_IMAGE_FORMAT

Enumerator
VMX_IMAGE_UYVY 
VMX_IMAGE_YUY2 
VMX_IMAGE_NV12 
VMX_IMAGE_YV12 
VMX_IMAGE_YUVPLANAR422 
VMX_IMAGE_BGRA 
VMX_IMAGE_BGRX 
VMX_IMAGE_UYVA 
VMX_IMAGE_P216 
VMX_IMAGE_PA16 

◆ VMX_PROFILE

Enumerator
VMX_PROFILE_DEFAULT 
VMX_PROFILE_LQ 
VMX_PROFILE_SQ 
VMX_PROFILE_HQ 
VMX_PROFILE_OMT_LQ 
VMX_PROFILE_OMT_SQ 
VMX_PROFILE_OMT_HQ 

Function Documentation

◆ VMX_BGRXToUYVY()

VMX_API void VMX_BGRXToUYVY ( BYTE * pSrc,
int srcStride,
BYTE * pDst,
int dstStride,
VMX_SIZE size )

Helper function to convert a BGRX image to UYVY. The destination buffer must be 64byte aligned.

Parameters
[in]pSrcThe source pixels in BGRA format. Alpha is ignored.
[in]srcStrideThe stride in bytes of each row of source pixels.
[in]pDstThe destination buffer. This must be 64byte aligned.
[in]dstStrideThe stride in bytes of each row of destination pixels.
[in]sizeThe dimensions of the pixels.

◆ VMX_BGRXToUYVYConditional()

VMX_API int VMX_BGRXToUYVYConditional ( BYTE * pSrc,
BYTE * pSrcPrev,
int srcStride,
BYTE * pDst,
int dstStride,
VMX_SIZE size )

Helper function to convert a BGRX image to UYVY.

Only changed pixels between pSrc and pSrcPrev will be copied.

pDst will be left untouched if no pixels have changed, and no conversion will occur.

The destination buffer must be 64byte aligned.

Parameters
[in]pSrcThe source pixels in BGRA format. Alpha is ignored.
[in]pSrcPrevThe previous source pixels in BGRA format. Alpha is ignored.
[in]srcStrideThe stride in bytes of each row of source pixels.
[in]pDstThe destination buffer. This must be 64byte aligned.
[in]dstStrideThe stride in bytes of each row of destination pixels.
[in]sizeThe dimensions of the pixels.
Returns
Returns 1 if any pixels have changed, 0 otherwise.

◆ VMX_CalculatePSNR()

VMX_API float VMX_CalculatePSNR ( BYTE * p1,
BYTE * p2,
int stride,
int bytesPerPixel,
VMX_SIZE sz )

Helper function to calculate the PSNR of two frames to assess image quality.

The first image should be the original image, and the second the compressed to compare.

◆ VMX_Create()

VMX_API VMX_INSTANCE * VMX_Create ( VMX_SIZE dimensions,
VMX_PROFILE profile,
VMX_COLORSPACE colorSpace )

Create a new instance of the codec.

Parameters
[in]dimensionsThe pixel size of the image. Supports a minimum dimension of 16x16 and a maximum of 7680x4320 (8K).
[in]profileSelect a profile to use when encoding.
[in]colorSpaceSpecify the color space to use when converting between RGB and YUV. Default is BT709.

◆ VMX_DecodeBGRA()

VMX_API VMX_ERR VMX_DecodeBGRA ( VMX_INSTANCE * instance,
BYTE * dst,
int stride )

Decode frame into BGRA buffer. BGRA is the same as ARGB32 and A8R8G8B8 on Windows

This should only be used where there is an alpha channel. Otherwise use BGRX.

Parameters
[in]instanceThe instance created using VMX_Create
[in]dstThe destination buffer to write the decoded frame to
[in]strideThe stride of the destination buffer in bytes

◆ VMX_DecodeBGRX()

VMX_API VMX_ERR VMX_DecodeBGRX ( VMX_INSTANCE * instance,
BYTE * dst,
int stride )

Decode frame into BGRX buffer. BGRX is the same as RGB32 and X8R8G8B8 on Windows

Parameters
[in]instanceThe instance created using VMX_Create
[in]dstThe destination buffer to write the decoded frame to
[in]strideThe stride of the destination buffer in bytes

◆ VMX_DecodeP216()

VMX_API VMX_ERR VMX_DecodeP216 ( VMX_INSTANCE * instance,
BYTE * dst,
int stride )

Decode frame into a P216 4:2:2 buffer.

This is a 16bit Y plane followed by an interlaved 16bit UV plane.

Only the most significant 10bits is valid, so the 6 least signifiant bits will be 0. Shifting the values to the right by 6 is sufficient to convert back to 10bit.

Parameters
[in]instanceThe instance created using VMX_Create
[in]dstThe destination buffer to write the decoded frame to
[in]strideThe stride of the destination buffer in bytes

◆ VMX_DecodePA16()

VMX_API VMX_ERR VMX_DecodePA16 ( VMX_INSTANCE * instance,
BYTE * dst,
int stride )

Decode frame into a PA16 4:2:2:4 buffer.

This is a 16bit Y plane followed by an interleaved 16bit UV plane followed by a 16bit alpha plane.

Only the most significant 10bits is valid, so the 6 least signifiant bits will be 0. Shifting the values to the right by 6 is sufficient to convert back to 10bit.

Parameters
[in]instanceThe instance created using VMX_Create
[in]dstThe destination buffer to write the decoded frame to
[in]strideThe stride of the destination buffer in bytes

◆ VMX_DecodePreviewBGRA()

VMX_API VMX_ERR VMX_DecodePreviewBGRA ( VMX_INSTANCE * instance,
BYTE * dst,
int stride )

Decodes a special 1/8th preview of the compressed image

This is calculated by dividing the width and height of the instance by 8 and then making sure the width is at least divisible by 2

Interlaced frames are a special case where the height is subtracted by 1 if not divisible by 2

Example 1920x1080 becomes 240x135 for progressive, 240x134 for interlaced.

Parameters
[in]instanceThe instance created using VMX_Create
[in]dstThe destination buffer
[in]strideThe stride in bytes of each row of pixels

◆ VMX_DecodePreviewBGRX()

VMX_API VMX_ERR VMX_DecodePreviewBGRX ( VMX_INSTANCE * instance,
BYTE * dst,
int stride )

Same as VMX_DecodePreviewBGRA except without alpha channel (alpha = 255)

Parameters
[in]instanceThe instance created using VMX_Create
[in]dstThe destination buffer
[in]strideThe stride in bytes of each row of pixels

◆ VMX_DecodePreviewUYVA()

VMX_API VMX_ERR VMX_DecodePreviewUYVA ( VMX_INSTANCE * instance,
BYTE * dst,
int stride )

Same as VMX_DecodePreviewBGRA except for UYVA output

Parameters
[in]instanceThe instance created using VMX_Create
[in]dstThe destination buffer
[in]strideThe stride in bytes of each row of pixels

◆ VMX_DecodePreviewUYVY()

VMX_API VMX_ERR VMX_DecodePreviewUYVY ( VMX_INSTANCE * instance,
BYTE * dst,
int stride )

Same as VMX_DecodePreviewBGRA except for UYVY output

Parameters
[in]instanceThe instance created using VMX_Create
[in]dstThe destination buffer
[in]strideThe stride in bytes of each row of pixels

◆ VMX_DecodePreviewYUY2()

VMX_API VMX_ERR VMX_DecodePreviewYUY2 ( VMX_INSTANCE * instance,
BYTE * dst,
int stride )

Same as VMX_DecodePreviewBGRA except for YUY2 output

Parameters
[in]instanceThe instance created using VMX_Create
[in]dstThe destination buffer
[in]strideThe stride in bytes of each row of pixels

◆ VMX_DecodeUYVA()

VMX_API VMX_ERR VMX_DecodeUYVA ( VMX_INSTANCE * instance,
BYTE * dst,
int stride )

Decode frame into a UYVA buffer. This is uyvy422 in FFmpeg, followed by an alpha plane with half the stride.

Parameters
[in]instanceThe instance created using VMX_Create
[in]dstThe destination buffer to write the decoded frame to
[in]strideThe stride of the destination buffer in bytes

◆ VMX_DecodeUYVY()

VMX_API VMX_ERR VMX_DecodeUYVY ( VMX_INSTANCE * instance,
BYTE * dst,
int stride )

Decode frame into a UYVY buffer. This is uyvy422 in FFmpeg

Parameters
[in]instanceThe instance created using VMX_Create
[in]dstThe destination buffer to write the decoded frame to
[in]strideThe stride of the destination buffer in bytes

◆ VMX_DecodeYUY2()

VMX_API VMX_ERR VMX_DecodeYUY2 ( VMX_INSTANCE * instance,
BYTE * dst,
int stride )

Decode frame into a YUY2 buffer. This is yuyv422 in FFmpeg

Parameters
[in]instanceThe instance created using VMX_Create
[in]dstThe destination buffer to write the decoded frame to
[in]strideThe stride of the destination buffer in bytes

◆ VMX_Destroy()

VMX_API void VMX_Destroy ( VMX_INSTANCE * instance)

Destroy and free up memory of instance created with VMX_Create

◆ VMX_EncodeBGRA()

VMX_API VMX_ERR VMX_EncodeBGRA ( VMX_INSTANCE * instance,
BYTE * src,
int stride,
int interlaced )

Encode a BGRA image. This is the same as the ARGB32 in DirectShow or A8R8G8B8 in Direct3D

The Alpha channel is included in the encoded image. If you do not require alpha use the BGRX functions instead.

Parameters
[in]instanceThe instance created using VMX_Create
[in]srcThe source pixels
[in]strideThe stride of the source pixels in bytes
[in]interlaced1 if interlaced, 0 if progressive

◆ VMX_EncodeBGRX()

VMX_API VMX_ERR VMX_EncodeBGRX ( VMX_INSTANCE * instance,
BYTE * src,
int stride,
int interlaced )

Encode a BGRX image. This is the same as the RGB32 in DirectShow or X8R8G8B8 in Direct3D

Parameters
[in]instanceThe instance created using VMX_Create
[in]srcThe source pixels
[in]strideThe stride of the source pixels in bytes
[in]interlaced1 if interlaced, 0 if progressive

◆ VMX_EncodeNV12()

VMX_API VMX_ERR VMX_EncodeNV12 ( VMX_INSTANCE * instance,
BYTE * srcY,
int srcStrideY,
BYTE * srcUV,
int srcStrideUV,
int interlaced )

Encode a NV12 image.

Parameters
[in]instanceThe instance created using VMX_Create
[in]srcYThe Y plane source pixels
[in]srcStrideYThe stride of the Y plane in bytes
[in]srcUVThe UV plane source pixels
[in]srcStrideUVThe stride of the UV plane in bytes
[in]interlaced1 if interlaced, 0 if progressive

◆ VMX_EncodeP216()

VMX_API VMX_ERR VMX_EncodeP216 ( VMX_INSTANCE * instance,
BYTE * src,
int stride,
int interlaced )

Encode a 4:2:2 P216 image.

This is a 16bit Y plane followed by an interleaved 16bit UV plane.

Only the most significant 10bits is valid, so the 6 least signifiant bits must be 0. Shifting 10-bit values to the left by 6 is sufficient.

Parameters
[in]instanceThe instance created using VMX_Create
[in]srcThe source pixels
[in]strideThe stride of the source pixels in bytes
[in]interlaced1 if interlaced, 0 if progressive

◆ VMX_EncodePA16()

VMX_API VMX_ERR VMX_EncodePA16 ( VMX_INSTANCE * instance,
BYTE * src,
int stride,
int interlaced )

Encode a 4:2:2:4 PA16 image.

This is a 16bit Y plane followed by an interleaved 16bit UV plane followed by a 16bit alpha plane.

Only the most significant 10bits is valid, so the 6 least signifiant bits must be 0. Shifting 10-bit values to the left by 6 is sufficient.

Parameters
[in]instanceThe instance created using VMX_Create
[in]srcThe source pixels
[in]strideThe stride of the source pixels in bytes
[in]interlaced1 if interlaced, 0 if progressive

◆ VMX_EncodePlanar()

VMX_API VMX_ERR VMX_EncodePlanar ( VMX_INSTANCE * instance,
int interlaced )

◆ VMX_EncodeUYVA()

VMX_API VMX_ERR VMX_EncodeUYVA ( VMX_INSTANCE * instance,
BYTE * src,
int stride,
int interlaced )

Encode a UYVA image.

This is a UYVY image followed immediately by an alpha plane with each line consisting of half the stride.

Parameters
[in]instanceThe instance created using VMX_Create
[in]srcThe source pixels
[in]strideThe stride of the source pixels in bytes
[in]interlaced1 if interlaced, 0 if progressive

◆ VMX_EncodeUYVY()

VMX_API VMX_ERR VMX_EncodeUYVY ( VMX_INSTANCE * instance,
BYTE * src,
int stride,
int interlaced )

Encode a UYVY image.

Parameters
[in]instanceThe instance created using VMX_Create
[in]srcThe source pixels
[in]strideThe stride of the source pixels in bytes
[in]interlaced1 if interlaced, 0 if progressive

◆ VMX_EncodeYUY2()

VMX_API VMX_ERR VMX_EncodeYUY2 ( VMX_INSTANCE * instance,
BYTE * src,
int stride,
int interlaced )

Encode a YUY2 image.

Parameters
[in]instanceThe instance created using VMX_Create
[in]srcThe source pixels
[in]strideThe stride of the source pixels in bytes
[in]interlaced1 if interlaced, 0 if progressive

◆ VMX_EncodeYV12()

VMX_API VMX_ERR VMX_EncodeYV12 ( VMX_INSTANCE * instance,
BYTE * srcY,
int srcStrideY,
BYTE * srcU,
int srcStrideU,
BYTE * srcV,
int srcStrideV,
int interlaced )

Encode a YV12 or I420 image.

Parameters
[in]instanceThe instance created using VMX_Create
[in]srcYThe Y plane source pixels
[in]srcStrideYThe stride of the Y plane in bytes
[in]srcUThe U plane source pixels
[in]srcStrideUThe stride of the U plane in bytes
[in]srcVThe V plane source pixels
[in]srcStrideVThe stride of the V plane in bytes
[in]interlaced1 if interlaced, 0 if progressive

◆ VMX_GetEncodedPreviewLength()

VMX_API int VMX_GetEncodedPreviewLength ( VMX_INSTANCE * instance)

Returns the portion of the compressed frame that is needed to decode a preview.

◆ VMX_GetEncodingParameters()

VMX_API void VMX_GetEncodingParameters ( VMX_INSTANCE * instance,
int * frameMin,
int * frameMax,
int * minQuality,
int * dcShift )

Get current internal encoding parameters.

Parameters
[in]instanceThe instance created using VMX_Create
[out]frameMinIf an encoded frame falls below this value, quality will be increased for next frame
[out]frameMaxIf an encoded frame is over this value, quality will be decreased for the next frame
[out]minQualityThe quality will not fall below this value regardless of resulting bitrate
[out]dcShiftDetermines the DC precision where 0= 11bit, 1 = 10bit, 2= 9bit, 3= 8bit

◆ VMX_GetQuality()

VMX_API int VMX_GetQuality ( VMX_INSTANCE * instance)

Retrieve the current quality setting used by the encoder

This is adjusted automatically on the fly to meet the bitrate requirements and will change from frame to frame

Parameters
[in]instanceThe instance created using VMX_Create
Returns
Returns the quality value

◆ VMX_GetThreads()

VMX_API int VMX_GetThreads ( VMX_INSTANCE * instance)

Get the number of threads currently configured for encoding/decoding. These are automatically set based on the dimensions/profile.

Parameters
[in]instanceThe instance created using VMX_Create

◆ VMX_LoadFrom()

VMX_API VMX_ERR VMX_LoadFrom ( VMX_INSTANCE * instance,
BYTE * data,
int dataLen )

Load a compressed frame from a buffer.

Parameters
[in]instanceThe instance created using VMX_Create
[in]dataThe compressed frame data
[in]dataLenThe length of the compressed frame data in bytes.

◆ VMX_ResetData()

void VMX_ResetData ( VMX_SLICE_DATA * s)

◆ VMX_ResetStream()

void VMX_ResetStream ( VMX_INSTANCE * instance)

◆ VMX_SaveTo()

VMX_API int VMX_SaveTo ( VMX_INSTANCE * instance,
BYTE * dst,
int maxLen )

Save a compressed frame to a buffer.

Parameters
[in]instanceThe instance created using VMX_Create
[in]dstThe buffer to write to
[in]maxLenThe maximum amount of data that can be written to the buffer. A buffer size of at least width*height*4 is recommended

◆ VMX_SetEncodingParameters()

VMX_API void VMX_SetEncodingParameters ( VMX_INSTANCE * instance,
int frameMin,
int frameMax,
int minQuality,
int dcShift )

Set internal encoding parameters to apply from the next frame.

This can be used to fine tune encoding or set custom bitrate targets.

Parameters
[in]instanceThe instance created using VMX_Create
[in]frameMinIf an encoded frame falls below this value, quality will be increased for next frame
[in]frameMaxIf an encoded frame is over this value, quality will be decreased for the next frame
[in]minQualityThe quality will not fall below this value regardless of resulting bitrate
[in]dcShiftDetermines the DC precision where 0= 11bit, 1 = 10bit, 2= 9bit, 3= 8bit

◆ VMX_SetQuality()

VMX_API void VMX_SetQuality ( VMX_INSTANCE * instance,
int q )

Set the quality to use for the next frame.

If set just before encoding a frame, will override the bitrate targeting.

Parameters
[in]instanceThe instance created using VMX_Create
[in]qThe quality value in the range of 0 (lowest quality) to 100 (highest quality).

◆ VMX_SetThreads()

VMX_API void VMX_SetThreads ( VMX_INSTANCE * instance,
int numThreads )

Set the number of threads for encoding/decoding.

Parameters
[in]instanceThe instance created using VMX_Create
[in]numThreadsThe number of threads to use. <= 0 is invalid and ignored.

◆ VMX_Test()

VMX_API int VMX_Test ( VMX_INSTANCE * instance,
short * src,
short * dst )

Variable Documentation

◆ VMX_DECODE_MATRIX_COUNT

const int VMX_DECODE_MATRIX_COUNT = 64

◆ VMX_ENCODE_MATRIX_COUNT

const int VMX_ENCODE_MATRIX_COUNT = 192

◆ VMX_MAX_PLANES

const int VMX_MAX_PLANES = 4

◆ VMX_QUALITY_COUNT

const int VMX_QUALITY_COUNT = 25

◆ VMX_SLICE_HEIGHT

const int VMX_SLICE_HEIGHT = 16