filmcraft/crates/platform/src/nvenc/abi_tests.rs

502 lines
48 KiB
Rust

//! The NVENC FFI structures against the C compiler's view of `nvEncodeAPI.h` (API 12.1): sizes,
//! alignments, field offsets, constants and GUIDs. Generated by running a C program (built with
//! MSVC from the NVIDIA header) that prints them; the header itself is not in this repository.
//! To regenerate, put NVIDIA's MIT-licensed `nvEncodeAPI.h` 12.1 in `ffnvcodec/` next to a program
//! printing `sizeof` / `alignof` / `offsetof` of the structures of `src/nvenc/ffi.rs`, the constants
//! and GUIDs it uses and, for the bit-fields of the `flags` words (`offsetof` cannot take those), the
//! word with that one field set (see docs/testing.md). H.264 and HEVC are both covered.
//!
//! The expectations were generated with MSVC (Windows x64, LLP64) and also hold on Linux x86_64
//! (LP64), where these tests run too: every field the structures use is a fixed-width integer
//! (`uint32_t`, `int32_t`, `uint64_t`, ...), `int` / an enum (32 bits on both), a pointer (64 bits on
//! both) or a GUID (four fixed-width members, 16 bytes, aligned to 4). None is a `long` /
//! `unsigned long`, the one C type whose size differs between the two (32 bits on Windows, 64 on
//! Linux). The `flags` bit-fields are all `uint32_t` fields of one `uint32_t` word, which MSVC and
//! GCC / Clang lay out the same way (from the least significant bit) on x86_64.
#![allow(clippy::unreadable_literal)]
use super::ffi::*;
use std::mem::{align_of, offset_of, size_of};
#[test]
fn layouts_match_the_header() {
assert_eq!(
(size_of::<NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS>(), align_of::<NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS>()),
(1552, 8),
"NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS"
);
assert_eq!(offset_of!(NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS, version), 0, "NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS.version");
assert_eq!(offset_of!(NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS, deviceType), 4, "NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS.deviceType");
assert_eq!(offset_of!(NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS, device), 8, "NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS.device");
assert_eq!(offset_of!(NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS, reserved), 16, "NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS.reserved");
assert_eq!(offset_of!(NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS, apiVersion), 24, "NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS.apiVersion");
assert_eq!(offset_of!(NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS, reserved1), 28, "NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS.reserved1");
assert_eq!(offset_of!(NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS, reserved2), 1040, "NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS.reserved2");
assert_eq!((size_of::<NV_ENC_CAPS_PARAM>(), align_of::<NV_ENC_CAPS_PARAM>()), (256, 4), "NV_ENC_CAPS_PARAM");
assert_eq!(offset_of!(NV_ENC_CAPS_PARAM, version), 0, "NV_ENC_CAPS_PARAM.version");
assert_eq!(offset_of!(NV_ENC_CAPS_PARAM, capsToQuery), 4, "NV_ENC_CAPS_PARAM.capsToQuery");
assert_eq!(offset_of!(NV_ENC_CAPS_PARAM, reserved), 8, "NV_ENC_CAPS_PARAM.reserved");
assert_eq!((size_of::<NV_ENC_QP>(), align_of::<NV_ENC_QP>()), (12, 4), "NV_ENC_QP");
assert_eq!(offset_of!(NV_ENC_QP, qpInterP), 0, "NV_ENC_QP.qpInterP");
assert_eq!(offset_of!(NV_ENC_QP, qpInterB), 4, "NV_ENC_QP.qpInterB");
assert_eq!(offset_of!(NV_ENC_QP, qpIntra), 8, "NV_ENC_QP.qpIntra");
assert_eq!((size_of::<NV_ENC_RC_PARAMS>(), align_of::<NV_ENC_RC_PARAMS>()), (128, 4), "NV_ENC_RC_PARAMS");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, version), 0, "NV_ENC_RC_PARAMS.version");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, rateControlMode), 4, "NV_ENC_RC_PARAMS.rateControlMode");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, constQP), 8, "NV_ENC_RC_PARAMS.constQP");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, averageBitRate), 20, "NV_ENC_RC_PARAMS.averageBitRate");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, maxBitRate), 24, "NV_ENC_RC_PARAMS.maxBitRate");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, vbvBufferSize), 28, "NV_ENC_RC_PARAMS.vbvBufferSize");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, vbvInitialDelay), 32, "NV_ENC_RC_PARAMS.vbvInitialDelay");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, minQP), 40, "NV_ENC_RC_PARAMS.minQP");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, maxQP), 52, "NV_ENC_RC_PARAMS.maxQP");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, initialRCQP), 64, "NV_ENC_RC_PARAMS.initialRCQP");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, temporallayerIdxMask), 76, "NV_ENC_RC_PARAMS.temporallayerIdxMask");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, temporalLayerQP), 80, "NV_ENC_RC_PARAMS.temporalLayerQP");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, targetQuality), 88, "NV_ENC_RC_PARAMS.targetQuality");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, targetQualityLSB), 89, "NV_ENC_RC_PARAMS.targetQualityLSB");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, lookaheadDepth), 90, "NV_ENC_RC_PARAMS.lookaheadDepth");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, lowDelayKeyFrameScale), 92, "NV_ENC_RC_PARAMS.lowDelayKeyFrameScale");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, yDcQPIndexOffset), 93, "NV_ENC_RC_PARAMS.yDcQPIndexOffset");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, uDcQPIndexOffset), 94, "NV_ENC_RC_PARAMS.uDcQPIndexOffset");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, vDcQPIndexOffset), 95, "NV_ENC_RC_PARAMS.vDcQPIndexOffset");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, qpMapMode), 96, "NV_ENC_RC_PARAMS.qpMapMode");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, multiPass), 100, "NV_ENC_RC_PARAMS.multiPass");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, alphaLayerBitrateRatio), 104, "NV_ENC_RC_PARAMS.alphaLayerBitrateRatio");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, cbQPIndexOffset), 108, "NV_ENC_RC_PARAMS.cbQPIndexOffset");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, crQPIndexOffset), 109, "NV_ENC_RC_PARAMS.crQPIndexOffset");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, reserved2), 110, "NV_ENC_RC_PARAMS.reserved2");
assert_eq!(offset_of!(NV_ENC_RC_PARAMS, reserved), 112, "NV_ENC_RC_PARAMS.reserved");
assert_eq!(
(size_of::<NV_ENC_CONFIG_H264_VUI_PARAMETERS>(), align_of::<NV_ENC_CONFIG_H264_VUI_PARAMETERS>()),
(112, 4),
"NV_ENC_CONFIG_H264_VUI_PARAMETERS"
);
assert_eq!(offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, overscanInfoPresentFlag), 0, "NV_ENC_CONFIG_H264_VUI_PARAMETERS.overscanInfoPresentFlag");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, overscanInfo), 4, "NV_ENC_CONFIG_H264_VUI_PARAMETERS.overscanInfo");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, videoSignalTypePresentFlag), 8, "NV_ENC_CONFIG_H264_VUI_PARAMETERS.videoSignalTypePresentFlag");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, videoFormat), 12, "NV_ENC_CONFIG_H264_VUI_PARAMETERS.videoFormat");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, videoFullRangeFlag), 16, "NV_ENC_CONFIG_H264_VUI_PARAMETERS.videoFullRangeFlag");
assert_eq!(
offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, colourDescriptionPresentFlag),
20,
"NV_ENC_CONFIG_H264_VUI_PARAMETERS.colourDescriptionPresentFlag"
);
assert_eq!(offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, colourPrimaries), 24, "NV_ENC_CONFIG_H264_VUI_PARAMETERS.colourPrimaries");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, transferCharacteristics), 28, "NV_ENC_CONFIG_H264_VUI_PARAMETERS.transferCharacteristics");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, colourMatrix), 32, "NV_ENC_CONFIG_H264_VUI_PARAMETERS.colourMatrix");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, chromaSampleLocationFlag), 36, "NV_ENC_CONFIG_H264_VUI_PARAMETERS.chromaSampleLocationFlag");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, chromaSampleLocationTop), 40, "NV_ENC_CONFIG_H264_VUI_PARAMETERS.chromaSampleLocationTop");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, chromaSampleLocationBot), 44, "NV_ENC_CONFIG_H264_VUI_PARAMETERS.chromaSampleLocationBot");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, bitstreamRestrictionFlag), 48, "NV_ENC_CONFIG_H264_VUI_PARAMETERS.bitstreamRestrictionFlag");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, timingInfoPresentFlag), 52, "NV_ENC_CONFIG_H264_VUI_PARAMETERS.timingInfoPresentFlag");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, numUnitInTicks), 56, "NV_ENC_CONFIG_H264_VUI_PARAMETERS.numUnitInTicks");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, timeScale), 60, "NV_ENC_CONFIG_H264_VUI_PARAMETERS.timeScale");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264_VUI_PARAMETERS, reserved), 64, "NV_ENC_CONFIG_H264_VUI_PARAMETERS.reserved");
assert_eq!((size_of::<NV_ENC_CONFIG_H264>(), align_of::<NV_ENC_CONFIG_H264>()), (1792, 8), "NV_ENC_CONFIG_H264");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, level), 4, "NV_ENC_CONFIG_H264.level");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, idrPeriod), 8, "NV_ENC_CONFIG_H264.idrPeriod");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, separateColourPlaneFlag), 12, "NV_ENC_CONFIG_H264.separateColourPlaneFlag");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, disableDeblockingFilterIDC), 16, "NV_ENC_CONFIG_H264.disableDeblockingFilterIDC");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, numTemporalLayers), 20, "NV_ENC_CONFIG_H264.numTemporalLayers");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, spsId), 24, "NV_ENC_CONFIG_H264.spsId");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, ppsId), 28, "NV_ENC_CONFIG_H264.ppsId");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, adaptiveTransformMode), 32, "NV_ENC_CONFIG_H264.adaptiveTransformMode");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, fmoMode), 36, "NV_ENC_CONFIG_H264.fmoMode");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, bdirectMode), 40, "NV_ENC_CONFIG_H264.bdirectMode");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, entropyCodingMode), 44, "NV_ENC_CONFIG_H264.entropyCodingMode");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, stereoMode), 48, "NV_ENC_CONFIG_H264.stereoMode");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, intraRefreshPeriod), 52, "NV_ENC_CONFIG_H264.intraRefreshPeriod");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, intraRefreshCnt), 56, "NV_ENC_CONFIG_H264.intraRefreshCnt");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, maxNumRefFrames), 60, "NV_ENC_CONFIG_H264.maxNumRefFrames");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, sliceMode), 64, "NV_ENC_CONFIG_H264.sliceMode");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, sliceModeData), 68, "NV_ENC_CONFIG_H264.sliceModeData");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, h264VUIParameters), 72, "NV_ENC_CONFIG_H264.h264VUIParameters");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, ltrNumFrames), 184, "NV_ENC_CONFIG_H264.ltrNumFrames");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, ltrTrustMode), 188, "NV_ENC_CONFIG_H264.ltrTrustMode");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, chromaFormatIDC), 192, "NV_ENC_CONFIG_H264.chromaFormatIDC");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, maxTemporalLayers), 196, "NV_ENC_CONFIG_H264.maxTemporalLayers");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, useBFramesAsRef), 200, "NV_ENC_CONFIG_H264.useBFramesAsRef");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, numRefL0), 204, "NV_ENC_CONFIG_H264.numRefL0");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, numRefL1), 208, "NV_ENC_CONFIG_H264.numRefL1");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, reserved1), 212, "NV_ENC_CONFIG_H264.reserved1");
assert_eq!(offset_of!(NV_ENC_CONFIG_H264, reserved2), 1280, "NV_ENC_CONFIG_H264.reserved2");
assert_eq!(
(size_of::<NV_ENC_CONFIG_HEVC_VUI_PARAMETERS>(), align_of::<NV_ENC_CONFIG_HEVC_VUI_PARAMETERS>()),
(112, 4),
"NV_ENC_CONFIG_HEVC_VUI_PARAMETERS"
);
// The header typedefs the HEVC VUI to the H.264 one; pin the fields session.rs writes, both
// inside the VUI and where they land in NV_ENC_CONFIG_HEVC (hevcVUIParameters at 64), so a
// binding mismatch cannot hide behind the typedef (#442: HEVC timing came out reversed).
for (field, offset, name) in [
(offset_of!(NV_ENC_CONFIG_HEVC_VUI_PARAMETERS, videoSignalTypePresentFlag), 8, "videoSignalTypePresentFlag"),
(offset_of!(NV_ENC_CONFIG_HEVC_VUI_PARAMETERS, videoFormat), 12, "videoFormat"),
(offset_of!(NV_ENC_CONFIG_HEVC_VUI_PARAMETERS, videoFullRangeFlag), 16, "videoFullRangeFlag"),
(offset_of!(NV_ENC_CONFIG_HEVC_VUI_PARAMETERS, colourDescriptionPresentFlag), 20, "colourDescriptionPresentFlag"),
(offset_of!(NV_ENC_CONFIG_HEVC_VUI_PARAMETERS, colourPrimaries), 24, "colourPrimaries"),
(offset_of!(NV_ENC_CONFIG_HEVC_VUI_PARAMETERS, transferCharacteristics), 28, "transferCharacteristics"),
(offset_of!(NV_ENC_CONFIG_HEVC_VUI_PARAMETERS, colourMatrix), 32, "colourMatrix"),
(offset_of!(NV_ENC_CONFIG_HEVC_VUI_PARAMETERS, timingInfoPresentFlag), 52, "timingInfoPresentFlag"),
(offset_of!(NV_ENC_CONFIG_HEVC_VUI_PARAMETERS, numUnitInTicks), 56, "numUnitInTicks"),
(offset_of!(NV_ENC_CONFIG_HEVC_VUI_PARAMETERS, timeScale), 60, "timeScale"),
(offset_of!(NV_ENC_CONFIG_HEVC_VUI_PARAMETERS, reserved), 64, "reserved"),
] {
assert_eq!(field, offset, "NV_ENC_CONFIG_HEVC_VUI_PARAMETERS.{name}");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, hevcVUIParameters) + field, 64 + offset, "NV_ENC_CONFIG_HEVC.hevcVUIParameters.{name}");
}
assert_eq!((size_of::<NV_ENC_CONFIG_HEVC>(), align_of::<NV_ENC_CONFIG_HEVC>()), (1560, 8), "NV_ENC_CONFIG_HEVC");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, level), 0, "NV_ENC_CONFIG_HEVC.level");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, tier), 4, "NV_ENC_CONFIG_HEVC.tier");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, minCUSize), 8, "NV_ENC_CONFIG_HEVC.minCUSize");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, maxCUSize), 12, "NV_ENC_CONFIG_HEVC.maxCUSize");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, idrPeriod), 20, "NV_ENC_CONFIG_HEVC.idrPeriod");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, intraRefreshPeriod), 24, "NV_ENC_CONFIG_HEVC.intraRefreshPeriod");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, intraRefreshCnt), 28, "NV_ENC_CONFIG_HEVC.intraRefreshCnt");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, maxNumRefFramesInDPB), 32, "NV_ENC_CONFIG_HEVC.maxNumRefFramesInDPB");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, ltrNumFrames), 36, "NV_ENC_CONFIG_HEVC.ltrNumFrames");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, vpsId), 40, "NV_ENC_CONFIG_HEVC.vpsId");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, spsId), 44, "NV_ENC_CONFIG_HEVC.spsId");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, ppsId), 48, "NV_ENC_CONFIG_HEVC.ppsId");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, sliceMode), 52, "NV_ENC_CONFIG_HEVC.sliceMode");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, sliceModeData), 56, "NV_ENC_CONFIG_HEVC.sliceModeData");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, maxTemporalLayersMinus1), 60, "NV_ENC_CONFIG_HEVC.maxTemporalLayersMinus1");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, hevcVUIParameters), 64, "NV_ENC_CONFIG_HEVC.hevcVUIParameters");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, ltrTrustMode), 176, "NV_ENC_CONFIG_HEVC.ltrTrustMode");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, useBFramesAsRef), 180, "NV_ENC_CONFIG_HEVC.useBFramesAsRef");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, numRefL0), 184, "NV_ENC_CONFIG_HEVC.numRefL0");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, numRefL1), 188, "NV_ENC_CONFIG_HEVC.numRefL1");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, reserved1), 192, "NV_ENC_CONFIG_HEVC.reserved1");
assert_eq!(offset_of!(NV_ENC_CONFIG_HEVC, reserved2), 1048, "NV_ENC_CONFIG_HEVC.reserved2");
assert_eq!((size_of::<NV_ENC_CODEC_CONFIG>(), align_of::<NV_ENC_CODEC_CONFIG>()), (1792, 8), "NV_ENC_CODEC_CONFIG");
assert_eq!(offset_of!(NV_ENC_CODEC_CONFIG, h264Config), 0, "NV_ENC_CODEC_CONFIG.h264Config");
assert_eq!(offset_of!(NV_ENC_CODEC_CONFIG, reserved), 0, "NV_ENC_CODEC_CONFIG.reserved");
assert_eq!(offset_of!(NV_ENC_CODEC_CONFIG, hevcConfig), 0, "NV_ENC_CODEC_CONFIG.hevcConfig");
assert_eq!((size_of::<NV_ENC_CONFIG>(), align_of::<NV_ENC_CONFIG>()), (3584, 8), "NV_ENC_CONFIG");
assert_eq!(offset_of!(NV_ENC_CONFIG, version), 0, "NV_ENC_CONFIG.version");
assert_eq!(offset_of!(NV_ENC_CONFIG, profileGUID), 4, "NV_ENC_CONFIG.profileGUID");
assert_eq!(offset_of!(NV_ENC_CONFIG, gopLength), 20, "NV_ENC_CONFIG.gopLength");
assert_eq!(offset_of!(NV_ENC_CONFIG, frameIntervalP), 24, "NV_ENC_CONFIG.frameIntervalP");
assert_eq!(offset_of!(NV_ENC_CONFIG, monoChromeEncoding), 28, "NV_ENC_CONFIG.monoChromeEncoding");
assert_eq!(offset_of!(NV_ENC_CONFIG, frameFieldMode), 32, "NV_ENC_CONFIG.frameFieldMode");
assert_eq!(offset_of!(NV_ENC_CONFIG, mvPrecision), 36, "NV_ENC_CONFIG.mvPrecision");
assert_eq!(offset_of!(NV_ENC_CONFIG, rcParams), 40, "NV_ENC_CONFIG.rcParams");
assert_eq!(offset_of!(NV_ENC_CONFIG, encodeCodecConfig), 168, "NV_ENC_CONFIG.encodeCodecConfig");
assert_eq!(offset_of!(NV_ENC_CONFIG, reserved), 1960, "NV_ENC_CONFIG.reserved");
assert_eq!(offset_of!(NV_ENC_CONFIG, reserved2), 3072, "NV_ENC_CONFIG.reserved2");
assert_eq!((size_of::<NV_ENC_PRESET_CONFIG>(), align_of::<NV_ENC_PRESET_CONFIG>()), (5128, 8), "NV_ENC_PRESET_CONFIG");
assert_eq!(offset_of!(NV_ENC_PRESET_CONFIG, version), 0, "NV_ENC_PRESET_CONFIG.version");
assert_eq!(offset_of!(NV_ENC_PRESET_CONFIG, presetCfg), 8, "NV_ENC_PRESET_CONFIG.presetCfg");
assert_eq!(offset_of!(NV_ENC_PRESET_CONFIG, reserved1), 3592, "NV_ENC_PRESET_CONFIG.reserved1");
assert_eq!(offset_of!(NV_ENC_PRESET_CONFIG, reserved2), 4616, "NV_ENC_PRESET_CONFIG.reserved2");
assert_eq!(
(size_of::<NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE>(), align_of::<NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE>()),
(16, 4),
"NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE"
);
assert_eq!(offset_of!(NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE, reserved1), 4, "NVENC_EXTERNAL_ME_HINT_COUNTS_PER_BLOCKTYPE.reserved1");
assert_eq!((size_of::<NV_ENC_INITIALIZE_PARAMS>(), align_of::<NV_ENC_INITIALIZE_PARAMS>()), (1808, 8), "NV_ENC_INITIALIZE_PARAMS");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, version), 0, "NV_ENC_INITIALIZE_PARAMS.version");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, encodeGUID), 4, "NV_ENC_INITIALIZE_PARAMS.encodeGUID");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, presetGUID), 20, "NV_ENC_INITIALIZE_PARAMS.presetGUID");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, encodeWidth), 36, "NV_ENC_INITIALIZE_PARAMS.encodeWidth");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, encodeHeight), 40, "NV_ENC_INITIALIZE_PARAMS.encodeHeight");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, darWidth), 44, "NV_ENC_INITIALIZE_PARAMS.darWidth");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, darHeight), 48, "NV_ENC_INITIALIZE_PARAMS.darHeight");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, frameRateNum), 52, "NV_ENC_INITIALIZE_PARAMS.frameRateNum");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, frameRateDen), 56, "NV_ENC_INITIALIZE_PARAMS.frameRateDen");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, enableEncodeAsync), 60, "NV_ENC_INITIALIZE_PARAMS.enableEncodeAsync");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, enablePTD), 64, "NV_ENC_INITIALIZE_PARAMS.enablePTD");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, privDataSize), 72, "NV_ENC_INITIALIZE_PARAMS.privDataSize");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, privData), 80, "NV_ENC_INITIALIZE_PARAMS.privData");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, encodeConfig), 88, "NV_ENC_INITIALIZE_PARAMS.encodeConfig");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, maxEncodeWidth), 96, "NV_ENC_INITIALIZE_PARAMS.maxEncodeWidth");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, maxEncodeHeight), 100, "NV_ENC_INITIALIZE_PARAMS.maxEncodeHeight");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, maxMEHintCountsPerBlock), 104, "NV_ENC_INITIALIZE_PARAMS.maxMEHintCountsPerBlock");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, tuningInfo), 136, "NV_ENC_INITIALIZE_PARAMS.tuningInfo");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, bufferFormat), 140, "NV_ENC_INITIALIZE_PARAMS.bufferFormat");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, numStateBuffers), 144, "NV_ENC_INITIALIZE_PARAMS.numStateBuffers");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, outputStatsLevel), 148, "NV_ENC_INITIALIZE_PARAMS.outputStatsLevel");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, reserved), 152, "NV_ENC_INITIALIZE_PARAMS.reserved");
assert_eq!(offset_of!(NV_ENC_INITIALIZE_PARAMS, reserved2), 1296, "NV_ENC_INITIALIZE_PARAMS.reserved2");
assert_eq!((size_of::<NV_ENC_CREATE_INPUT_BUFFER>(), align_of::<NV_ENC_CREATE_INPUT_BUFFER>()), (776, 8), "NV_ENC_CREATE_INPUT_BUFFER");
assert_eq!(offset_of!(NV_ENC_CREATE_INPUT_BUFFER, version), 0, "NV_ENC_CREATE_INPUT_BUFFER.version");
assert_eq!(offset_of!(NV_ENC_CREATE_INPUT_BUFFER, width), 4, "NV_ENC_CREATE_INPUT_BUFFER.width");
assert_eq!(offset_of!(NV_ENC_CREATE_INPUT_BUFFER, height), 8, "NV_ENC_CREATE_INPUT_BUFFER.height");
assert_eq!(offset_of!(NV_ENC_CREATE_INPUT_BUFFER, memoryHeap), 12, "NV_ENC_CREATE_INPUT_BUFFER.memoryHeap");
assert_eq!(offset_of!(NV_ENC_CREATE_INPUT_BUFFER, bufferFmt), 16, "NV_ENC_CREATE_INPUT_BUFFER.bufferFmt");
assert_eq!(offset_of!(NV_ENC_CREATE_INPUT_BUFFER, reserved), 20, "NV_ENC_CREATE_INPUT_BUFFER.reserved");
assert_eq!(offset_of!(NV_ENC_CREATE_INPUT_BUFFER, inputBuffer), 24, "NV_ENC_CREATE_INPUT_BUFFER.inputBuffer");
assert_eq!(offset_of!(NV_ENC_CREATE_INPUT_BUFFER, pSysMemBuffer), 32, "NV_ENC_CREATE_INPUT_BUFFER.pSysMemBuffer");
assert_eq!(offset_of!(NV_ENC_CREATE_INPUT_BUFFER, reserved1), 40, "NV_ENC_CREATE_INPUT_BUFFER.reserved1");
assert_eq!(offset_of!(NV_ENC_CREATE_INPUT_BUFFER, reserved2), 272, "NV_ENC_CREATE_INPUT_BUFFER.reserved2");
assert_eq!((size_of::<NV_ENC_CREATE_BITSTREAM_BUFFER>(), align_of::<NV_ENC_CREATE_BITSTREAM_BUFFER>()), (776, 8), "NV_ENC_CREATE_BITSTREAM_BUFFER");
assert_eq!(offset_of!(NV_ENC_CREATE_BITSTREAM_BUFFER, version), 0, "NV_ENC_CREATE_BITSTREAM_BUFFER.version");
assert_eq!(offset_of!(NV_ENC_CREATE_BITSTREAM_BUFFER, size), 4, "NV_ENC_CREATE_BITSTREAM_BUFFER.size");
assert_eq!(offset_of!(NV_ENC_CREATE_BITSTREAM_BUFFER, memoryHeap), 8, "NV_ENC_CREATE_BITSTREAM_BUFFER.memoryHeap");
assert_eq!(offset_of!(NV_ENC_CREATE_BITSTREAM_BUFFER, reserved), 12, "NV_ENC_CREATE_BITSTREAM_BUFFER.reserved");
assert_eq!(offset_of!(NV_ENC_CREATE_BITSTREAM_BUFFER, bitstreamBuffer), 16, "NV_ENC_CREATE_BITSTREAM_BUFFER.bitstreamBuffer");
assert_eq!(offset_of!(NV_ENC_CREATE_BITSTREAM_BUFFER, bitstreamBufferPtr), 24, "NV_ENC_CREATE_BITSTREAM_BUFFER.bitstreamBufferPtr");
assert_eq!(offset_of!(NV_ENC_CREATE_BITSTREAM_BUFFER, reserved1), 32, "NV_ENC_CREATE_BITSTREAM_BUFFER.reserved1");
assert_eq!(offset_of!(NV_ENC_CREATE_BITSTREAM_BUFFER, reserved2), 264, "NV_ENC_CREATE_BITSTREAM_BUFFER.reserved2");
assert_eq!((size_of::<NV_ENC_CODEC_PIC_PARAMS>(), align_of::<NV_ENC_CODEC_PIC_PARAMS>()), (1552, 8), "NV_ENC_CODEC_PIC_PARAMS");
assert_eq!((size_of::<NV_ENC_PIC_PARAMS>(), align_of::<NV_ENC_PIC_PARAMS>()), (3360, 8), "NV_ENC_PIC_PARAMS");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, version), 0, "NV_ENC_PIC_PARAMS.version");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, inputWidth), 4, "NV_ENC_PIC_PARAMS.inputWidth");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, inputHeight), 8, "NV_ENC_PIC_PARAMS.inputHeight");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, inputPitch), 12, "NV_ENC_PIC_PARAMS.inputPitch");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, encodePicFlags), 16, "NV_ENC_PIC_PARAMS.encodePicFlags");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, frameIdx), 20, "NV_ENC_PIC_PARAMS.frameIdx");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, inputTimeStamp), 24, "NV_ENC_PIC_PARAMS.inputTimeStamp");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, inputDuration), 32, "NV_ENC_PIC_PARAMS.inputDuration");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, inputBuffer), 40, "NV_ENC_PIC_PARAMS.inputBuffer");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, outputBitstream), 48, "NV_ENC_PIC_PARAMS.outputBitstream");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, completionEvent), 56, "NV_ENC_PIC_PARAMS.completionEvent");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, bufferFmt), 64, "NV_ENC_PIC_PARAMS.bufferFmt");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, pictureStruct), 68, "NV_ENC_PIC_PARAMS.pictureStruct");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, pictureType), 72, "NV_ENC_PIC_PARAMS.pictureType");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, codecPicParams), 80, "NV_ENC_PIC_PARAMS.codecPicParams");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, meHintCountsPerBlock), 1632, "NV_ENC_PIC_PARAMS.meHintCountsPerBlock");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, meExternalHints), 1664, "NV_ENC_PIC_PARAMS.meExternalHints");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, reserved1), 1672, "NV_ENC_PIC_PARAMS.reserved1");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, reserved2), 1696, "NV_ENC_PIC_PARAMS.reserved2");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, qpDeltaMap), 1712, "NV_ENC_PIC_PARAMS.qpDeltaMap");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, qpDeltaMapSize), 1720, "NV_ENC_PIC_PARAMS.qpDeltaMapSize");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, reservedBitFields), 1724, "NV_ENC_PIC_PARAMS.reservedBitFields");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, meHintRefPicDist), 1728, "NV_ENC_PIC_PARAMS.meHintRefPicDist");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, alphaBuffer), 1736, "NV_ENC_PIC_PARAMS.alphaBuffer");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, meExternalSbHints), 1744, "NV_ENC_PIC_PARAMS.meExternalSbHints");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, meSbHintsCount), 1752, "NV_ENC_PIC_PARAMS.meSbHintsCount");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, stateBufferIdx), 1756, "NV_ENC_PIC_PARAMS.stateBufferIdx");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, outputReconBuffer), 1760, "NV_ENC_PIC_PARAMS.outputReconBuffer");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, reserved3), 1768, "NV_ENC_PIC_PARAMS.reserved3");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS, reserved4), 2904, "NV_ENC_PIC_PARAMS.reserved4");
assert_eq!((size_of::<NV_ENC_LOCK_BITSTREAM>(), align_of::<NV_ENC_LOCK_BITSTREAM>()), (1552, 8), "NV_ENC_LOCK_BITSTREAM");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, version), 0, "NV_ENC_LOCK_BITSTREAM.version");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, outputBitstream), 8, "NV_ENC_LOCK_BITSTREAM.outputBitstream");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, sliceOffsets), 16, "NV_ENC_LOCK_BITSTREAM.sliceOffsets");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, frameIdx), 24, "NV_ENC_LOCK_BITSTREAM.frameIdx");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, hwEncodeStatus), 28, "NV_ENC_LOCK_BITSTREAM.hwEncodeStatus");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, numSlices), 32, "NV_ENC_LOCK_BITSTREAM.numSlices");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, bitstreamSizeInBytes), 36, "NV_ENC_LOCK_BITSTREAM.bitstreamSizeInBytes");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, outputTimeStamp), 40, "NV_ENC_LOCK_BITSTREAM.outputTimeStamp");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, outputDuration), 48, "NV_ENC_LOCK_BITSTREAM.outputDuration");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, bitstreamBufferPtr), 56, "NV_ENC_LOCK_BITSTREAM.bitstreamBufferPtr");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, pictureType), 64, "NV_ENC_LOCK_BITSTREAM.pictureType");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, pictureStruct), 68, "NV_ENC_LOCK_BITSTREAM.pictureStruct");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, frameAvgQP), 72, "NV_ENC_LOCK_BITSTREAM.frameAvgQP");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, frameSatd), 76, "NV_ENC_LOCK_BITSTREAM.frameSatd");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, ltrFrameIdx), 80, "NV_ENC_LOCK_BITSTREAM.ltrFrameIdx");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, ltrFrameBitmap), 84, "NV_ENC_LOCK_BITSTREAM.ltrFrameBitmap");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, temporalId), 88, "NV_ENC_LOCK_BITSTREAM.temporalId");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, intraMBCount), 92, "NV_ENC_LOCK_BITSTREAM.intraMBCount");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, interMBCount), 96, "NV_ENC_LOCK_BITSTREAM.interMBCount");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, averageMVX), 100, "NV_ENC_LOCK_BITSTREAM.averageMVX");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, averageMVY), 104, "NV_ENC_LOCK_BITSTREAM.averageMVY");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, alphaLayerSizeInBytes), 108, "NV_ENC_LOCK_BITSTREAM.alphaLayerSizeInBytes");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, outputStatsPtrSize), 112, "NV_ENC_LOCK_BITSTREAM.outputStatsPtrSize");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, outputStatsPtr), 120, "NV_ENC_LOCK_BITSTREAM.outputStatsPtr");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, frameIdxDisplay), 128, "NV_ENC_LOCK_BITSTREAM.frameIdxDisplay");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, reserved1), 132, "NV_ENC_LOCK_BITSTREAM.reserved1");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, reserved2), 1016, "NV_ENC_LOCK_BITSTREAM.reserved2");
assert_eq!(offset_of!(NV_ENC_LOCK_BITSTREAM, reservedInternal), 1520, "NV_ENC_LOCK_BITSTREAM.reservedInternal");
assert_eq!((size_of::<NV_ENC_LOCK_INPUT_BUFFER>(), align_of::<NV_ENC_LOCK_INPUT_BUFFER>()), (1544, 8), "NV_ENC_LOCK_INPUT_BUFFER");
assert_eq!(offset_of!(NV_ENC_LOCK_INPUT_BUFFER, version), 0, "NV_ENC_LOCK_INPUT_BUFFER.version");
assert_eq!(offset_of!(NV_ENC_LOCK_INPUT_BUFFER, inputBuffer), 8, "NV_ENC_LOCK_INPUT_BUFFER.inputBuffer");
assert_eq!(offset_of!(NV_ENC_LOCK_INPUT_BUFFER, bufferDataPtr), 16, "NV_ENC_LOCK_INPUT_BUFFER.bufferDataPtr");
assert_eq!(offset_of!(NV_ENC_LOCK_INPUT_BUFFER, pitch), 24, "NV_ENC_LOCK_INPUT_BUFFER.pitch");
assert_eq!(offset_of!(NV_ENC_LOCK_INPUT_BUFFER, reserved1), 28, "NV_ENC_LOCK_INPUT_BUFFER.reserved1");
assert_eq!(offset_of!(NV_ENC_LOCK_INPUT_BUFFER, reserved2), 1032, "NV_ENC_LOCK_INPUT_BUFFER.reserved2");
assert_eq!((size_of::<NV_ENC_SEQUENCE_PARAM_PAYLOAD>(), align_of::<NV_ENC_SEQUENCE_PARAM_PAYLOAD>()), (1544, 8), "NV_ENC_SEQUENCE_PARAM_PAYLOAD");
assert_eq!(offset_of!(NV_ENC_SEQUENCE_PARAM_PAYLOAD, version), 0, "NV_ENC_SEQUENCE_PARAM_PAYLOAD.version");
assert_eq!(offset_of!(NV_ENC_SEQUENCE_PARAM_PAYLOAD, inBufferSize), 4, "NV_ENC_SEQUENCE_PARAM_PAYLOAD.inBufferSize");
assert_eq!(offset_of!(NV_ENC_SEQUENCE_PARAM_PAYLOAD, spsId), 8, "NV_ENC_SEQUENCE_PARAM_PAYLOAD.spsId");
assert_eq!(offset_of!(NV_ENC_SEQUENCE_PARAM_PAYLOAD, ppsId), 12, "NV_ENC_SEQUENCE_PARAM_PAYLOAD.ppsId");
assert_eq!(offset_of!(NV_ENC_SEQUENCE_PARAM_PAYLOAD, spsppsBuffer), 16, "NV_ENC_SEQUENCE_PARAM_PAYLOAD.spsppsBuffer");
assert_eq!(offset_of!(NV_ENC_SEQUENCE_PARAM_PAYLOAD, outSPSPPSPayloadSize), 24, "NV_ENC_SEQUENCE_PARAM_PAYLOAD.outSPSPPSPayloadSize");
assert_eq!(offset_of!(NV_ENC_SEQUENCE_PARAM_PAYLOAD, reserved), 32, "NV_ENC_SEQUENCE_PARAM_PAYLOAD.reserved");
assert_eq!(offset_of!(NV_ENC_SEQUENCE_PARAM_PAYLOAD, reserved2), 1032, "NV_ENC_SEQUENCE_PARAM_PAYLOAD.reserved2");
assert_eq!((size_of::<NV_ENCODE_API_FUNCTION_LIST>(), align_of::<NV_ENCODE_API_FUNCTION_LIST>()), (2552, 8), "NV_ENCODE_API_FUNCTION_LIST");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, version), 0, "NV_ENCODE_API_FUNCTION_LIST.version");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, reserved), 4, "NV_ENCODE_API_FUNCTION_LIST.reserved");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncOpenEncodeSession), 8, "NV_ENCODE_API_FUNCTION_LIST.nvEncOpenEncodeSession");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncGetEncodeGUIDCount), 16, "NV_ENCODE_API_FUNCTION_LIST.nvEncGetEncodeGUIDCount");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncGetEncodeProfileGUIDCount), 24, "NV_ENCODE_API_FUNCTION_LIST.nvEncGetEncodeProfileGUIDCount");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncGetEncodeProfileGUIDs), 32, "NV_ENCODE_API_FUNCTION_LIST.nvEncGetEncodeProfileGUIDs");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncGetEncodeGUIDs), 40, "NV_ENCODE_API_FUNCTION_LIST.nvEncGetEncodeGUIDs");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncGetInputFormatCount), 48, "NV_ENCODE_API_FUNCTION_LIST.nvEncGetInputFormatCount");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncGetInputFormats), 56, "NV_ENCODE_API_FUNCTION_LIST.nvEncGetInputFormats");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncGetEncodeCaps), 64, "NV_ENCODE_API_FUNCTION_LIST.nvEncGetEncodeCaps");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncGetEncodePresetCount), 72, "NV_ENCODE_API_FUNCTION_LIST.nvEncGetEncodePresetCount");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncGetEncodePresetGUIDs), 80, "NV_ENCODE_API_FUNCTION_LIST.nvEncGetEncodePresetGUIDs");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncGetEncodePresetConfig), 88, "NV_ENCODE_API_FUNCTION_LIST.nvEncGetEncodePresetConfig");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncInitializeEncoder), 96, "NV_ENCODE_API_FUNCTION_LIST.nvEncInitializeEncoder");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncCreateInputBuffer), 104, "NV_ENCODE_API_FUNCTION_LIST.nvEncCreateInputBuffer");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncDestroyInputBuffer), 112, "NV_ENCODE_API_FUNCTION_LIST.nvEncDestroyInputBuffer");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncCreateBitstreamBuffer), 120, "NV_ENCODE_API_FUNCTION_LIST.nvEncCreateBitstreamBuffer");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncDestroyBitstreamBuffer), 128, "NV_ENCODE_API_FUNCTION_LIST.nvEncDestroyBitstreamBuffer");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncEncodePicture), 136, "NV_ENCODE_API_FUNCTION_LIST.nvEncEncodePicture");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncLockBitstream), 144, "NV_ENCODE_API_FUNCTION_LIST.nvEncLockBitstream");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncUnlockBitstream), 152, "NV_ENCODE_API_FUNCTION_LIST.nvEncUnlockBitstream");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncLockInputBuffer), 160, "NV_ENCODE_API_FUNCTION_LIST.nvEncLockInputBuffer");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncUnlockInputBuffer), 168, "NV_ENCODE_API_FUNCTION_LIST.nvEncUnlockInputBuffer");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncGetEncodeStats), 176, "NV_ENCODE_API_FUNCTION_LIST.nvEncGetEncodeStats");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncGetSequenceParams), 184, "NV_ENCODE_API_FUNCTION_LIST.nvEncGetSequenceParams");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncRegisterAsyncEvent), 192, "NV_ENCODE_API_FUNCTION_LIST.nvEncRegisterAsyncEvent");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncUnregisterAsyncEvent), 200, "NV_ENCODE_API_FUNCTION_LIST.nvEncUnregisterAsyncEvent");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncMapInputResource), 208, "NV_ENCODE_API_FUNCTION_LIST.nvEncMapInputResource");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncUnmapInputResource), 216, "NV_ENCODE_API_FUNCTION_LIST.nvEncUnmapInputResource");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncDestroyEncoder), 224, "NV_ENCODE_API_FUNCTION_LIST.nvEncDestroyEncoder");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncInvalidateRefFrames), 232, "NV_ENCODE_API_FUNCTION_LIST.nvEncInvalidateRefFrames");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncOpenEncodeSessionEx), 240, "NV_ENCODE_API_FUNCTION_LIST.nvEncOpenEncodeSessionEx");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncRegisterResource), 248, "NV_ENCODE_API_FUNCTION_LIST.nvEncRegisterResource");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncUnregisterResource), 256, "NV_ENCODE_API_FUNCTION_LIST.nvEncUnregisterResource");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncReconfigureEncoder), 264, "NV_ENCODE_API_FUNCTION_LIST.nvEncReconfigureEncoder");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, reserved1), 272, "NV_ENCODE_API_FUNCTION_LIST.reserved1");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncCreateMVBuffer), 280, "NV_ENCODE_API_FUNCTION_LIST.nvEncCreateMVBuffer");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncDestroyMVBuffer), 288, "NV_ENCODE_API_FUNCTION_LIST.nvEncDestroyMVBuffer");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncRunMotionEstimationOnly), 296, "NV_ENCODE_API_FUNCTION_LIST.nvEncRunMotionEstimationOnly");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncGetLastErrorString), 304, "NV_ENCODE_API_FUNCTION_LIST.nvEncGetLastErrorString");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncSetIOCudaStreams), 312, "NV_ENCODE_API_FUNCTION_LIST.nvEncSetIOCudaStreams");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncGetEncodePresetConfigEx), 320, "NV_ENCODE_API_FUNCTION_LIST.nvEncGetEncodePresetConfigEx");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncGetSequenceParamEx), 328, "NV_ENCODE_API_FUNCTION_LIST.nvEncGetSequenceParamEx");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncRestoreEncoderState), 336, "NV_ENCODE_API_FUNCTION_LIST.nvEncRestoreEncoderState");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, nvEncLookaheadPicture), 344, "NV_ENCODE_API_FUNCTION_LIST.nvEncLookaheadPicture");
assert_eq!(offset_of!(NV_ENCODE_API_FUNCTION_LIST, reserved2), 352, "NV_ENCODE_API_FUNCTION_LIST.reserved2");
assert_eq!((size_of::<NV_ENC_SEI_PAYLOAD>(), align_of::<NV_ENC_SEI_PAYLOAD>()), (16, 8), "NV_ENC_SEI_PAYLOAD");
assert_eq!(offset_of!(NV_ENC_SEI_PAYLOAD, payloadSize), 0, "NV_ENC_SEI_PAYLOAD.payloadSize");
assert_eq!(offset_of!(NV_ENC_SEI_PAYLOAD, payloadType), 4, "NV_ENC_SEI_PAYLOAD.payloadType");
assert_eq!(offset_of!(NV_ENC_SEI_PAYLOAD, payload), 8, "NV_ENC_SEI_PAYLOAD.payload");
assert_eq!((size_of::<NV_ENC_CLOCK_TIMESTAMP_SET>(), align_of::<NV_ENC_CLOCK_TIMESTAMP_SET>()), (8, 4), "NV_ENC_CLOCK_TIMESTAMP_SET");
assert_eq!(offset_of!(NV_ENC_CLOCK_TIMESTAMP_SET, timeOffset), 4, "NV_ENC_CLOCK_TIMESTAMP_SET.timeOffset");
assert_eq!((size_of::<NV_ENC_TIME_CODE>(), align_of::<NV_ENC_TIME_CODE>()), (28, 4), "NV_ENC_TIME_CODE");
assert_eq!(offset_of!(NV_ENC_TIME_CODE, displayPicStruct), 0, "NV_ENC_TIME_CODE.displayPicStruct");
assert_eq!(offset_of!(NV_ENC_TIME_CODE, clockTimestamp), 4, "NV_ENC_TIME_CODE.clockTimestamp");
assert_eq!((size_of::<NV_ENC_PIC_PARAMS_HEVC>(), align_of::<NV_ENC_PIC_PARAMS_HEVC>()), (1536, 8), "NV_ENC_PIC_PARAMS_HEVC");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, displayPOCSyntax), 0, "NV_ENC_PIC_PARAMS_HEVC.displayPOCSyntax");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, refPicFlag), 4, "NV_ENC_PIC_PARAMS_HEVC.refPicFlag");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, temporalId), 8, "NV_ENC_PIC_PARAMS_HEVC.temporalId");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, forceIntraRefreshWithFrameCnt), 12, "NV_ENC_PIC_PARAMS_HEVC.forceIntraRefreshWithFrameCnt");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, sliceTypeData), 24, "NV_ENC_PIC_PARAMS_HEVC.sliceTypeData");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, sliceTypeArrayCnt), 32, "NV_ENC_PIC_PARAMS_HEVC.sliceTypeArrayCnt");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, sliceMode), 36, "NV_ENC_PIC_PARAMS_HEVC.sliceMode");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, sliceModeData), 40, "NV_ENC_PIC_PARAMS_HEVC.sliceModeData");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, ltrMarkFrameIdx), 44, "NV_ENC_PIC_PARAMS_HEVC.ltrMarkFrameIdx");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, ltrUseFrameBitmap), 48, "NV_ENC_PIC_PARAMS_HEVC.ltrUseFrameBitmap");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, ltrUsageMode), 52, "NV_ENC_PIC_PARAMS_HEVC.ltrUsageMode");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, seiPayloadArrayCnt), 56, "NV_ENC_PIC_PARAMS_HEVC.seiPayloadArrayCnt");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, reserved), 60, "NV_ENC_PIC_PARAMS_HEVC.reserved");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, seiPayloadArray), 64, "NV_ENC_PIC_PARAMS_HEVC.seiPayloadArray");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, timeCode), 72, "NV_ENC_PIC_PARAMS_HEVC.timeCode");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, reserved2), 100, "NV_ENC_PIC_PARAMS_HEVC.reserved2");
assert_eq!(offset_of!(NV_ENC_PIC_PARAMS_HEVC, reserved3), 1048, "NV_ENC_PIC_PARAMS_HEVC.reserved3");
assert_eq!(offset_of!(NV_ENC_CLOCK_TIMESTAMP_SET, bits), 0, "NV_ENC_CLOCK_TIMESTAMP_SET.bits");
assert_eq!(offset_of!(NV_ENC_CODEC_PIC_PARAMS, hevcPicParams), 0, "NV_ENC_CODEC_PIC_PARAMS.hevcPicParams");
assert_eq!(offset_of!(NV_ENC_CODEC_PIC_PARAMS, reserved), 0, "NV_ENC_CODEC_PIC_PARAMS.reserved");
assert_eq!(
offset_of!(NV_ENC_PIC_PARAMS_HEVC, flags),
16,
"NV_ENC_PIC_PARAMS_HEVC.flags (the C program sets constrainedFrame / ltrUseFrames and reads the word at 16: 0x1 / 0x8)"
);
}
#[test]
fn constants_match_the_header() {
assert_eq!(NVENCAPI_VERSION as i64, 16777228, "NVENCAPI_VERSION");
assert_eq!(NV_ENC_SUCCESS as i64, 0, "NV_ENC_SUCCESS");
assert_eq!(NV_ENC_ERR_INVALID_VERSION as i64, 15, "NV_ENC_ERR_INVALID_VERSION");
assert_eq!(NV_ENC_ERR_UNSUPPORTED_DEVICE as i64, 2, "NV_ENC_ERR_UNSUPPORTED_DEVICE");
assert_eq!(NV_ENC_ERR_ENCODER_BUSY as i64, 18, "NV_ENC_ERR_ENCODER_BUSY");
assert_eq!(NV_ENC_ERR_LOCK_BUSY as i64, 13, "NV_ENC_ERR_LOCK_BUSY");
assert_eq!(NV_ENC_DEVICE_TYPE_DIRECTX as i64, 0, "NV_ENC_DEVICE_TYPE_DIRECTX");
assert_eq!(NV_ENC_MEMORY_HEAP_SYSMEM_CACHED as i64, 2, "NV_ENC_MEMORY_HEAP_SYSMEM_CACHED");
assert_eq!(NV_ENC_BUFFER_FORMAT_NV12 as i64, 1, "NV_ENC_BUFFER_FORMAT_NV12");
assert_eq!(NV_ENC_PARAMS_RC_VBR as i64, 1, "NV_ENC_PARAMS_RC_VBR");
assert_eq!(NV_ENC_PARAMS_RC_CBR as i64, 2, "NV_ENC_PARAMS_RC_CBR");
assert_eq!(NV_ENC_TUNING_INFO_HIGH_QUALITY as i64, 1, "NV_ENC_TUNING_INFO_HIGH_QUALITY");
assert_eq!(NV_ENC_PIC_STRUCT_FRAME as i64, 1, "NV_ENC_PIC_STRUCT_FRAME");
assert_eq!(NV_ENC_PIC_TYPE_P as i64, 0, "NV_ENC_PIC_TYPE_P");
assert_eq!(NV_ENC_PIC_TYPE_B as i64, 1, "NV_ENC_PIC_TYPE_B");
assert_eq!(NV_ENC_PIC_TYPE_I as i64, 2, "NV_ENC_PIC_TYPE_I");
assert_eq!(NV_ENC_PIC_TYPE_IDR as i64, 3, "NV_ENC_PIC_TYPE_IDR");
assert_eq!(NV_ENC_PIC_FLAG_EOS as i64, 8, "NV_ENC_PIC_FLAG_EOS");
assert_eq!(NV_ENC_LEVEL_AUTOSELECT as i64, 0, "NV_ENC_LEVEL_AUTOSELECT");
assert_eq!(NV_ENC_H264_ENTROPY_CODING_MODE_CABAC as i64, 1, "NV_ENC_H264_ENTROPY_CODING_MODE_CABAC");
assert_eq!(NV_ENC_VUI_VIDEO_FORMAT_UNSPECIFIED as i64, 5, "NV_ENC_VUI_VIDEO_FORMAT_UNSPECIFIED");
assert_eq!(NV_ENC_VUI_COLOR_PRIMARIES_BT709 as i64, 1, "NV_ENC_VUI_COLOR_PRIMARIES_BT709");
assert_eq!(NV_ENC_VUI_TRANSFER_CHARACTERISTIC_BT709 as i64, 1, "NV_ENC_VUI_TRANSFER_CHARACTERISTIC_BT709");
assert_eq!(NV_ENC_VUI_MATRIX_COEFFS_BT709 as i64, 1, "NV_ENC_VUI_MATRIX_COEFFS_BT709");
assert_eq!(NV_ENC_CAPS_NUM_MAX_BFRAMES as i64, 0, "NV_ENC_CAPS_NUM_MAX_BFRAMES");
assert_eq!(NV_ENC_CAPS_SUPPORTED_RATECONTROL_MODES as i64, 1, "NV_ENC_CAPS_SUPPORTED_RATECONTROL_MODES");
assert_eq!(NV_ENC_CAPS_WIDTH_MAX as i64, 16, "NV_ENC_CAPS_WIDTH_MAX");
assert_eq!(NV_ENC_CAPS_HEIGHT_MAX as i64, 17, "NV_ENC_CAPS_HEIGHT_MAX");
assert_eq!(NV_ENC_CAPS_WIDTH_MIN as i64, 45, "NV_ENC_CAPS_WIDTH_MIN");
assert_eq!(NV_ENC_CAPS_HEIGHT_MIN as i64, 46, "NV_ENC_CAPS_HEIGHT_MIN");
assert_eq!(NV_ENC_ERR_NEED_MORE_INPUT as i64, 17, "NV_ENC_ERR_NEED_MORE_INPUT");
assert_eq!(NV_ENCODE_API_FUNCTION_LIST_VER as i64, 1895956492, "NV_ENCODE_API_FUNCTION_LIST_VER");
assert_eq!(NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER as i64, 1895890956, "NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER");
assert_eq!(NV_ENC_CAPS_PARAM_VER as i64, 1895890956, "NV_ENC_CAPS_PARAM_VER");
assert_eq!(NV_ENC_CONFIG_VER as i64, 4043833356, "NV_ENC_CONFIG_VER");
assert_eq!(NV_ENC_INITIALIZE_PARAMS_VER as i64, 4043702284, "NV_ENC_INITIALIZE_PARAMS_VER");
assert_eq!(NV_ENC_PRESET_CONFIG_VER as i64, 4043571212, "NV_ENC_PRESET_CONFIG_VER");
assert_eq!(NV_ENC_RC_PARAMS_VER as i64, 1895890956, "NV_ENC_RC_PARAMS_VER");
assert_eq!(NV_ENC_CREATE_INPUT_BUFFER_VER as i64, 1895890956, "NV_ENC_CREATE_INPUT_BUFFER_VER");
assert_eq!(NV_ENC_CREATE_BITSTREAM_BUFFER_VER as i64, 1895890956, "NV_ENC_CREATE_BITSTREAM_BUFFER_VER");
assert_eq!(NV_ENC_PIC_PARAMS_VER as i64, 4043702284, "NV_ENC_PIC_PARAMS_VER");
assert_eq!(NV_ENC_LOCK_BITSTREAM_VER as i64, 4043374604, "NV_ENC_LOCK_BITSTREAM_VER");
assert_eq!(NV_ENC_LOCK_INPUT_BUFFER_VER as i64, 1895890956, "NV_ENC_LOCK_INPUT_BUFFER_VER");
assert_eq!(NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER as i64, 1895890956, "NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER");
assert_eq!(NV_ENC_TIER_HEVC_MAIN as i64, 0, "NV_ENC_TIER_HEVC_MAIN");
assert_eq!(NV_ENC_HEVC_CUSIZE_AUTOSELECT as i64, 0, "NV_ENC_HEVC_CUSIZE_AUTOSELECT");
assert_eq!(NV_ENC_LEVEL_HEVC_1 as i64, 30, "NV_ENC_LEVEL_HEVC_1");
assert_eq!(NV_ENC_LEVEL_HEVC_2 as i64, 60, "NV_ENC_LEVEL_HEVC_2");
assert_eq!(NV_ENC_LEVEL_HEVC_21 as i64, 63, "NV_ENC_LEVEL_HEVC_21");
assert_eq!(NV_ENC_LEVEL_HEVC_3 as i64, 90, "NV_ENC_LEVEL_HEVC_3");
assert_eq!(NV_ENC_LEVEL_HEVC_31 as i64, 93, "NV_ENC_LEVEL_HEVC_31");
assert_eq!(NV_ENC_LEVEL_HEVC_4 as i64, 120, "NV_ENC_LEVEL_HEVC_4");
assert_eq!(NV_ENC_LEVEL_HEVC_41 as i64, 123, "NV_ENC_LEVEL_HEVC_41");
assert_eq!(NV_ENC_LEVEL_HEVC_5 as i64, 150, "NV_ENC_LEVEL_HEVC_5");
assert_eq!(NV_ENC_LEVEL_HEVC_51 as i64, 153, "NV_ENC_LEVEL_HEVC_51");
assert_eq!(NV_ENC_LEVEL_HEVC_52 as i64, 156, "NV_ENC_LEVEL_HEVC_52");
assert_eq!(NV_ENC_LEVEL_HEVC_6 as i64, 180, "NV_ENC_LEVEL_HEVC_6");
assert_eq!(NV_ENC_LEVEL_HEVC_61 as i64, 183, "NV_ENC_LEVEL_HEVC_61");
assert_eq!(NV_ENC_LEVEL_HEVC_62 as i64, 186, "NV_ENC_LEVEL_HEVC_62");
assert_eq!(NVENCAPI_VERSION as i64, 16777228, "NVENCAPI_VERSION");
assert_eq!(NV_ENC_BUFFER_FORMAT_YUV420_10BIT as i64, 65536, "NV_ENC_BUFFER_FORMAT_YUV420_10BIT");
assert_eq!(NV_ENC_BUFFER_FORMAT_ABGR as i64, 268435456, "NV_ENC_BUFFER_FORMAT_ABGR");
assert_eq!(NV_ENC_CAPS_SUPPORT_10BIT_ENCODE as i64, 39, "NV_ENC_CAPS_SUPPORT_10BIT_ENCODE");
assert_eq!(NV_ENC_VUI_COLOR_PRIMARIES_BT2020 as i64, 9, "NV_ENC_VUI_COLOR_PRIMARIES_BT2020");
assert_eq!(NV_ENC_VUI_TRANSFER_CHARACTERISTIC_SMPTE2084 as i64, 16, "NV_ENC_VUI_TRANSFER_CHARACTERISTIC_SMPTE2084");
assert_eq!(NV_ENC_VUI_TRANSFER_CHARACTERISTIC_ARIB_STD_B67 as i64, 18, "NV_ENC_VUI_TRANSFER_CHARACTERISTIC_ARIB_STD_B67");
assert_eq!(NV_ENC_VUI_MATRIX_COEFFS_BT2020_NCL as i64, 9, "NV_ENC_VUI_MATRIX_COEFFS_BT2020_NCL");
}
#[test]
fn guids_match_the_header() {
assert_eq!(NV_ENC_CODEC_H264_GUID.to_u128(), 0x6bc827624e634ca4aa851e50f321f6bfu128, "NV_ENC_CODEC_H264_GUID");
assert_eq!(NV_ENC_H264_PROFILE_BASELINE_GUID.to_u128(), 0x0727bcaa78c44c838c2fef3dff267c6au128, "NV_ENC_H264_PROFILE_BASELINE_GUID");
assert_eq!(NV_ENC_H264_PROFILE_MAIN_GUID.to_u128(), 0x60b5c1d467fe479094d5c4726d7b6e6du128, "NV_ENC_H264_PROFILE_MAIN_GUID");
assert_eq!(NV_ENC_H264_PROFILE_HIGH_GUID.to_u128(), 0xe7cbc3094f7a4b89af2ad537c92be310u128, "NV_ENC_H264_PROFILE_HIGH_GUID");
assert_eq!(NV_ENC_PRESET_P4_GUID.to_u128(), 0x90a7b826df064862b9d2cd6d73a08681u128, "NV_ENC_PRESET_P4_GUID");
assert_eq!(NV_ENC_PRESET_P5_GUID.to_u128(), 0x21c6e6b4297a4cba998fb6cbde72ade3u128, "NV_ENC_PRESET_P5_GUID");
assert_eq!(NV_ENC_CODEC_HEVC_GUID.to_u128(), 0x790cdc8845224d7b9425bda9975f7603u128, "NV_ENC_CODEC_HEVC_GUID");
assert_eq!(NV_ENC_HEVC_PROFILE_MAIN_GUID.to_u128(), 0xb514c39ab55b40fa878ff1253b4dfdecu128, "NV_ENC_HEVC_PROFILE_MAIN_GUID");
assert_eq!(NV_ENC_HEVC_PROFILE_MAIN10_GUID.to_u128(), 0xfa4d2b6c3a5b411a80180a3f5e3c9be5u128, "NV_ENC_HEVC_PROFILE_MAIN10_GUID");
}
/// The bit-field masks of the `flags` words (the C compiler's layout of each bit-field set alone).
#[test]
fn bit_field_masks_match_the_header() {
assert_eq!(H264_OUTPUT_AUD, 0x40, "NV_ENC_CONFIG_H264.outputAUD");
assert_eq!(H264_REPEAT_SPSPPS, 0x1000, "NV_ENC_CONFIG_H264.repeatSPSPPS");
assert_eq!(HEVC_OUTPUT_AUD, 0x10, "NV_ENC_CONFIG_HEVC.outputAUD");
assert_eq!(HEVC_DISABLE_SPSPPS, 0x40, "NV_ENC_CONFIG_HEVC.disableSPSPPS");
assert_eq!(HEVC_REPEAT_SPSPPS, 0x80, "NV_ENC_CONFIG_HEVC.repeatSPSPPS");
assert_eq!(HEVC_ENABLE_INTRA_REFRESH, 0x100, "NV_ENC_CONFIG_HEVC.enableIntraRefresh");
assert_eq!(HEVC_CHROMA_FORMAT_MASK, 0x600, "NV_ENC_CONFIG_HEVC.chromaFormatIDC");
assert_eq!(HEVC_PIXEL_BIT_DEPTH_MASK, 0x3800, "NV_ENC_CONFIG_HEVC.pixelBitDepthMinus8");
assert_eq!(HEVC_OUTPUT_RECOVERY_POINT_SEI, 0x40000, "NV_ENC_CONFIG_HEVC.outputRecoveryPointSEI");
assert_eq!(HEVC_CHROMA_FORMAT_MASK >> HEVC_CHROMA_FORMAT_SHIFT, 3, "chromaFormatIDC is 2 bits");
assert_eq!(HEVC_PIXEL_BIT_DEPTH_MASK >> HEVC_PIXEL_BIT_DEPTH_SHIFT, 7, "pixelBitDepthMinus8 is 3 bits");
}