mirror of
https://github.com/storytold/filmcraft.git
synced 2026-11-02 18:09:21 +00:00
Refactor platform for strict Clippy checks
This commit is contained in:
@@ -13,9 +13,11 @@ rust-version.workspace = true
|
||||
unsafe_code = "deny"
|
||||
|
||||
[lints.clippy]
|
||||
cognitive_complexity = "deny"
|
||||
too_many_arguments = "deny"
|
||||
wildcard_imports = "deny"
|
||||
dbg_macro = "warn"
|
||||
todo = "warn"
|
||||
too_many_arguments = "allow"
|
||||
needless_range_loop = "allow"
|
||||
type_complexity = "allow"
|
||||
undocumented_unsafe_blocks = "deny"
|
||||
|
||||
@@ -5,11 +5,15 @@
|
||||
use super::ffi::*;
|
||||
use std::mem::{align_of, offset_of, size_of};
|
||||
#[test]
|
||||
fn layouts_match_the_header() {
|
||||
fn cuvidpicparams_layout_matches_the_header() {
|
||||
assert_eq!(offset_of!(CUVIDPICPARAMS, nBitstreamDataLen), 24, "CUVIDPICPARAMS.nBitstreamDataLen");
|
||||
assert_eq!(offset_of!(CUVIDPICPARAMS, pBitstreamData), 32, "CUVIDPICPARAMS.pBitstreamData");
|
||||
assert_eq!(offset_of!(CUVIDPICPARAMS, nNumSlices), 40, "CUVIDPICPARAMS.nNumSlices");
|
||||
assert_eq!(offset_of!(CUVIDPICPARAMS, pSliceDataOffsets), 48, "CUVIDPICPARAMS.pSliceDataOffsets");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cuvideoformat_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<CUVIDEOFORMAT>(), align_of::<CUVIDEOFORMAT>()), (64, 4));
|
||||
assert_eq!(offset_of!(CUVIDEOFORMAT, codec), 0);
|
||||
assert_eq!(offset_of!(CUVIDEOFORMAT, frame_rate), 4);
|
||||
@@ -25,6 +29,10 @@ fn layouts_match_the_header() {
|
||||
assert_eq!(offset_of!(CUVIDEOFORMAT, display_aspect_ratio), 48);
|
||||
assert_eq!(offset_of!(CUVIDEOFORMAT, video_signal_description), 56);
|
||||
assert_eq!(offset_of!(CUVIDEOFORMAT, seqhdr_data_length), 60);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cuviddecodecaps_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<CUVIDDECODECAPS>(), align_of::<CUVIDDECODECAPS>()), (88, 4));
|
||||
assert_eq!(offset_of!(CUVIDDECODECAPS, eCodecType), 0);
|
||||
assert_eq!(offset_of!(CUVIDDECODECAPS, eChromaFormat), 4);
|
||||
@@ -44,6 +52,10 @@ fn layouts_match_the_header() {
|
||||
assert_eq!(offset_of!(CUVIDDECODECAPS, bIsDecodeStatsSupported), 48);
|
||||
assert_eq!(offset_of!(CUVIDDECODECAPS, reserved4), 49);
|
||||
assert_eq!(offset_of!(CUVIDDECODECAPS, reserved3), 52);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cuviddecodecreateinfo_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<CUVIDDECODECREATEINFO>(), align_of::<CUVIDDECODECREATEINFO>()), (176, 8));
|
||||
assert_eq!(offset_of!(CUVIDDECODECREATEINFO, ulWidth), 0);
|
||||
assert_eq!(offset_of!(CUVIDDECODECREATEINFO, ulHeight), 8);
|
||||
@@ -67,6 +79,10 @@ fn layouts_match_the_header() {
|
||||
assert_eq!(offset_of!(CUVIDDECODECREATEINFO, enableHistogram), 136);
|
||||
assert_eq!(offset_of!(CUVIDDECODECREATEINFO, enableDecodeFeatures), 144);
|
||||
assert_eq!(offset_of!(CUVIDDECODECREATEINFO, Reserved2), 152);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cuvidparserparams_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<CUVIDPARSERPARAMS>(), align_of::<CUVIDPARSERPARAMS>()), (136, 8));
|
||||
assert_eq!(offset_of!(CUVIDPARSERPARAMS, CodecType), 0);
|
||||
assert_eq!(offset_of!(CUVIDPARSERPARAMS, ulMaxNumDecodeSurfaces), 4);
|
||||
@@ -83,17 +99,29 @@ fn layouts_match_the_header() {
|
||||
assert_eq!(offset_of!(CUVIDPARSERPARAMS, pfnGetSEIMsg), 80);
|
||||
assert_eq!(offset_of!(CUVIDPARSERPARAMS, pvReserved2), 88);
|
||||
assert_eq!(offset_of!(CUVIDPARSERPARAMS, pExtVideoInfo), 128);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cuvidsourcedatapacket_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<CUVIDSOURCEDATAPACKET>(), align_of::<CUVIDSOURCEDATAPACKET>()), (32, 8));
|
||||
assert_eq!(offset_of!(CUVIDSOURCEDATAPACKET, flags), 0);
|
||||
assert_eq!(offset_of!(CUVIDSOURCEDATAPACKET, payload_size), 8);
|
||||
assert_eq!(offset_of!(CUVIDSOURCEDATAPACKET, payload), 16);
|
||||
assert_eq!(offset_of!(CUVIDSOURCEDATAPACKET, timestamp), 24);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cuvidparserdispinfo_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<CUVIDPARSERDISPINFO>(), align_of::<CUVIDPARSERDISPINFO>()), (24, 8));
|
||||
assert_eq!(offset_of!(CUVIDPARSERDISPINFO, picture_index), 0);
|
||||
assert_eq!(offset_of!(CUVIDPARSERDISPINFO, progressive_frame), 4);
|
||||
assert_eq!(offset_of!(CUVIDPARSERDISPINFO, top_field_first), 8);
|
||||
assert_eq!(offset_of!(CUVIDPARSERDISPINFO, repeat_first_field), 12);
|
||||
assert_eq!(offset_of!(CUVIDPARSERDISPINFO, timestamp), 16);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cuvidprocparams_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<CUVIDPROCPARAMS>(), align_of::<CUVIDPROCPARAMS>()), (264, 8));
|
||||
assert_eq!(offset_of!(CUVIDPROCPARAMS, progressive_frame), 0);
|
||||
assert_eq!(offset_of!(CUVIDPROCPARAMS, second_field), 4);
|
||||
@@ -111,10 +139,30 @@ fn layouts_match_the_header() {
|
||||
assert_eq!(offset_of!(CUVIDPROCPARAMS, Reserved), 64);
|
||||
assert_eq!(offset_of!(CUVIDPROCPARAMS, histogram_dptr), 248);
|
||||
assert_eq!(offset_of!(CUVIDPROCPARAMS, pCuvidProcExt), 256);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn framerate_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<FrameRate>(), align_of::<FrameRate>()), (8, 4));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rect_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<Rect>(), align_of::<Rect>()), (16, 4));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shortrect_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<ShortRect>(), align_of::<ShortRect>()), (8, 2));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn aspectratio_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<AspectRatio>(), align_of::<AspectRatio>()), (8, 4));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn videosignal_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<VideoSignal>(), align_of::<VideoSignal>()), (4, 1));
|
||||
}
|
||||
#[test]
|
||||
|
||||
@@ -7,7 +7,12 @@ use std::ptr;
|
||||
use filmcraft_codecs::hw::NalCodec;
|
||||
use filmcraft_frame::VideoFrame;
|
||||
|
||||
use super::ffi::*;
|
||||
use super::ffi::{
|
||||
CUVID_PKT_ENDOFPICTURE, CUVID_PKT_ENDOFSTREAM, CUVID_PKT_TIMESTAMP, CUVIDDECODECAPS, CUVIDDECODECREATEINFO, CUVIDEOFORMAT, CUVIDPARSERDISPINFO,
|
||||
CUVIDPARSERPARAMS, CUVIDPICPARAMS, CUVIDPROCPARAMS, CUVIDSOURCEDATAPACKET, CreateDecoder, CreateVideoParser, DecodePicture, DestroyDecoder,
|
||||
DestroyVideoParser, GetDecoderCaps, MapVideoFrame, ParseVideoData, ShortRect, UnmapVideoFrame, cudaVideoChromaFormat_420, cudaVideoCodec_H264,
|
||||
cudaVideoCodec_HEVC, cudaVideoCreate_PreferCUVID, cudaVideoDeinterlaceMode_Weave, cudaVideoSurfaceFormat_NV12, cudaVideoSurfaceFormat_P016,
|
||||
};
|
||||
use crate::biplanar::{Biplanar, Geometry, to_frame};
|
||||
use crate::nvenc::device::Device;
|
||||
|
||||
|
||||
@@ -13,13 +13,12 @@
|
||||
//! `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() {
|
||||
fn nv_enc_open_encode_session_ex_params_layout_matches_the_header() {
|
||||
assert_eq!(
|
||||
(size_of::<NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS>(), align_of::<NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS>()),
|
||||
(1552, 8),
|
||||
@@ -32,14 +31,26 @@ fn layouts_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_caps_param_layout_matches_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_qp_layout_matches_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_rc_params_layout_matches_the_header() {
|
||||
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");
|
||||
@@ -67,6 +78,10 @@ fn layouts_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_config_h264_vui_parameters_layout_matches_the_header() {
|
||||
assert_eq!(
|
||||
(size_of::<NV_ENC_CONFIG_H264_VUI_PARAMETERS>(), align_of::<NV_ENC_CONFIG_H264_VUI_PARAMETERS>()),
|
||||
(112, 4),
|
||||
@@ -93,6 +108,10 @@ fn layouts_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_config_h264_layout_matches_the_header() {
|
||||
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");
|
||||
@@ -121,6 +140,10 @@ fn layouts_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_config_hevc_vui_parameters_layout_matches_the_header() {
|
||||
assert_eq!(
|
||||
(size_of::<NV_ENC_CONFIG_HEVC_VUI_PARAMETERS>(), align_of::<NV_ENC_CONFIG_HEVC_VUI_PARAMETERS>()),
|
||||
(112, 4),
|
||||
@@ -145,6 +168,10 @@ fn layouts_match_the_header() {
|
||||
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}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_config_hevc_layout_matches_the_header() {
|
||||
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");
|
||||
@@ -168,10 +195,18 @@ fn layouts_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_codec_config_layout_matches_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_config_layout_matches_the_header() {
|
||||
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");
|
||||
@@ -184,17 +219,29 @@ fn layouts_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_preset_config_layout_matches_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nvenc_external_me_hint_counts_per_blocktype_layout_matches_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_initialize_params_layout_matches_the_header() {
|
||||
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");
|
||||
@@ -219,6 +266,10 @@ fn layouts_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_create_input_buffer_layout_matches_the_header() {
|
||||
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");
|
||||
@@ -230,6 +281,10 @@ fn layouts_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_create_bitstream_buffer_layout_matches_the_header() {
|
||||
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");
|
||||
@@ -239,7 +294,17 @@ fn layouts_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_codec_pic_params_layout_matches_the_header() {
|
||||
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!(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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_pic_params_layout_matches_the_header() {
|
||||
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");
|
||||
@@ -255,6 +320,10 @@ fn layouts_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_pic_params_codec_and_motion_layout_matches_the_header() {
|
||||
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");
|
||||
@@ -271,6 +340,10 @@ fn layouts_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_lock_bitstream_layout_matches_the_header() {
|
||||
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");
|
||||
@@ -300,6 +373,10 @@ fn layouts_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_lock_input_buffer_layout_matches_the_header() {
|
||||
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");
|
||||
@@ -307,6 +384,10 @@ fn layouts_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_sequence_param_payload_layout_matches_the_header() {
|
||||
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");
|
||||
@@ -316,6 +397,10 @@ fn layouts_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_encode_api_function_list_layout_matches_the_header() {
|
||||
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");
|
||||
@@ -342,6 +427,10 @@ fn layouts_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_encode_api_event_and_resource_functions_match_the_header() {
|
||||
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");
|
||||
@@ -363,15 +452,32 @@ fn layouts_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_sei_payload_layout_matches_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_clock_timestamp_set_layout_matches_the_header() {
|
||||
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!(offset_of!(NV_ENC_CLOCK_TIMESTAMP_SET, bits), 0, "NV_ENC_CLOCK_TIMESTAMP_SET.bits");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_time_code_layout_matches_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nv_enc_pic_params_hevc_layout_matches_the_header() {
|
||||
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");
|
||||
@@ -390,9 +496,6 @@ fn layouts_match_the_header() {
|
||||
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,
|
||||
@@ -426,6 +529,10 @@ fn constants_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn capabilities_constants_match_the_header() {
|
||||
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");
|
||||
@@ -433,6 +540,10 @@ fn constants_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn versions_constants_match_the_header() {
|
||||
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");
|
||||
@@ -446,6 +557,10 @@ fn constants_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hevc_constants_match_the_header() {
|
||||
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");
|
||||
@@ -461,6 +576,10 @@ fn constants_match_the_header() {
|
||||
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");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hdr_constants_match_the_header() {
|
||||
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");
|
||||
|
||||
@@ -114,7 +114,7 @@ impl VideoEncoder for NvencEncoder {
|
||||
(true, Some(rgb)) => {
|
||||
let (kr, kb) = self.signal.kr_kb();
|
||||
filmcraft_export::timed(filmcraft_export::Stage::Convert, || {
|
||||
filmcraft_export::rgbf_to_yuv420_10(rgb, w, h, kr, kb, &mut self.y16, &mut self.u16, &mut self.v16)
|
||||
filmcraft_export::rgbf_to_yuv420_10(rgb, w, h, filmcraft_export::Matrix::new(kr, kb), &mut self.y16, &mut self.u16, &mut self.v16)
|
||||
})?;
|
||||
self.enc.encode_10(&self.y16, &self.u16, &self.v16, f.index).map_err(|e| ExportError::Encode(format!("NVENC: {e}{hint}")))?
|
||||
}
|
||||
|
||||
@@ -8,7 +8,22 @@ use std::ffi::{CStr, c_void};
|
||||
use std::sync::OnceLock;
|
||||
|
||||
use super::device::Device;
|
||||
use super::ffi::*;
|
||||
use super::ffi::{
|
||||
CreateInstanceFn, Guid, H264_OUTPUT_AUD, H264_REPEAT_SPSPPS, HEVC_CHROMA_FORMAT_MASK, HEVC_CHROMA_FORMAT_SHIFT, HEVC_DISABLE_SPSPPS,
|
||||
HEVC_ENABLE_INTRA_REFRESH, HEVC_OUTPUT_AUD, HEVC_PIXEL_BIT_DEPTH_MASK, HEVC_PIXEL_BIT_DEPTH_SHIFT, HEVC_REPEAT_SPSPPS, Handle, MaxSupportedVersionFn,
|
||||
NV_ENC_BUFFER_FORMAT_ABGR, NV_ENC_BUFFER_FORMAT_NV12, NV_ENC_BUFFER_FORMAT_YUV420_10BIT, NV_ENC_CAPS_HEIGHT_MAX, NV_ENC_CAPS_HEIGHT_MIN,
|
||||
NV_ENC_CAPS_NUM_MAX_BFRAMES, NV_ENC_CAPS_PARAM, NV_ENC_CAPS_PARAM_VER, NV_ENC_CAPS_SUPPORT_10BIT_ENCODE, NV_ENC_CAPS_WIDTH_MAX, NV_ENC_CAPS_WIDTH_MIN,
|
||||
NV_ENC_CODEC_H264_GUID, NV_ENC_CODEC_HEVC_GUID, NV_ENC_CONFIG, NV_ENC_CONFIG_VER, NV_ENC_CREATE_BITSTREAM_BUFFER, NV_ENC_CREATE_BITSTREAM_BUFFER_VER,
|
||||
NV_ENC_CREATE_INPUT_BUFFER, NV_ENC_CREATE_INPUT_BUFFER_VER, NV_ENC_ERR_NEED_MORE_INPUT, NV_ENC_H264_ENTROPY_CODING_MODE_CABAC,
|
||||
NV_ENC_H264_PROFILE_BASELINE_GUID, NV_ENC_H264_PROFILE_HIGH_GUID, NV_ENC_H264_PROFILE_MAIN_GUID, NV_ENC_HEVC_CUSIZE_AUTOSELECT,
|
||||
NV_ENC_HEVC_PROFILE_MAIN_GUID, NV_ENC_HEVC_PROFILE_MAIN10_GUID, NV_ENC_INITIALIZE_PARAMS, NV_ENC_INITIALIZE_PARAMS_VER, NV_ENC_LEVEL_AUTOSELECT,
|
||||
NV_ENC_LOCK_BITSTREAM, NV_ENC_LOCK_BITSTREAM_VER, NV_ENC_LOCK_INPUT_BUFFER, NV_ENC_LOCK_INPUT_BUFFER_VER, NV_ENC_MEMORY_HEAP_SYSMEM_CACHED,
|
||||
NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS, NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER, NV_ENC_PARAMS_RC_CBR, NV_ENC_PARAMS_RC_VBR, NV_ENC_PIC_FLAG_EOS,
|
||||
NV_ENC_PIC_PARAMS, NV_ENC_PIC_PARAMS_VER, NV_ENC_PIC_STRUCT_FRAME, NV_ENC_PRESET_CONFIG, NV_ENC_PRESET_CONFIG_VER, NV_ENC_PRESET_P5_GUID,
|
||||
NV_ENC_RC_PARAMS_VER, NV_ENC_SEI_PAYLOAD, NV_ENC_SEQUENCE_PARAM_PAYLOAD, NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER, NV_ENC_SUCCESS, NV_ENC_TIER_HEVC_MAIN,
|
||||
NV_ENC_TUNING_INFO_HIGH_QUALITY, NV_ENC_VUI_COLOR_PRIMARIES_BT709, NV_ENC_VUI_MATRIX_COEFFS_BT709, NV_ENC_VUI_TRANSFER_CHARACTERISTIC_BT709,
|
||||
NV_ENC_VUI_VIDEO_FORMAT_UNSPECIFIED, NV_ENCODE_API_FUNCTION_LIST, NV_ENCODE_API_FUNCTION_LIST_VER, NVENCAPI_VERSION, NvStatus,
|
||||
};
|
||||
|
||||
/// The driver's entry points (loaded once).
|
||||
struct Api {
|
||||
|
||||
@@ -4,16 +4,19 @@
|
||||
//! header itself is not in this repository. To regenerate, compile a program printing `sizeof` /
|
||||
//! `offsetof` of the structures of `src/vaapi/ffi.rs`, the constants it uses, and the `value` word of
|
||||
//! each `seq_fields` / `pic_fields` bit-field set alone, against libva's MIT-licensed headers.
|
||||
#![allow(clippy::unreadable_literal)]
|
||||
|
||||
use super::ffi::*;
|
||||
use std::mem::{align_of, offset_of, size_of};
|
||||
|
||||
#[test]
|
||||
fn layouts_match_the_header() {
|
||||
fn vaconfigattrib_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<VAConfigAttrib>(), align_of::<VAConfigAttrib>()), (8, 4), "VAConfigAttrib");
|
||||
assert_eq!(offset_of!(VAConfigAttrib, type_), 0, "VAConfigAttrib.type");
|
||||
assert_eq!(offset_of!(VAConfigAttrib, value), 4, "VAConfigAttrib.value");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vapictureh264_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<VAPictureH264>(), align_of::<VAPictureH264>()), (36, 4), "VAPictureH264");
|
||||
assert_eq!(offset_of!(VAPictureH264, picture_id), 0, "VAPictureH264.picture_id");
|
||||
assert_eq!(offset_of!(VAPictureH264, frame_idx), 4, "VAPictureH264.frame_idx");
|
||||
@@ -21,6 +24,10 @@ fn layouts_match_the_header() {
|
||||
assert_eq!(offset_of!(VAPictureH264, TopFieldOrderCnt), 12, "VAPictureH264.TopFieldOrderCnt");
|
||||
assert_eq!(offset_of!(VAPictureH264, BottomFieldOrderCnt), 16, "VAPictureH264.BottomFieldOrderCnt");
|
||||
assert_eq!(offset_of!(VAPictureH264, va_reserved), 20, "VAPictureH264.va_reserved");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vapictureparameterbufferh264_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<VAPictureParameterBufferH264>(), align_of::<VAPictureParameterBufferH264>()), (672, 4), "VAPictureParameterBufferH264");
|
||||
assert_eq!(offset_of!(VAPictureParameterBufferH264, CurrPic), 0, "VAPictureParameterBufferH264.CurrPic");
|
||||
assert_eq!(offset_of!(VAPictureParameterBufferH264, ReferenceFrames), 36, "VAPictureParameterBufferH264.ReferenceFrames");
|
||||
@@ -40,10 +47,18 @@ fn layouts_match_the_header() {
|
||||
assert_eq!(offset_of!(VAPictureParameterBufferH264, pic_fields), 632, "VAPictureParameterBufferH264.pic_fields");
|
||||
assert_eq!(offset_of!(VAPictureParameterBufferH264, frame_num), 636, "VAPictureParameterBufferH264.frame_num");
|
||||
assert_eq!(offset_of!(VAPictureParameterBufferH264, va_reserved), 640, "VAPictureParameterBufferH264.va_reserved");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vaiqmatrixbufferh264_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<VAIQMatrixBufferH264>(), align_of::<VAIQMatrixBufferH264>()), (240, 4), "VAIQMatrixBufferH264");
|
||||
assert_eq!(offset_of!(VAIQMatrixBufferH264, ScalingList4x4), 0, "VAIQMatrixBufferH264.ScalingList4x4");
|
||||
assert_eq!(offset_of!(VAIQMatrixBufferH264, ScalingList8x8), 96, "VAIQMatrixBufferH264.ScalingList8x8");
|
||||
assert_eq!(offset_of!(VAIQMatrixBufferH264, va_reserved), 224, "VAIQMatrixBufferH264.va_reserved");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vasliceparameterbufferh264_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<VASliceParameterBufferH264>(), align_of::<VASliceParameterBufferH264>()), (3128, 4), "VASliceParameterBufferH264");
|
||||
assert_eq!(offset_of!(VASliceParameterBufferH264, slice_data_size), 0, "VASliceParameterBufferH264.slice_data_size");
|
||||
assert_eq!(offset_of!(VASliceParameterBufferH264, slice_data_offset), 4, "VASliceParameterBufferH264.slice_data_offset");
|
||||
@@ -59,6 +74,10 @@ fn layouts_match_the_header() {
|
||||
assert_eq!(offset_of!(VASliceParameterBufferH264, disable_deblocking_filter_idc), 22, "VASliceParameterBufferH264.disable_deblocking_filter_idc");
|
||||
assert_eq!(offset_of!(VASliceParameterBufferH264, slice_alpha_c0_offset_div2), 23, "VASliceParameterBufferH264.slice_alpha_c0_offset_div2");
|
||||
assert_eq!(offset_of!(VASliceParameterBufferH264, slice_beta_offset_div2), 24, "VASliceParameterBufferH264.slice_beta_offset_div2");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn va_h264_slice_reference_and_weight_layout_matches_the_header() {
|
||||
assert_eq!(offset_of!(VASliceParameterBufferH264, RefPicList0), 28, "VASliceParameterBufferH264.RefPicList0");
|
||||
assert_eq!(offset_of!(VASliceParameterBufferH264, RefPicList1), 1180, "VASliceParameterBufferH264.RefPicList1");
|
||||
assert_eq!(offset_of!(VASliceParameterBufferH264, luma_log2_weight_denom), 2332, "VASliceParameterBufferH264.luma_log2_weight_denom");
|
||||
@@ -76,6 +95,10 @@ fn layouts_match_the_header() {
|
||||
assert_eq!(offset_of!(VASliceParameterBufferH264, chroma_weight_l1), 2854, "VASliceParameterBufferH264.chroma_weight_l1");
|
||||
assert_eq!(offset_of!(VASliceParameterBufferH264, chroma_offset_l1), 2982, "VASliceParameterBufferH264.chroma_offset_l1");
|
||||
assert_eq!(offset_of!(VASliceParameterBufferH264, va_reserved), 3112, "VASliceParameterBufferH264.va_reserved");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vaimageformat_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<VAImageFormat>(), align_of::<VAImageFormat>()), (48, 4), "VAImageFormat");
|
||||
assert_eq!(offset_of!(VAImageFormat, fourcc), 0, "VAImageFormat.fourcc");
|
||||
assert_eq!(offset_of!(VAImageFormat, byte_order), 4, "VAImageFormat.byte_order");
|
||||
@@ -86,6 +109,10 @@ fn layouts_match_the_header() {
|
||||
assert_eq!(offset_of!(VAImageFormat, blue_mask), 24, "VAImageFormat.blue_mask");
|
||||
assert_eq!(offset_of!(VAImageFormat, alpha_mask), 28, "VAImageFormat.alpha_mask");
|
||||
assert_eq!(offset_of!(VAImageFormat, va_reserved), 32, "VAImageFormat.va_reserved");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vaimage_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<VAImage>(), align_of::<VAImage>()), (120, 4), "VAImage");
|
||||
assert_eq!(offset_of!(VAImage, image_id), 0, "VAImage.image_id");
|
||||
assert_eq!(offset_of!(VAImage, format), 4, "VAImage.format");
|
||||
@@ -100,11 +127,19 @@ fn layouts_match_the_header() {
|
||||
assert_eq!(offset_of!(VAImage, entry_bytes), 96, "VAImage.entry_bytes");
|
||||
assert_eq!(offset_of!(VAImage, component_order), 100, "VAImage.component_order");
|
||||
assert_eq!(offset_of!(VAImage, va_reserved), 104, "VAImage.va_reserved");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vapicturehevc_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<VAPictureHEVC>(), align_of::<VAPictureHEVC>()), (28, 4), "VAPictureHEVC");
|
||||
assert_eq!(offset_of!(VAPictureHEVC, picture_id), 0, "VAPictureHEVC.picture_id");
|
||||
assert_eq!(offset_of!(VAPictureHEVC, pic_order_cnt), 4, "VAPictureHEVC.pic_order_cnt");
|
||||
assert_eq!(offset_of!(VAPictureHEVC, flags), 8, "VAPictureHEVC.flags");
|
||||
assert_eq!(offset_of!(VAPictureHEVC, va_reserved), 12, "VAPictureHEVC.va_reserved");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vapictureparameterbufferhevc_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<VAPictureParameterBufferHEVC>(), align_of::<VAPictureParameterBufferHEVC>()), (604, 4), "VAPictureParameterBufferHEVC");
|
||||
assert_eq!(offset_of!(VAPictureParameterBufferHEVC, CurrPic), 0, "VAPictureParameterBufferHEVC.CurrPic");
|
||||
assert_eq!(offset_of!(VAPictureParameterBufferHEVC, ReferenceFrames), 28, "VAPictureParameterBufferHEVC.ReferenceFrames");
|
||||
@@ -177,6 +212,10 @@ fn layouts_match_the_header() {
|
||||
473,
|
||||
"VAPictureParameterBufferHEVC.log2_parallel_merge_level_minus2"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn va_hevc_picture_tile_and_reference_layout_matches_the_header() {
|
||||
assert_eq!(offset_of!(VAPictureParameterBufferHEVC, num_tile_columns_minus1), 474, "VAPictureParameterBufferHEVC.num_tile_columns_minus1");
|
||||
assert_eq!(offset_of!(VAPictureParameterBufferHEVC, num_tile_rows_minus1), 475, "VAPictureParameterBufferHEVC.num_tile_rows_minus1");
|
||||
assert_eq!(offset_of!(VAPictureParameterBufferHEVC, column_width_minus1), 476, "VAPictureParameterBufferHEVC.column_width_minus1");
|
||||
@@ -204,6 +243,10 @@ fn layouts_match_the_header() {
|
||||
assert_eq!(offset_of!(VAPictureParameterBufferHEVC, num_extra_slice_header_bits), 567, "VAPictureParameterBufferHEVC.num_extra_slice_header_bits");
|
||||
assert_eq!(offset_of!(VAPictureParameterBufferHEVC, st_rps_bits), 568, "VAPictureParameterBufferHEVC.st_rps_bits");
|
||||
assert_eq!(offset_of!(VAPictureParameterBufferHEVC, va_reserved), 572, "VAPictureParameterBufferHEVC.va_reserved");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vasliceparameterbufferhevc_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<VASliceParameterBufferHEVC>(), align_of::<VASliceParameterBufferHEVC>()), (264, 4), "VASliceParameterBufferHEVC");
|
||||
assert_eq!(offset_of!(VASliceParameterBufferHEVC, slice_data_size), 0, "VASliceParameterBufferHEVC.slice_data_size");
|
||||
assert_eq!(offset_of!(VASliceParameterBufferHEVC, slice_data_offset), 4, "VASliceParameterBufferHEVC.slice_data_offset");
|
||||
@@ -211,6 +254,10 @@ fn layouts_match_the_header() {
|
||||
assert_eq!(offset_of!(VASliceParameterBufferHEVC, slice_data_byte_offset), 12, "VASliceParameterBufferHEVC.slice_data_byte_offset");
|
||||
assert_eq!(offset_of!(VASliceParameterBufferHEVC, slice_segment_address), 16, "VASliceParameterBufferHEVC.slice_segment_address");
|
||||
assert_eq!(offset_of!(VASliceParameterBufferHEVC, RefPicList), 20, "VASliceParameterBufferHEVC.RefPicList");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn va_hevc_slice_flags_and_weight_layout_matches_the_header() {
|
||||
assert_eq!(offset_of!(VASliceParameterBufferHEVC, LongSliceFlags), 52, "VASliceParameterBufferHEVC.LongSliceFlags");
|
||||
assert_eq!(offset_of!(VASliceParameterBufferHEVC, collocated_ref_idx), 56, "VASliceParameterBufferHEVC.collocated_ref_idx");
|
||||
assert_eq!(offset_of!(VASliceParameterBufferHEVC, num_ref_idx_l0_active_minus1), 57, "VASliceParameterBufferHEVC.num_ref_idx_l0_active_minus1");
|
||||
@@ -235,6 +282,10 @@ fn layouts_match_the_header() {
|
||||
assert_eq!(offset_of!(VASliceParameterBufferHEVC, entry_offset_to_subset_array), 250, "VASliceParameterBufferHEVC.entry_offset_to_subset_array");
|
||||
assert_eq!(offset_of!(VASliceParameterBufferHEVC, slice_data_num_emu_prevn_bytes), 252, "VASliceParameterBufferHEVC.slice_data_num_emu_prevn_bytes");
|
||||
assert_eq!(offset_of!(VASliceParameterBufferHEVC, va_reserved), 256, "VASliceParameterBufferHEVC.va_reserved");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn vaiqmatrixbufferhevc_layout_matches_the_header() {
|
||||
assert_eq!((size_of::<VAIQMatrixBufferHEVC>(), align_of::<VAIQMatrixBufferHEVC>()), (1016, 4), "VAIQMatrixBufferHEVC");
|
||||
assert_eq!(offset_of!(VAIQMatrixBufferHEVC, ScalingList4x4), 0, "VAIQMatrixBufferHEVC.ScalingList4x4");
|
||||
assert_eq!(offset_of!(VAIQMatrixBufferHEVC, ScalingList8x8), 96, "VAIQMatrixBufferHEVC.ScalingList8x8");
|
||||
@@ -255,6 +306,10 @@ fn constants_match_the_header() {
|
||||
assert_eq!(VA_STATUS_ERROR_DECODING_ERROR as i64, 23, "VA_STATUS_ERROR_DECODING_ERROR");
|
||||
assert_eq!(VA_INVALID_ID as i64, 4294967295, "VA_INVALID_ID");
|
||||
assert_eq!(VA_INVALID_SURFACE as i64, 4294967295, "VA_INVALID_SURFACE");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn profiles_and_buffers_constants_match_the_header() {
|
||||
assert_eq!(VAProfileH264Main as i64, 6, "VAProfileH264Main");
|
||||
assert_eq!(VAProfileH264High as i64, 7, "VAProfileH264High");
|
||||
assert_eq!(VAProfileH264ConstrainedBaseline as i64, 13, "VAProfileH264ConstrainedBaseline");
|
||||
@@ -272,6 +327,10 @@ fn constants_match_the_header() {
|
||||
assert_eq!(VA_PICTURE_H264_LONG_TERM_REFERENCE as i64, 16, "VA_PICTURE_H264_LONG_TERM_REFERENCE");
|
||||
assert_eq!(VA_FOURCC_NV12 as i64, 842094158, "VA_FOURCC_NV12");
|
||||
assert_eq!(VA_FOURCC_P010 as i64, 808530000, "VA_FOURCC_P010");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hevc_constants_match_the_header() {
|
||||
assert_eq!(VAProfileHEVCMain as i64, 17, "VAProfileHEVCMain");
|
||||
assert_eq!(VAProfileHEVCMain10 as i64, 18, "VAProfileHEVCMain10");
|
||||
assert_eq!(VA_RT_FORMAT_YUV420_10 as i64, 256, "VA_RT_FORMAT_YUV420_10");
|
||||
@@ -298,6 +357,10 @@ fn bit_fields_match_the_header() {
|
||||
assert_eq!(3u32 << seq_bits::PIC_ORDER_CNT_TYPE, 0x3000, "seq_fields.pic_order_cnt_type");
|
||||
assert_eq!(15u32 << seq_bits::LOG2_MAX_PIC_ORDER_CNT_LSB_MINUS4, 0x3c000, "seq_fields.log2_max_pic_order_cnt_lsb_minus4");
|
||||
assert_eq!(1u32 << seq_bits::DELTA_PIC_ORDER_ALWAYS_ZERO, 0x40000, "seq_fields.delta_pic_order_always_zero_flag");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn h264_picture_bit_fields_match_the_header() {
|
||||
assert_eq!(1u32 << pic_bits::ENTROPY_CODING_MODE, 0x1, "pic_fields.entropy_coding_mode_flag");
|
||||
assert_eq!(1u32 << pic_bits::WEIGHTED_PRED, 0x2, "pic_fields.weighted_pred_flag");
|
||||
assert_eq!(3u32 << pic_bits::WEIGHTED_BIPRED_IDC, 0xc, "pic_fields.weighted_bipred_idc");
|
||||
@@ -308,6 +371,10 @@ fn bit_fields_match_the_header() {
|
||||
assert_eq!(1u32 << pic_bits::DEBLOCKING_FILTER_CONTROL_PRESENT, 0x100, "pic_fields.deblocking_filter_control_present_flag");
|
||||
assert_eq!(1u32 << pic_bits::REDUNDANT_PIC_CNT_PRESENT, 0x200, "pic_fields.redundant_pic_cnt_present_flag");
|
||||
assert_eq!(1u32 << pic_bits::REFERENCE_PIC, 0x400, "pic_fields.reference_pic_flag");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hevc_picture_bit_fields_match_the_header() {
|
||||
assert_eq!(3u32 << hevc_pic_bits::CHROMA_FORMAT_IDC, 0x3, "hevc pic_fields.chroma_format_idc");
|
||||
assert_eq!(1u32 << hevc_pic_bits::SEPARATE_COLOUR_PLANE, 0x4, "hevc pic_fields.separate_colour_plane_flag");
|
||||
assert_eq!(1u32 << hevc_pic_bits::PCM_ENABLED, 0x8, "hevc pic_fields.pcm_enabled_flag");
|
||||
@@ -328,6 +395,10 @@ fn bit_fields_match_the_header() {
|
||||
assert_eq!(1u32 << hevc_pic_bits::PCM_LOOP_FILTER_DISABLED, 0x40000, "hevc pic_fields.pcm_loop_filter_disabled_flag");
|
||||
assert_eq!(1u32 << hevc_pic_bits::NO_PIC_REORDERING, 0x80000, "hevc pic_fields.NoPicReorderingFlag");
|
||||
assert_eq!(1u32 << hevc_pic_bits::NO_BI_PRED, 0x100000, "hevc pic_fields.NoBiPredFlag");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hevc_slice_parsing_bit_fields_match_the_header() {
|
||||
assert_eq!(1u32 << hevc_slice_parsing_bits::LISTS_MODIFICATION_PRESENT, 0x1, "hevc slice_parsing_fields.lists_modification_present_flag");
|
||||
assert_eq!(1u32 << hevc_slice_parsing_bits::LONG_TERM_REF_PICS_PRESENT, 0x2, "hevc slice_parsing_fields.long_term_ref_pics_present_flag");
|
||||
assert_eq!(1u32 << hevc_slice_parsing_bits::SPS_TEMPORAL_MVP_ENABLED, 0x4, "hevc slice_parsing_fields.sps_temporal_mvp_enabled_flag");
|
||||
@@ -350,6 +421,10 @@ fn bit_fields_match_the_header() {
|
||||
assert_eq!(1u32 << hevc_slice_parsing_bits::RAP_PIC, 0x800, "hevc slice_parsing_fields.RapPicFlag");
|
||||
assert_eq!(1u32 << hevc_slice_parsing_bits::IDR_PIC, 0x1000, "hevc slice_parsing_fields.IdrPicFlag");
|
||||
assert_eq!(1u32 << hevc_slice_parsing_bits::INTRA_PIC, 0x2000, "hevc slice_parsing_fields.IntraPicFlag");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hevc_slice_bit_fields_match_the_header() {
|
||||
assert_eq!(1u32 << hevc_slice_bits::LAST_SLICE_OF_PIC, 0x1, "LongSliceFlags.LastSliceOfPic");
|
||||
assert_eq!(1u32 << hevc_slice_bits::DEPENDENT_SLICE_SEGMENT, 0x2, "LongSliceFlags.dependent_slice_segment_flag");
|
||||
assert_eq!(3u32 << hevc_slice_bits::SLICE_TYPE, 0xc, "LongSliceFlags.slice_type");
|
||||
|
||||
@@ -333,7 +333,7 @@ impl<A: Accel> Front<A> {
|
||||
let fpoc = if mmco5 { 0 } else { p.poc.frame() };
|
||||
let meta = Arc::new(output_meta(&p.sps, p.pts, p.first.idr));
|
||||
let mut outs = Vec::new();
|
||||
self.dpb.store_picture(&p.first, surface, fpoc, p.sps.max_frame_num(), p.sps.max_num_ref_frames as usize, meta, &mut outs).map_err(decode_err)?;
|
||||
self.dpb.store_picture(&p.first, surface, fpoc, (p.sps.max_frame_num(), p.sps.max_num_ref_frames as usize), meta, &mut outs).map_err(decode_err)?;
|
||||
self.read_out(outs, frames)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ fn project(w: u32, h: u32, frames: i64) -> (Arc<Project>, filmcraft_project::Ite
|
||||
let clip = p.add_item(
|
||||
&info.name.clone(),
|
||||
Label::Iris,
|
||||
ItemKind::Media(MediaClip {
|
||||
ItemKind::Media(Box::new(MediaClip {
|
||||
media: MediaRef::Generator(g.generator.clone()),
|
||||
info,
|
||||
interpret: Default::default(),
|
||||
@@ -31,7 +31,7 @@ fn project(w: u32, h: u32, frames: i64) -> (Arc<Project>, filmcraft_project::Ite
|
||||
offline: false,
|
||||
proxy: None,
|
||||
identity: None,
|
||||
}),
|
||||
})),
|
||||
None,
|
||||
);
|
||||
let seq = p.new_sequence("s", SequenceSettings { width: w, height: h, frame_rate: rate, ..Default::default() }, 1, 1, None);
|
||||
|
||||
@@ -58,7 +58,7 @@ fn picture(i: usize) -> Vec<f32> {
|
||||
fn planes(rgb: &[f32], signal: &ColorSignal) -> (Vec<u16>, Vec<u16>, Vec<u16>) {
|
||||
let (kr, kb) = signal.kr_kb();
|
||||
let (mut y, mut u, mut v) = (Vec::new(), Vec::new(), Vec::new());
|
||||
rgbf_to_yuv420_10(rgb, W, H, kr, kb, &mut y, &mut u, &mut v).expect("convert");
|
||||
rgbf_to_yuv420_10(rgb, W, H, filmcraft_export::Matrix::new(kr, kb), &mut y, &mut u, &mut v).expect("convert");
|
||||
(y, u, v)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user