/** * * \file AvidDNxCodec.h * * \copyright * Copyright 2019 Avid Technology, Inc. * All rights reserved. * * \par License * The following programs are the sole property of Avid Technology, Inc., * and contain its proprietary and confidential information. * * \details mailto: partners@avid.com * */ #ifndef DNXCODECSDK_H #define DNXCODECSDK_H #define DNX_VERSION_MAJOR 2 #define DNX_VERSION_MINOR 6 #define DNX_VERSION_PATCH 1 #ifdef BUILD_NUMBER #define DNX_VERSION_BUILD BUILD_NUMBER #endif #ifndef DNX_VERSION_BUILD #define DNX_VERSION_BUILD 0 #endif #define DNX_VERSION_RELEASE 'r' #define DNX_VERSION_ALPHA 'a' #define DNX_VERSION_BETA 'b' #define DNX_VERSION_TYPE DNX_VERSION_RELEASE /** Default values for SHORT_2_14 conversions params */ #define DNX_DEFAULT_SHORT_2_14_BLACK_POINT 4096 #define DNX_DEFAULT_SHORT_2_14_WHITE_POINT 60160 #define DNX_DEFAULT_CHROMA_SHORT_2_14_EXCURSION 28672 /** No error. */ #define DNX_NO_ERROR 0 /** Exception has occured. */ #define DNX_EXCEPTION_ERROR -1000 /** Invalid Compression ID. */ #define DNX_INVALID_COMPRESSION_ID_ERROR -1001 /** Invalid UncompInfo. */ #define DNX_INVALID_UNCOMPINFO_ERROR -1002 /** Not enough data. */ #define DNX_NEED_MORE_DATA_ERROR -1003 /** Failed to initialize. */ #define DNX_NOT_INITIALIZED_ERROR -1004 /** Invalid value. */ #define DNX_INVALID_VALUE_ERROR -1005 /** Not sufficient input precision */ #define DNX_NOT_SUFFICIENT_INPUT_PRECISION -1006 /** User data label is wrong */ #define DNX_WRONG_USER_DATA_LABEL -1007 /** User data size is too big */ #define DNX_USER_DATA_SIZE_IS_TOO_BIG -1008 /** Data is invalid */ #define DNX_INVALID_DATA -1009 /** Incompatible param version. */ #define DNX_INCOMPATIBLE_PARAM_VERSION -1010 /** Invalid lossless alpha usage. */ #define DNX_INVALID_LOSSLESS_ALPHA_USAGE -1011 /** Usage of V3 compressions for V1/2 workflows. */ #define DNX_FORBIDDEN_WORKFLOW -1012 /** Wrong usage alpha options in codec settings. */ #define DNX_INVALID_ALPHA_USAGE -1013 #ifdef __cplusplus extern "C" { #endif /** The Compression ID. */ typedef enum DNX_CompressionID_t { DNX_HQX_1080p_COMPRESSION_ID = 1235, ///< Compression ID 1235. DNX_SQ_1080p_COMPRESSION_ID = 1237, ///< Compression ID 1237. DNX_HQ_1080p_COMPRESSION_ID = 1238, ///< Compression ID 1238. DNX_HQX_720p_COMPRESSION_ID = 1250, ///< Compression ID 1250. DNX_HQ_720p_COMPRESSION_ID = 1251, ///< Compression ID 1251. DNX_SQ_720p_COMPRESSION_ID = 1252, ///< Compression ID 1252. DNX_HQX_1080i_COMPRESSION_ID = 1241, ///< Compression ID 1241. DNX_SQ_1080i_COMPRESSION_ID = 1242, ///< Compression ID 1242. DNX_HQ_1080i_COMPRESSION_ID = 1243, ///< Compression ID 1243. DNX_HQ_TR_1080i_COMPRESSION_ID = 1244, ///< Compression ID 1244. Thin raster - stored as 1440 width x 1080 height DNX_LB_1080p_COMPRESSION_ID = 1253, ///< Compression ID 1253. DNX_444_1080p_COMPRESSION_ID = 1256, ///< Compression ID 1256. DNX_SQ_TR_720p_COMPRESSION_ID = 1258, ///< Compression ID 1258. Thin raster - stored as 960 width x 720 height DNX_SQ_TR_1080p_COMPRESSION_ID = 1259, ///< Compression ID 1259. Thin raster - stored as 1440 width x 1080 height DNX_SQ_TR_1080i_COMPRESSION_ID = 1260, ///< Compression ID 1260. Thin raster - stored as 1440 width x 1080 height DNX_444_COMPRESSION_ID = 1270, ///< Compression ID 1270. DNX_HQX_COMPRESSION_ID = 1271, ///< Compression ID 1271. DNX_HQ_COMPRESSION_ID = 1272, ///< Compression ID 1272. DNX_SQ_COMPRESSION_ID = 1273, ///< Compression ID 1273. DNX_LB_COMPRESSION_ID = 1274 ///< Compression ID 1274. } DNX_CompressionID_t; /** The uncompressed Color Component Order. */ typedef enum DNX_ColorComponentOrder_t { DNX_CCO_INVALID = 0x00000000 ///< Invalid value ,DNX_CCO_YCbYCr_NoA = 0x00000001 ///< Y0CbY1Cr ,DNX_CCO_CbYCrY_NoA = 0x00000002 ///< CbY0CrY1 ,DNX_CCO_ARGB_Interleaved = 0x00000004 ///< ARGB ,DNX_CCO_BGRA_Interleaved = 0x00000008 ///< BGRA ,DNX_CCO_RGB_NoA = 0x00000040 ///< RGB ,DNX_CCO_BGR_NoA = 0x00000080 ///< BGR ,DNX_CCO_RGBA_Interleaved = 0x00000800 ///< RGBA ,DNX_CCO_ABGR_Interleaved = 0x00001000 ///< ABGR ,DNX_CCO_YCbCr_Interleaved = 0x00002000 ///< YCbCr 444 ,DNX_CCO_Ch1Ch2Ch3 = 0x00004000 ///< Arbitrary 444 subsampled color components for any colorspace other than RGB and YCbCr ,DNX_CCO_Ch1Ch2Ch1Ch3 = 0x00008000 ///< Arbitrary 422 subsampled color components for any colorspace other than RGB and YCbCr with not subsampled channel first ,DNX_CCO_Ch2Ch1Ch3Ch1 = 0x00010000 ///< Arbitrary 422 subsampled color components for any colorspace other than RGB and YCbCr with subsampled channel first ,DNX_CCO_YCbCr_Planar = 0x00020000 ///< YCbCr 420 stored in planar form. Y followed by Cb followed by Cr ,DNX_CCO_CbYACrYA_Interleaved= 0x00040000 ///< YCbCrA 4224 ,DNX_CCO_CbYCrA_Interleaved = 0x00080000 ///< YCbCrA 4444 ,DNX_CCO_YCbCrA_Planar = 0x00100000 ///< YCbCrA 4204 stored in planar form. Y followed by Cb followed by Cr followed by A ,DNX_CCO_Ch1Ch2Ch3A = 0x00200000 ///< Arbitrary 4444 subsampled color components for any colorspace other than RGB and YCbCr with Alpha (Alpha channel last) ,DNX_CCO_Ch3Ch2Ch1A = 0x00400000 ///< Arbitrary 4444 subsampled color components for any colorspace other than RGB and YCbCr with Alpha with reversed channel order (Alpha channel last) ,DNX_CCO_ACh1Ch2Ch3 = 0x00800000 ///< Arbitrary 4444 subsampled color components for any colorspace other than RGB and YCbCr with Alpha (Alpha channel first) ,DNX_CCO_Ch2Ch1ACh3Ch1A = 0x01000000 ///< Arbitrary 4224 subsampled color components for any colorspace other than RGB and YCbCr with not subsampled channel first with Alpha ,DNX_CCO_CbYCrY_A = 0x02000000 ///< YCbCrA 4224 mixed-planar (separate Alpha plane) } DNX_ColorComponentOrder_t; /** The signal standard. */ typedef enum DNX_SignalStandard_t { DNX_SS_INVALID = 0x000 ///< Invalid value ,DNX_SS_Interlaced = 0x001 ///< HD Interlaced. Refers to SMPTE standard 274M for interlaced material. ,DNX_SS_Progressive = 0x002 ///< HD Progressive. Refers to all SMPTE standards for progressive material. } DNX_SignalStandard_t; /** The type representation of the component data. */ typedef enum DNX_ComponentType_t { DNX_CT_INVALID = 0x000 ///< Invalid value ,DNX_CT_UCHAR = 0x001 ///< 8 bit ,DNX_CT_USHORT_10_6 = 0x004 ///< 10 bit ,DNX_CT_SHORT_2_14 = 0x008 ///< Fixed point ,DNX_CT_SHORT = 0x010 ///< 16 bit. Premultiplied by 257. Byte ordering is machine dependent. ,DNX_CT_10Bit_2_8 = 0x040 ///< 10 bit in 2_8 format. Byte ordering is fixed. This is to be used with 10-bit 4:2:2 YCbCr components. ,DNX_CT_V210 = 0x400 ///< Apple's V210 ,DNX_CT_USHORT_12_4 = 0x20000 ///< 12 bit } DNX_ComponentType_t; /** The raster geometry of the uncompressed buffer. One of the characteristics defined by the raster geometry type is the dimensions of the raster. */ typedef enum DNX_RasterGeometryType_t { DNX_RGT_INVALID = 0x0 ///< Invalid value ,DNX_RGT_Display = 0x1 ///< Raster Geometry type is equal to the display size . Should be used to compress 1920 x 1080 frames using thin raster Compression IDs. ,DNX_RGT_NativeCompressed = 0x4 ///< Raster Geometry type is native to the codec. Should be used to compress 1440 x 1080 frames using thin raster Compression IDs. } DNX_RasterGeometryType_t; /** The decode resolution size. */ typedef enum DNX_DecodeResolution_t { DNX_DR_INVALID = 0x0 ///< Invalid value ,DNX_DR_Full = 0x1 ///< Full resolution ,DNX_DR_Half = 0x2 ///< Half resolution ,DNX_DR_Quarter = 0x4 ///< Quarter resolution } DNX_DecodeResolution_t; /** The buffer field order. */ typedef enum DNX_BufferFieldOrder_t { DNX_BFO_INVALID = 0x000 ///< Invalid value ,DNX_BFO_Merged_F1_First = 0x001 ///< First line of F1 is first in memory, followed by first line of F2 ,DNX_BFO_Split_F1_First = 0x004 ///< All lines of F1 come first, followed by all lines of F2 ,DNX_BFO_F1_Only = 0x010 ///< Only lines from F1 are present ,DNX_BFO_F2_Only = 0x020 ///< Only lines from F2 are present ,DNX_BFO_Progressive = 0x040 ///< All lines of the progressive frame are stored in order ,DNX_BFO_Prog_Odd_Only = 0x200 ///< Only odd lines of the progressive frame ,DNX_BFO_Prog_Even_Only = 0x400 ///< Only even lines of the progressive frame } DNX_BufferFieldOrder_t; /** The color volume. */ typedef enum DNX_ColorVolume_t { DNX_CV_INVALID = 0x00 ///< Invalid value ,DNX_CV_709 = 0x01 ///< Rec. 709 ,DNX_CV_2020 = 0x02 ///< Non-constant luminance Rec. 2020 ,DNX_CV_2020c = 0x04 ///< Constant luminance Rec. 2020 ,DNX_CV_OutOfBand = 0x08 ///< Ay other } DNX_ColorVolume_t; /** The color format. */ typedef enum DNX_ColorFormat_t { DNX_CF_INVALID = 0x00 ///< Invalid value ,DNX_CF_YCbCr = 0x01 ///< YUV ,DNX_CF_RGB = 0x02 ///< RGB } DNX_ColorFormat_t; /** The subsampling. */ typedef enum DNX_SubSampling_t { DNX_SSC_INVALID = 0x00 ///< Invalid value ,DNX_SSC_422 = 0x01 ///< 4:2:2 ,DNX_SSC_444 = 0x02 ///< 4:4:4 ,DNX_SSC_420 = 0x04 ///< 4:2:0 } DNX_SubSampling_t; #pragma pack(push, 1) //Set alignment for structs below /** The compressed params. structSize Size of struct in bytes width Width of the raster, ignored for not RI rasters. height Height of the raster, ignored for not RI rasters. compressionID Enum representing the compression bitrate and format. colorVolume Color volume (DNX_CV_709 etc). colorFormat Color format (YCbCr/RGB). subSampling Subsampling, used only for RI compressions, LB-HQX, might be DNX_SSC_422 or DNX_SSC_420. depth Workflow bitdepth, used only for RI compressions, might be 10/12 bit for DNX_444_COMPRESSION_ID, DNX_HQX_COMPRESSION_ID and 8/10/12 bit for DNX_HQ_COMPRESSION_ID, DNX_SQ_COMPRESSION_ID, DNX_LB_COMPRESSION_ID. Not the same as SBD field (7.2.3 of ST 2019-1) in bit-stream. PARC, PARN Pixel aspect ratio as defined in VC-3, might be nonzero only for RI compressions. In this case 0