From 683627242f69bed0b818d976d4b03d651e529697 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Fri, 20 Oct 2023 18:33:27 +0200 Subject: [PATCH] start work on nihed-cros-libva This is a fork of cros-libva at v0.0.3 without history preserved. The current commit corresponds to the checkout at that tag with unneeded files removed. --- nihed-cros-libva/Cargo.toml | 19 + nihed-cros-libva/LICENSE | 26 + nihed-cros-libva/README.md | 76 + nihed-cros-libva/bindgen.sh | 21 + nihed-cros-libva/build.rs | 18 + nihed-cros-libva/libva-wrapper.h | 6 + nihed-cros-libva/src/bindings.rs | 10 + nihed-cros-libva/src/bindings/va.rs | 8131 +++++++++++++++++ nihed-cros-libva/src/bindings/va/constants.rs | 347 + nihed-cros-libva/src/buffer.rs | 203 + nihed-cros-libva/src/buffer/h264.rs | 306 + nihed-cros-libva/src/buffer/mpeg2.rs | 172 + nihed-cros-libva/src/buffer/vp8.rs | 215 + nihed-cros-libva/src/buffer/vp9.rs | 221 + nihed-cros-libva/src/config.rs | 127 + nihed-cros-libva/src/context.rs | 95 + nihed-cros-libva/src/display.rs | 344 + nihed-cros-libva/src/generic_value.rs | 48 + nihed-cros-libva/src/image.rs | 212 + nihed-cros-libva/src/lib.rs | 233 + nihed-cros-libva/src/picture.rs | 271 + nihed-cros-libva/src/status.rs | 30 + nihed-cros-libva/src/surface.rs | 142 + nihed-cros-libva/src/usage_hint.rs | 27 + 24 files changed, 11300 insertions(+) create mode 100644 nihed-cros-libva/Cargo.toml create mode 100644 nihed-cros-libva/LICENSE create mode 100644 nihed-cros-libva/README.md create mode 100755 nihed-cros-libva/bindgen.sh create mode 100644 nihed-cros-libva/build.rs create mode 100644 nihed-cros-libva/libva-wrapper.h create mode 100644 nihed-cros-libva/src/bindings.rs create mode 100644 nihed-cros-libva/src/bindings/va.rs create mode 100644 nihed-cros-libva/src/bindings/va/constants.rs create mode 100644 nihed-cros-libva/src/buffer.rs create mode 100644 nihed-cros-libva/src/buffer/h264.rs create mode 100644 nihed-cros-libva/src/buffer/mpeg2.rs create mode 100644 nihed-cros-libva/src/buffer/vp8.rs create mode 100644 nihed-cros-libva/src/buffer/vp9.rs create mode 100644 nihed-cros-libva/src/config.rs create mode 100644 nihed-cros-libva/src/context.rs create mode 100644 nihed-cros-libva/src/display.rs create mode 100644 nihed-cros-libva/src/generic_value.rs create mode 100644 nihed-cros-libva/src/image.rs create mode 100644 nihed-cros-libva/src/lib.rs create mode 100644 nihed-cros-libva/src/picture.rs create mode 100644 nihed-cros-libva/src/status.rs create mode 100644 nihed-cros-libva/src/surface.rs create mode 100644 nihed-cros-libva/src/usage_hint.rs diff --git a/nihed-cros-libva/Cargo.toml b/nihed-cros-libva/Cargo.toml new file mode 100644 index 0000000..c23f83e --- /dev/null +++ b/nihed-cros-libva/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "cros-libva" +version = "0.0.3" +license = "BSD-3-Clause" +description = "Safe bindings over libva" +repository = "https://github.com/chromeos/cros-libva" +authors = ["The Chromium OS Authors"] +edition = "2021" + +[dependencies] +anyhow = "1" +bitflags = "1.3" +log = { version = "0", features = ["release_max_level_debug"] } + +[build-dependencies] +pkg-config = "0.3.26" + +[dev-dependencies] +crc32fast = "1.2.1" diff --git a/nihed-cros-libva/LICENSE b/nihed-cros-libva/LICENSE new file mode 100644 index 0000000..9c1f839 --- /dev/null +++ b/nihed-cros-libva/LICENSE @@ -0,0 +1,26 @@ +Copyright 2022 The ChromiumOS Authors + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/nihed-cros-libva/README.md b/nihed-cros-libva/README.md new file mode 100644 index 0000000..9ac35bc --- /dev/null +++ b/nihed-cros-libva/README.md @@ -0,0 +1,76 @@ +# Libva Rust Wrapper + +This crate provides lightweight and (hopefully) safe libva abstractions for use +within Rust code with minimal dependencies. It is developed for use in +ChromeOS, but has no ChromeOS specifics or dependencies and should thus be +usable anywhere. + +The first version was written by Daniel Almeida and hosted in the [crosvm +repository](https://chromium.googlesource.com/crosvm/crosvm/) before being +split out here. + +## Dependencies + +The native [libva](https://github.com/intel/libva) library is required at link +time, so make sure to have the `libva-dev` or equivalent package for your +distribution installed. The VA-API driver corresponding to your hardware is +also required: for Intel hardware it will be +[intel-media-driver](https://github.com/intel/media-driver), whereas AMD +hardware relies on [Mesa](https://gitlab.freedesktop.org/mesa/mesa). + +An easy way to see whether everything is in order is to run the `vainfo` +utility packaged with `libva-utils` or as a standalone package in some +distributions. `vainfo` will print the VA-API version, driver string, and a +list of supported profiles and endpoints, i.e.: + +``` +vainfo: VA-API version: 1.13 (libva 2.13.0) +vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 22.2.2 () +vainfo: Supported profile and entrypoints + VAProfileNone : VAEntrypointVideoProc + VAProfileNone : VAEntrypointStats + VAProfileMPEG2Simple : VAEntrypointVLD + VAProfileMPEG2Simple : VAEntrypointEncSlice + VAProfileMPEG2Main : VAEntrypointVLD + VAProfileMPEG2Main : VAEntrypointEncSlice + VAProfileH264Main : VAEntrypointVLD + etc +``` + +For decoding, the desired profile must be supported under `VAEntrypointVLD`. +For example, in order to decode VP8 media, this line must be present in the +output of `vainfo`: + +``` + VAProfileVP8Version0_3 : VAEntrypointVLD +``` + +Whereas to decode H264 Main profile media, this line must be present: + +``` + VAProfileH264Main : VAEntrypointVLD +``` + +For more information on VA-API and its usage within ChromeOS, see [this +guide](https://chromium.googlesource.com/chromium/src/+/master/docs/gpu/vaapi.md). + +## Using + +The name of this crate is `cros-libva` to highlight the fact that it originates +from ChromeOS and it not an official bindings. For ease of use, it is +recommended to rename it to just `libva` in your project by using the following +line in your `Cargo.toml`: + +``` +libva = { package = "cros-libva", version = "0.0.1" } +``` + +## Testing + +For a brief introduction on how to use this crate, see the +`libva_utils_mpeg2vldemo` test under `src/lib.rs`. You can also quickly test +MPEG2 decoding by running it: + +``` +cargo test -- --ignored libva_utils_mpeg2vldemo +``` diff --git a/nihed-cros-libva/bindgen.sh b/nihed-cros-libva/bindgen.sh new file mode 100755 index 0000000..be9fdf3 --- /dev/null +++ b/nihed-cros-libva/bindgen.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# Copyright 2022 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Regenerate libva bindgen bindings. + +set -euo pipefail +bindgen \ + --raw-line "pub mod constants;" \ + --with-derive-eq \ + --constified-enum-module "VA.*" \ + --allowlist-function "va.*" \ + --allowlist-type ".*MPEG2.*|.*VP8.*|.*VP9.*|.*H264.*" \ + "libva-wrapper.h" \ + > src/bindings/va.rs + +bindgen \ + --allowlist-var "VA.*" \ + "libva-wrapper.h" \ + > src/bindings/va/constants.rs diff --git a/nihed-cros-libva/build.rs b/nihed-cros-libva/build.rs new file mode 100644 index 0000000..10480ff --- /dev/null +++ b/nihed-cros-libva/build.rs @@ -0,0 +1,18 @@ +// Copyright 2022 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +fn main() { + // Do not require dependencies when generating docs. + if std::env::var("CARGO_DOC").is_ok() || std::env::var("DOCS_RS").is_ok() { + return; + } + + match pkg_config::probe_library("libva") { + Ok(_) => (), + Err(e) => panic!("libva not found: {}", e), + }; + + println!("cargo:rustc-link-lib=dylib=va"); + println!("cargo:rustc-link-lib=dylib=va-drm"); // for the vaGetDisplayDRM entrypoint +} diff --git a/nihed-cros-libva/libva-wrapper.h b/nihed-cros-libva/libva-wrapper.h new file mode 100644 index 0000000..5020e22 --- /dev/null +++ b/nihed-cros-libva/libva-wrapper.h @@ -0,0 +1,6 @@ +// Copyright 2022 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include +#include diff --git a/nihed-cros-libva/src/bindings.rs b/nihed-cros-libva/src/bindings.rs new file mode 100644 index 0000000..53a1c77 --- /dev/null +++ b/nihed-cros-libva/src/bindings.rs @@ -0,0 +1,10 @@ +// Copyright 2022 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +//! This module implements the bindgen C FFI bindings for use within this crate + +#[allow(missing_docs, clippy::useless_transmute, clippy::too_many_arguments)] +pub mod va; + +pub use va::*; diff --git a/nihed-cros-libva/src/bindings/va.rs b/nihed-cros-libva/src/bindings/va.rs new file mode 100644 index 0000000..42bbd82 --- /dev/null +++ b/nihed-cros-libva/src/bindings/va.rs @@ -0,0 +1,8131 @@ +/* automatically generated by tools/bindgen-all-the-things */ + +#![allow(clippy::missing_safety_doc)] +#![allow(clippy::upper_case_acronyms)] +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(dead_code)] + +pub mod constants; + +#[repr(C)] +#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub struct __BindgenBitfieldUnit { + storage: Storage, +} +impl __BindgenBitfieldUnit { + #[inline] + pub const fn new(storage: Storage) -> Self { + Self { storage } + } +} +impl __BindgenBitfieldUnit +where + Storage: AsRef<[u8]> + AsMut<[u8]>, +{ + #[inline] + pub fn get_bit(&self, index: usize) -> bool { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = self.storage.as_ref()[byte_index]; + let bit_index = if cfg!(target_endian = "big") { + 7 - (index % 8) + } else { + index % 8 + }; + let mask = 1 << bit_index; + byte & mask == mask + } + #[inline] + pub fn set_bit(&mut self, index: usize, val: bool) { + debug_assert!(index / 8 < self.storage.as_ref().len()); + let byte_index = index / 8; + let byte = &mut self.storage.as_mut()[byte_index]; + let bit_index = if cfg!(target_endian = "big") { + 7 - (index % 8) + } else { + index % 8 + }; + let mask = 1 << bit_index; + if val { + *byte |= mask; + } else { + *byte &= !mask; + } + } + #[inline] + pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + let mut val = 0; + for i in 0..(bit_width as usize) { + if self.get_bit(i + bit_offset) { + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + val |= 1 << index; + } + } + val + } + #[inline] + pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { + debug_assert!(bit_width <= 64); + debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); + debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); + for i in 0..(bit_width as usize) { + let mask = 1 << i; + let val_bit_is_set = val & mask == mask; + let index = if cfg!(target_endian = "big") { + bit_width as usize - 1 - i + } else { + i + }; + self.set_bit(index + bit_offset, val_bit_is_set); + } + } +} +pub type __int8_t = ::std::os::raw::c_schar; +pub type __uint8_t = ::std::os::raw::c_uchar; +pub type __int16_t = ::std::os::raw::c_short; +pub type __uint16_t = ::std::os::raw::c_ushort; +pub type __int32_t = ::std::os::raw::c_int; +pub type __uint32_t = ::std::os::raw::c_uint; +pub type __uint64_t = ::std::os::raw::c_ulong; +pub type VADisplay = *mut ::std::os::raw::c_void; +pub type VAStatus = ::std::os::raw::c_int; +extern "C" { + pub fn vaErrorStr(error_status: VAStatus) -> *const ::std::os::raw::c_char; +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAMotionVector { + pub mv0: [i16; 2usize], + pub mv1: [i16; 2usize], +} +pub type VAMotionVector = _VAMotionVector; +pub type VAMessageCallback = ::std::option::Option< + unsafe extern "C" fn( + user_context: *mut ::std::os::raw::c_void, + message: *const ::std::os::raw::c_char, + ), +>; +extern "C" { + pub fn vaSetErrorCallback( + dpy: VADisplay, + callback: VAMessageCallback, + user_context: *mut ::std::os::raw::c_void, + ) -> VAMessageCallback; +} +extern "C" { + pub fn vaSetInfoCallback( + dpy: VADisplay, + callback: VAMessageCallback, + user_context: *mut ::std::os::raw::c_void, + ) -> VAMessageCallback; +} +extern "C" { + pub fn vaDisplayIsValid(dpy: VADisplay) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vaSetDriverName(dpy: VADisplay, driver_name: *mut ::std::os::raw::c_char) -> VAStatus; +} +extern "C" { + pub fn vaInitialize( + dpy: VADisplay, + major_version: *mut ::std::os::raw::c_int, + minor_version: *mut ::std::os::raw::c_int, + ) -> VAStatus; +} +extern "C" { + pub fn vaTerminate(dpy: VADisplay) -> VAStatus; +} +extern "C" { + pub fn vaQueryVendorString(dpy: VADisplay) -> *const ::std::os::raw::c_char; +} +pub type VAPrivFunc = ::std::option::Option ::std::os::raw::c_int>; +extern "C" { + pub fn vaGetLibFunc(dpy: VADisplay, func: *const ::std::os::raw::c_char) -> VAPrivFunc; +} +pub mod VAProfile { + pub type Type = ::std::os::raw::c_int; + pub const VAProfileNone: Type = -1; + pub const VAProfileMPEG2Simple: Type = 0; + pub const VAProfileMPEG2Main: Type = 1; + pub const VAProfileMPEG4Simple: Type = 2; + pub const VAProfileMPEG4AdvancedSimple: Type = 3; + pub const VAProfileMPEG4Main: Type = 4; + pub const VAProfileH264Baseline: Type = 5; + pub const VAProfileH264Main: Type = 6; + pub const VAProfileH264High: Type = 7; + pub const VAProfileVC1Simple: Type = 8; + pub const VAProfileVC1Main: Type = 9; + pub const VAProfileVC1Advanced: Type = 10; + pub const VAProfileH263Baseline: Type = 11; + pub const VAProfileJPEGBaseline: Type = 12; + pub const VAProfileH264ConstrainedBaseline: Type = 13; + pub const VAProfileVP8Version0_3: Type = 14; + pub const VAProfileH264MultiviewHigh: Type = 15; + pub const VAProfileH264StereoHigh: Type = 16; + pub const VAProfileHEVCMain: Type = 17; + pub const VAProfileHEVCMain10: Type = 18; + pub const VAProfileVP9Profile0: Type = 19; + pub const VAProfileVP9Profile1: Type = 20; + pub const VAProfileVP9Profile2: Type = 21; + pub const VAProfileVP9Profile3: Type = 22; + pub const VAProfileHEVCMain12: Type = 23; + pub const VAProfileHEVCMain422_10: Type = 24; + pub const VAProfileHEVCMain422_12: Type = 25; + pub const VAProfileHEVCMain444: Type = 26; + pub const VAProfileHEVCMain444_10: Type = 27; + pub const VAProfileHEVCMain444_12: Type = 28; + pub const VAProfileHEVCSccMain: Type = 29; + pub const VAProfileHEVCSccMain10: Type = 30; + pub const VAProfileHEVCSccMain444: Type = 31; + pub const VAProfileAV1Profile0: Type = 32; + pub const VAProfileAV1Profile1: Type = 33; + pub const VAProfileHEVCSccMain444_10: Type = 34; + pub const VAProfileProtected: Type = 35; +} +pub mod VAEntrypoint { + pub type Type = ::std::os::raw::c_uint; + pub const VAEntrypointVLD: Type = 1; + pub const VAEntrypointIZZ: Type = 2; + pub const VAEntrypointIDCT: Type = 3; + pub const VAEntrypointMoComp: Type = 4; + pub const VAEntrypointDeblocking: Type = 5; + pub const VAEntrypointEncSlice: Type = 6; + pub const VAEntrypointEncPicture: Type = 7; + pub const VAEntrypointEncSliceLP: Type = 8; + pub const VAEntrypointVideoProc: Type = 10; + pub const VAEntrypointFEI: Type = 11; + pub const VAEntrypointStats: Type = 12; + pub const VAEntrypointProtectedTEEComm: Type = 13; + pub const VAEntrypointProtectedContent: Type = 14; +} +pub mod VAConfigAttribType { + pub type Type = ::std::os::raw::c_uint; + pub const VAConfigAttribRTFormat: Type = 0; + pub const VAConfigAttribSpatialResidual: Type = 1; + pub const VAConfigAttribSpatialClipping: Type = 2; + pub const VAConfigAttribIntraResidual: Type = 3; + pub const VAConfigAttribEncryption: Type = 4; + pub const VAConfigAttribRateControl: Type = 5; + pub const VAConfigAttribDecSliceMode: Type = 6; + pub const VAConfigAttribDecJPEG: Type = 7; + pub const VAConfigAttribDecProcessing: Type = 8; + pub const VAConfigAttribEncPackedHeaders: Type = 10; + pub const VAConfigAttribEncInterlaced: Type = 11; + pub const VAConfigAttribEncMaxRefFrames: Type = 13; + pub const VAConfigAttribEncMaxSlices: Type = 14; + pub const VAConfigAttribEncSliceStructure: Type = 15; + pub const VAConfigAttribEncMacroblockInfo: Type = 16; + pub const VAConfigAttribMaxPictureWidth: Type = 18; + pub const VAConfigAttribMaxPictureHeight: Type = 19; + pub const VAConfigAttribEncJPEG: Type = 20; + pub const VAConfigAttribEncQualityRange: Type = 21; + pub const VAConfigAttribEncQuantization: Type = 22; + pub const VAConfigAttribEncIntraRefresh: Type = 23; + pub const VAConfigAttribEncSkipFrame: Type = 24; + pub const VAConfigAttribEncROI: Type = 25; + pub const VAConfigAttribEncRateControlExt: Type = 26; + pub const VAConfigAttribProcessingRate: Type = 27; + pub const VAConfigAttribEncDirtyRect: Type = 28; + pub const VAConfigAttribEncParallelRateControl: Type = 29; + pub const VAConfigAttribEncDynamicScaling: Type = 30; + pub const VAConfigAttribFrameSizeToleranceSupport: Type = 31; + pub const VAConfigAttribFEIFunctionType: Type = 32; + pub const VAConfigAttribFEIMVPredictors: Type = 33; + pub const VAConfigAttribStats: Type = 34; + pub const VAConfigAttribEncTileSupport: Type = 35; + pub const VAConfigAttribCustomRoundingControl: Type = 36; + pub const VAConfigAttribQPBlockSize: Type = 37; + pub const VAConfigAttribMaxFrameSize: Type = 38; + pub const VAConfigAttribPredictionDirection: Type = 39; + pub const VAConfigAttribMultipleFrame: Type = 40; + pub const VAConfigAttribContextPriority: Type = 41; + pub const VAConfigAttribDecAV1Features: Type = 42; + pub const VAConfigAttribTEEType: Type = 43; + pub const VAConfigAttribTEETypeClient: Type = 44; + pub const VAConfigAttribProtectedContentCipherAlgorithm: Type = 45; + pub const VAConfigAttribProtectedContentCipherBlockSize: Type = 46; + pub const VAConfigAttribProtectedContentCipherMode: Type = 47; + pub const VAConfigAttribProtectedContentCipherSampleType: Type = 48; + pub const VAConfigAttribProtectedContentUsage: Type = 49; + pub const VAConfigAttribEncHEVCFeatures: Type = 50; + pub const VAConfigAttribEncHEVCBlockSizes: Type = 51; + pub const VAConfigAttribEncAV1: Type = 52; + pub const VAConfigAttribEncAV1Ext1: Type = 53; + pub const VAConfigAttribEncAV1Ext2: Type = 54; + pub const VAConfigAttribEncPerBlockControl: Type = 55; + pub const VAConfigAttribTypeMax: Type = 56; +} +#[repr(C)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub struct _VAConfigAttrib { + pub type_: VAConfigAttribType::Type, + pub value: u32, +} +impl Default for _VAConfigAttrib { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAConfigAttrib = _VAConfigAttrib; +extern "C" { + pub fn vaMaxNumProfiles(dpy: VADisplay) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vaMaxNumEntrypoints(dpy: VADisplay) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vaMaxNumConfigAttributes(dpy: VADisplay) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vaQueryConfigProfiles( + dpy: VADisplay, + profile_list: *mut VAProfile::Type, + num_profiles: *mut ::std::os::raw::c_int, + ) -> VAStatus; +} +extern "C" { + pub fn vaQueryConfigEntrypoints( + dpy: VADisplay, + profile: VAProfile::Type, + entrypoint_list: *mut VAEntrypoint::Type, + num_entrypoints: *mut ::std::os::raw::c_int, + ) -> VAStatus; +} +extern "C" { + pub fn vaGetConfigAttributes( + dpy: VADisplay, + profile: VAProfile::Type, + entrypoint: VAEntrypoint::Type, + attrib_list: *mut VAConfigAttrib, + num_attribs: ::std::os::raw::c_int, + ) -> VAStatus; +} +pub type VAGenericID = ::std::os::raw::c_uint; +pub type VAConfigID = VAGenericID; +extern "C" { + pub fn vaCreateConfig( + dpy: VADisplay, + profile: VAProfile::Type, + entrypoint: VAEntrypoint::Type, + attrib_list: *mut VAConfigAttrib, + num_attribs: ::std::os::raw::c_int, + config_id: *mut VAConfigID, + ) -> VAStatus; +} +extern "C" { + pub fn vaDestroyConfig(dpy: VADisplay, config_id: VAConfigID) -> VAStatus; +} +extern "C" { + pub fn vaQueryConfigAttributes( + dpy: VADisplay, + config_id: VAConfigID, + profile: *mut VAProfile::Type, + entrypoint: *mut VAEntrypoint::Type, + attrib_list: *mut VAConfigAttrib, + num_attribs: *mut ::std::os::raw::c_int, + ) -> VAStatus; +} +pub type VAContextID = VAGenericID; +pub type VASurfaceID = VAGenericID; +pub mod VAGenericValueType { + pub type Type = ::std::os::raw::c_uint; + pub const VAGenericValueTypeInteger: Type = 1; + pub const VAGenericValueTypeFloat: Type = 2; + pub const VAGenericValueTypePointer: Type = 3; + pub const VAGenericValueTypeFunc: Type = 4; +} +pub type VAGenericFunc = ::std::option::Option; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAGenericValue { + pub type_: VAGenericValueType::Type, + pub value: _VAGenericValue__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAGenericValue__bindgen_ty_1 { + pub i: i32, + pub f: f32, + pub p: *mut ::std::os::raw::c_void, + pub fn_: VAGenericFunc, +} +impl Default for _VAGenericValue__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAGenericValue { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAGenericValue = _VAGenericValue; +pub mod VASurfaceAttribType { + pub type Type = ::std::os::raw::c_uint; + pub const VASurfaceAttribNone: Type = 0; + pub const VASurfaceAttribPixelFormat: Type = 1; + pub const VASurfaceAttribMinWidth: Type = 2; + pub const VASurfaceAttribMaxWidth: Type = 3; + pub const VASurfaceAttribMinHeight: Type = 4; + pub const VASurfaceAttribMaxHeight: Type = 5; + pub const VASurfaceAttribMemoryType: Type = 6; + pub const VASurfaceAttribExternalBufferDescriptor: Type = 7; + pub const VASurfaceAttribUsageHint: Type = 8; + pub const VASurfaceAttribDRMFormatModifiers: Type = 9; + pub const VASurfaceAttribCount: Type = 10; +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VASurfaceAttrib { + pub type_: VASurfaceAttribType::Type, + pub flags: u32, + pub value: VAGenericValue, +} +impl Default for _VASurfaceAttrib { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VASurfaceAttrib = _VASurfaceAttrib; +extern "C" { + pub fn vaQuerySurfaceAttributes( + dpy: VADisplay, + config: VAConfigID, + attrib_list: *mut VASurfaceAttrib, + num_attribs: *mut ::std::os::raw::c_uint, + ) -> VAStatus; +} +extern "C" { + pub fn vaCreateSurfaces( + dpy: VADisplay, + format: ::std::os::raw::c_uint, + width: ::std::os::raw::c_uint, + height: ::std::os::raw::c_uint, + surfaces: *mut VASurfaceID, + num_surfaces: ::std::os::raw::c_uint, + attrib_list: *mut VASurfaceAttrib, + num_attribs: ::std::os::raw::c_uint, + ) -> VAStatus; +} +extern "C" { + pub fn vaDestroySurfaces( + dpy: VADisplay, + surfaces: *mut VASurfaceID, + num_surfaces: ::std::os::raw::c_int, + ) -> VAStatus; +} +extern "C" { + pub fn vaCreateContext( + dpy: VADisplay, + config_id: VAConfigID, + picture_width: ::std::os::raw::c_int, + picture_height: ::std::os::raw::c_int, + flag: ::std::os::raw::c_int, + render_targets: *mut VASurfaceID, + num_render_targets: ::std::os::raw::c_int, + context: *mut VAContextID, + ) -> VAStatus; +} +extern "C" { + pub fn vaDestroyContext(dpy: VADisplay, context: VAContextID) -> VAStatus; +} +pub type VAMFContextID = VAGenericID; +extern "C" { + pub fn vaCreateMFContext(dpy: VADisplay, mf_context: *mut VAMFContextID) -> VAStatus; +} +extern "C" { + pub fn vaMFAddContext( + dpy: VADisplay, + mf_context: VAMFContextID, + context: VAContextID, + ) -> VAStatus; +} +extern "C" { + pub fn vaMFReleaseContext( + dpy: VADisplay, + mf_context: VAMFContextID, + context: VAContextID, + ) -> VAStatus; +} +pub type VABufferID = VAGenericID; +pub mod VABufferType { + pub type Type = ::std::os::raw::c_uint; + pub const VAPictureParameterBufferType: Type = 0; + pub const VAIQMatrixBufferType: Type = 1; + pub const VABitPlaneBufferType: Type = 2; + pub const VASliceGroupMapBufferType: Type = 3; + pub const VASliceParameterBufferType: Type = 4; + pub const VASliceDataBufferType: Type = 5; + pub const VAMacroblockParameterBufferType: Type = 6; + pub const VAResidualDataBufferType: Type = 7; + pub const VADeblockingParameterBufferType: Type = 8; + pub const VAImageBufferType: Type = 9; + pub const VAProtectedSliceDataBufferType: Type = 10; + pub const VAQMatrixBufferType: Type = 11; + pub const VAHuffmanTableBufferType: Type = 12; + pub const VAProbabilityBufferType: Type = 13; + pub const VAEncCodedBufferType: Type = 21; + pub const VAEncSequenceParameterBufferType: Type = 22; + pub const VAEncPictureParameterBufferType: Type = 23; + pub const VAEncSliceParameterBufferType: Type = 24; + pub const VAEncPackedHeaderParameterBufferType: Type = 25; + pub const VAEncPackedHeaderDataBufferType: Type = 26; + pub const VAEncMiscParameterBufferType: Type = 27; + pub const VAEncMacroblockParameterBufferType: Type = 28; + pub const VAEncMacroblockMapBufferType: Type = 29; + pub const VAEncQPBufferType: Type = 30; + pub const VAProcPipelineParameterBufferType: Type = 41; + pub const VAProcFilterParameterBufferType: Type = 42; + pub const VAEncFEIMVBufferType: Type = 43; + pub const VAEncFEIMBCodeBufferType: Type = 44; + pub const VAEncFEIDistortionBufferType: Type = 45; + pub const VAEncFEIMBControlBufferType: Type = 46; + pub const VAEncFEIMVPredictorBufferType: Type = 47; + pub const VAStatsStatisticsParameterBufferType: Type = 48; + pub const VAStatsStatisticsBufferType: Type = 49; + pub const VAStatsStatisticsBottomFieldBufferType: Type = 50; + pub const VAStatsMVBufferType: Type = 51; + pub const VAStatsMVPredictorBufferType: Type = 52; + pub const VAEncMacroblockDisableSkipMapBufferType: Type = 53; + pub const VAEncFEICTBCmdBufferType: Type = 54; + pub const VAEncFEICURecordBufferType: Type = 55; + pub const VADecodeStreamoutBufferType: Type = 56; + pub const VASubsetsParameterBufferType: Type = 57; + pub const VAContextParameterUpdateBufferType: Type = 58; + pub const VAProtectedSessionExecuteBufferType: Type = 59; + pub const VAEncryptionParameterBufferType: Type = 60; + pub const VAEncDeltaQpPerBlockBufferType: Type = 61; + pub const VABufferTypeMax: Type = 62; +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAProcessingRateParameterEnc { + pub level_idc: u8, + pub reserved: [u8; 3usize], + pub quality_level: u32, + pub intra_period: u32, + pub ip_period: u32, +} +pub type VAProcessingRateParameterEnc = _VAProcessingRateParameterEnc; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAProcessingRateParameterDec { + pub level_idc: u8, + pub reserved0: [u8; 3usize], + pub reserved: u32, +} +pub type VAProcessingRateParameterDec = _VAProcessingRateParameterDec; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAProcessingRateParameter { + pub __bindgen_anon_1: _VAProcessingRateParameter__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAProcessingRateParameter__bindgen_ty_1 { + pub proc_buf_enc: VAProcessingRateParameterEnc, + pub proc_buf_dec: VAProcessingRateParameterDec, +} +impl Default for _VAProcessingRateParameter__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAProcessingRateParameter { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAProcessingRateParameter = _VAProcessingRateParameter; +extern "C" { + pub fn vaQueryProcessingRate( + dpy: VADisplay, + config: VAConfigID, + proc_buf: *mut VAProcessingRateParameter, + processing_rate: *mut ::std::os::raw::c_uint, + ) -> VAStatus; +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAPictureParameterBufferMPEG2 { + pub horizontal_size: u16, + pub vertical_size: u16, + pub forward_reference_picture: VASurfaceID, + pub backward_reference_picture: VASurfaceID, + pub picture_coding_type: i32, + pub f_code: i32, + pub picture_coding_extension: _VAPictureParameterBufferMPEG2__bindgen_ty_1, + pub va_reserved: [u32; 4usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAPictureParameterBufferMPEG2__bindgen_ty_1 { + pub bits: _VAPictureParameterBufferMPEG2__bindgen_ty_1__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAPictureParameterBufferMPEG2__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>, + pub __bindgen_padding_0: u16, +} +impl _VAPictureParameterBufferMPEG2__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn intra_dc_precision(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) } + } + #[inline] + pub fn set_intra_dc_precision(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 2u8, val as u64) + } + } + #[inline] + pub fn picture_structure(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u32) } + } + #[inline] + pub fn set_picture_structure(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 2u8, val as u64) + } + } + #[inline] + pub fn top_field_first(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) } + } + #[inline] + pub fn set_top_field_first(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn frame_pred_frame_dct(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u32) } + } + #[inline] + pub fn set_frame_pred_frame_dct(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 1u8, val as u64) + } + } + #[inline] + pub fn concealment_motion_vectors(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u32) } + } + #[inline] + pub fn set_concealment_motion_vectors(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(6usize, 1u8, val as u64) + } + } + #[inline] + pub fn q_scale_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) } + } + #[inline] + pub fn set_q_scale_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(7usize, 1u8, val as u64) + } + } + #[inline] + pub fn intra_vlc_format(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u32) } + } + #[inline] + pub fn set_intra_vlc_format(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 1u8, val as u64) + } + } + #[inline] + pub fn alternate_scan(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u32) } + } + #[inline] + pub fn set_alternate_scan(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(9usize, 1u8, val as u64) + } + } + #[inline] + pub fn repeat_first_field(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u32) } + } + #[inline] + pub fn set_repeat_first_field(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(10usize, 1u8, val as u64) + } + } + #[inline] + pub fn progressive_frame(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(11usize, 1u8) as u32) } + } + #[inline] + pub fn set_progressive_frame(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(11usize, 1u8, val as u64) + } + } + #[inline] + pub fn is_first_field(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 1u8) as u32) } + } + #[inline] + pub fn set_is_first_field(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(12usize, 1u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + intra_dc_precision: u32, + picture_structure: u32, + top_field_first: u32, + frame_pred_frame_dct: u32, + concealment_motion_vectors: u32, + q_scale_type: u32, + intra_vlc_format: u32, + alternate_scan: u32, + repeat_first_field: u32, + progressive_frame: u32, + is_first_field: u32, + ) -> __BindgenBitfieldUnit<[u8; 2usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 2u8, { + let intra_dc_precision: u32 = unsafe { ::std::mem::transmute(intra_dc_precision) }; + intra_dc_precision as u64 + }); + __bindgen_bitfield_unit.set(2usize, 2u8, { + let picture_structure: u32 = unsafe { ::std::mem::transmute(picture_structure) }; + picture_structure as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let top_field_first: u32 = unsafe { ::std::mem::transmute(top_field_first) }; + top_field_first as u64 + }); + __bindgen_bitfield_unit.set(5usize, 1u8, { + let frame_pred_frame_dct: u32 = unsafe { ::std::mem::transmute(frame_pred_frame_dct) }; + frame_pred_frame_dct as u64 + }); + __bindgen_bitfield_unit.set(6usize, 1u8, { + let concealment_motion_vectors: u32 = + unsafe { ::std::mem::transmute(concealment_motion_vectors) }; + concealment_motion_vectors as u64 + }); + __bindgen_bitfield_unit.set(7usize, 1u8, { + let q_scale_type: u32 = unsafe { ::std::mem::transmute(q_scale_type) }; + q_scale_type as u64 + }); + __bindgen_bitfield_unit.set(8usize, 1u8, { + let intra_vlc_format: u32 = unsafe { ::std::mem::transmute(intra_vlc_format) }; + intra_vlc_format as u64 + }); + __bindgen_bitfield_unit.set(9usize, 1u8, { + let alternate_scan: u32 = unsafe { ::std::mem::transmute(alternate_scan) }; + alternate_scan as u64 + }); + __bindgen_bitfield_unit.set(10usize, 1u8, { + let repeat_first_field: u32 = unsafe { ::std::mem::transmute(repeat_first_field) }; + repeat_first_field as u64 + }); + __bindgen_bitfield_unit.set(11usize, 1u8, { + let progressive_frame: u32 = unsafe { ::std::mem::transmute(progressive_frame) }; + progressive_frame as u64 + }); + __bindgen_bitfield_unit.set(12usize, 1u8, { + let is_first_field: u32 = unsafe { ::std::mem::transmute(is_first_field) }; + is_first_field as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAPictureParameterBufferMPEG2__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAPictureParameterBufferMPEG2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAPictureParameterBufferMPEG2 = _VAPictureParameterBufferMPEG2; +#[repr(C)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub struct _VAIQMatrixBufferMPEG2 { + pub load_intra_quantiser_matrix: i32, + pub load_non_intra_quantiser_matrix: i32, + pub load_chroma_intra_quantiser_matrix: i32, + pub load_chroma_non_intra_quantiser_matrix: i32, + pub intra_quantiser_matrix: [u8; 64usize], + pub non_intra_quantiser_matrix: [u8; 64usize], + pub chroma_intra_quantiser_matrix: [u8; 64usize], + pub chroma_non_intra_quantiser_matrix: [u8; 64usize], + pub va_reserved: [u32; 4usize], +} +impl Default for _VAIQMatrixBufferMPEG2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAIQMatrixBufferMPEG2 = _VAIQMatrixBufferMPEG2; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VASliceParameterBufferMPEG2 { + pub slice_data_size: u32, + pub slice_data_offset: u32, + pub slice_data_flag: u32, + pub macroblock_offset: u32, + pub slice_horizontal_position: u32, + pub slice_vertical_position: u32, + pub quantiser_scale_code: i32, + pub intra_slice_flag: i32, + pub va_reserved: [u32; 4usize], +} +pub type VASliceParameterBufferMPEG2 = _VASliceParameterBufferMPEG2; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAMacroblockParameterBufferMPEG2 { + pub macroblock_address: u16, + pub macroblock_type: u8, + pub macroblock_modes: _VAMacroblockParameterBufferMPEG2__bindgen_ty_1, + pub motion_vertical_field_select: u8, + pub PMV: [[[i16; 2usize]; 2usize]; 2usize], + pub coded_block_pattern: u16, + pub num_skipped_macroblocks: u16, + pub va_reserved: [u32; 4usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAMacroblockParameterBufferMPEG2__bindgen_ty_1 { + pub bits: _VAMacroblockParameterBufferMPEG2__bindgen_ty_1__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAMacroblockParameterBufferMPEG2__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, + pub __bindgen_padding_0: [u8; 3usize], +} +impl _VAMacroblockParameterBufferMPEG2__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn frame_motion_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) } + } + #[inline] + pub fn set_frame_motion_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 2u8, val as u64) + } + } + #[inline] + pub fn field_motion_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u32) } + } + #[inline] + pub fn set_field_motion_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 2u8, val as u64) + } + } + #[inline] + pub fn dct_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) } + } + #[inline] + pub fn set_dct_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + frame_motion_type: u32, + field_motion_type: u32, + dct_type: u32, + ) -> __BindgenBitfieldUnit<[u8; 1usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 2u8, { + let frame_motion_type: u32 = unsafe { ::std::mem::transmute(frame_motion_type) }; + frame_motion_type as u64 + }); + __bindgen_bitfield_unit.set(2usize, 2u8, { + let field_motion_type: u32 = unsafe { ::std::mem::transmute(field_motion_type) }; + field_motion_type as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let dct_type: u32 = unsafe { ::std::mem::transmute(dct_type) }; + dct_type as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAMacroblockParameterBufferMPEG2__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAMacroblockParameterBufferMPEG2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAMacroblockParameterBufferMPEG2 = _VAMacroblockParameterBufferMPEG2; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAPictureH264 { + pub picture_id: VASurfaceID, + pub frame_idx: u32, + pub flags: u32, + pub TopFieldOrderCnt: i32, + pub BottomFieldOrderCnt: i32, + pub va_reserved: [u32; 4usize], +} +pub type VAPictureH264 = _VAPictureH264; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAPictureParameterBufferH264 { + pub CurrPic: VAPictureH264, + pub ReferenceFrames: [VAPictureH264; 16usize], + pub picture_width_in_mbs_minus1: u16, + pub picture_height_in_mbs_minus1: u16, + pub bit_depth_luma_minus8: u8, + pub bit_depth_chroma_minus8: u8, + pub num_ref_frames: u8, + pub seq_fields: _VAPictureParameterBufferH264__bindgen_ty_1, + pub num_slice_groups_minus1: u8, + pub slice_group_map_type: u8, + pub slice_group_change_rate_minus1: u16, + pub pic_init_qp_minus26: i8, + pub pic_init_qs_minus26: i8, + pub chroma_qp_index_offset: i8, + pub second_chroma_qp_index_offset: i8, + pub pic_fields: _VAPictureParameterBufferH264__bindgen_ty_2, + pub frame_num: u16, + pub va_reserved: [u32; 8usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAPictureParameterBufferH264__bindgen_ty_1 { + pub bits: _VAPictureParameterBufferH264__bindgen_ty_1__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAPictureParameterBufferH264__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 3usize]>, + pub __bindgen_padding_0: u8, +} +impl _VAPictureParameterBufferH264__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn chroma_format_idc(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) } + } + #[inline] + pub fn set_chroma_format_idc(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 2u8, val as u64) + } + } + #[inline] + pub fn residual_colour_transform_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) } + } + #[inline] + pub fn set_residual_colour_transform_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 1u8, val as u64) + } + } + #[inline] + pub fn gaps_in_frame_num_value_allowed_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) } + } + #[inline] + pub fn set_gaps_in_frame_num_value_allowed_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn frame_mbs_only_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) } + } + #[inline] + pub fn set_frame_mbs_only_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn mb_adaptive_frame_field_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u32) } + } + #[inline] + pub fn set_mb_adaptive_frame_field_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 1u8, val as u64) + } + } + #[inline] + pub fn direct_8x8_inference_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u32) } + } + #[inline] + pub fn set_direct_8x8_inference_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(6usize, 1u8, val as u64) + } + } + #[inline] + pub fn MinLumaBiPredSize8x8(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) } + } + #[inline] + pub fn set_MinLumaBiPredSize8x8(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(7usize, 1u8, val as u64) + } + } + #[inline] + pub fn log2_max_frame_num_minus4(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 4u8) as u32) } + } + #[inline] + pub fn set_log2_max_frame_num_minus4(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 4u8, val as u64) + } + } + #[inline] + pub fn pic_order_cnt_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 2u8) as u32) } + } + #[inline] + pub fn set_pic_order_cnt_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(12usize, 2u8, val as u64) + } + } + #[inline] + pub fn log2_max_pic_order_cnt_lsb_minus4(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(14usize, 4u8) as u32) } + } + #[inline] + pub fn set_log2_max_pic_order_cnt_lsb_minus4(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(14usize, 4u8, val as u64) + } + } + #[inline] + pub fn delta_pic_order_always_zero_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(18usize, 1u8) as u32) } + } + #[inline] + pub fn set_delta_pic_order_always_zero_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(18usize, 1u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + chroma_format_idc: u32, + residual_colour_transform_flag: u32, + gaps_in_frame_num_value_allowed_flag: u32, + frame_mbs_only_flag: u32, + mb_adaptive_frame_field_flag: u32, + direct_8x8_inference_flag: u32, + MinLumaBiPredSize8x8: u32, + log2_max_frame_num_minus4: u32, + pic_order_cnt_type: u32, + log2_max_pic_order_cnt_lsb_minus4: u32, + delta_pic_order_always_zero_flag: u32, + ) -> __BindgenBitfieldUnit<[u8; 3usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 3usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 2u8, { + let chroma_format_idc: u32 = unsafe { ::std::mem::transmute(chroma_format_idc) }; + chroma_format_idc as u64 + }); + __bindgen_bitfield_unit.set(2usize, 1u8, { + let residual_colour_transform_flag: u32 = + unsafe { ::std::mem::transmute(residual_colour_transform_flag) }; + residual_colour_transform_flag as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let gaps_in_frame_num_value_allowed_flag: u32 = + unsafe { ::std::mem::transmute(gaps_in_frame_num_value_allowed_flag) }; + gaps_in_frame_num_value_allowed_flag as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let frame_mbs_only_flag: u32 = unsafe { ::std::mem::transmute(frame_mbs_only_flag) }; + frame_mbs_only_flag as u64 + }); + __bindgen_bitfield_unit.set(5usize, 1u8, { + let mb_adaptive_frame_field_flag: u32 = + unsafe { ::std::mem::transmute(mb_adaptive_frame_field_flag) }; + mb_adaptive_frame_field_flag as u64 + }); + __bindgen_bitfield_unit.set(6usize, 1u8, { + let direct_8x8_inference_flag: u32 = + unsafe { ::std::mem::transmute(direct_8x8_inference_flag) }; + direct_8x8_inference_flag as u64 + }); + __bindgen_bitfield_unit.set(7usize, 1u8, { + let MinLumaBiPredSize8x8: u32 = unsafe { ::std::mem::transmute(MinLumaBiPredSize8x8) }; + MinLumaBiPredSize8x8 as u64 + }); + __bindgen_bitfield_unit.set(8usize, 4u8, { + let log2_max_frame_num_minus4: u32 = + unsafe { ::std::mem::transmute(log2_max_frame_num_minus4) }; + log2_max_frame_num_minus4 as u64 + }); + __bindgen_bitfield_unit.set(12usize, 2u8, { + let pic_order_cnt_type: u32 = unsafe { ::std::mem::transmute(pic_order_cnt_type) }; + pic_order_cnt_type as u64 + }); + __bindgen_bitfield_unit.set(14usize, 4u8, { + let log2_max_pic_order_cnt_lsb_minus4: u32 = + unsafe { ::std::mem::transmute(log2_max_pic_order_cnt_lsb_minus4) }; + log2_max_pic_order_cnt_lsb_minus4 as u64 + }); + __bindgen_bitfield_unit.set(18usize, 1u8, { + let delta_pic_order_always_zero_flag: u32 = + unsafe { ::std::mem::transmute(delta_pic_order_always_zero_flag) }; + delta_pic_order_always_zero_flag as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAPictureParameterBufferH264__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAPictureParameterBufferH264__bindgen_ty_2 { + pub bits: _VAPictureParameterBufferH264__bindgen_ty_2__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAPictureParameterBufferH264__bindgen_ty_2__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>, + pub __bindgen_padding_0: u16, +} +impl _VAPictureParameterBufferH264__bindgen_ty_2__bindgen_ty_1 { + #[inline] + pub fn entropy_coding_mode_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + } + #[inline] + pub fn set_entropy_coding_mode_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn weighted_pred_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) } + } + #[inline] + pub fn set_weighted_pred_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 1u8, val as u64) + } + } + #[inline] + pub fn weighted_bipred_idc(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u32) } + } + #[inline] + pub fn set_weighted_bipred_idc(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 2u8, val as u64) + } + } + #[inline] + pub fn transform_8x8_mode_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) } + } + #[inline] + pub fn set_transform_8x8_mode_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn field_pic_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u32) } + } + #[inline] + pub fn set_field_pic_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 1u8, val as u64) + } + } + #[inline] + pub fn constrained_intra_pred_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u32) } + } + #[inline] + pub fn set_constrained_intra_pred_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(6usize, 1u8, val as u64) + } + } + #[inline] + pub fn pic_order_present_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) } + } + #[inline] + pub fn set_pic_order_present_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(7usize, 1u8, val as u64) + } + } + #[inline] + pub fn deblocking_filter_control_present_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u32) } + } + #[inline] + pub fn set_deblocking_filter_control_present_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 1u8, val as u64) + } + } + #[inline] + pub fn redundant_pic_cnt_present_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u32) } + } + #[inline] + pub fn set_redundant_pic_cnt_present_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(9usize, 1u8, val as u64) + } + } + #[inline] + pub fn reference_pic_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u32) } + } + #[inline] + pub fn set_reference_pic_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(10usize, 1u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + entropy_coding_mode_flag: u32, + weighted_pred_flag: u32, + weighted_bipred_idc: u32, + transform_8x8_mode_flag: u32, + field_pic_flag: u32, + constrained_intra_pred_flag: u32, + pic_order_present_flag: u32, + deblocking_filter_control_present_flag: u32, + redundant_pic_cnt_present_flag: u32, + reference_pic_flag: u32, + ) -> __BindgenBitfieldUnit<[u8; 2usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let entropy_coding_mode_flag: u32 = + unsafe { ::std::mem::transmute(entropy_coding_mode_flag) }; + entropy_coding_mode_flag as u64 + }); + __bindgen_bitfield_unit.set(1usize, 1u8, { + let weighted_pred_flag: u32 = unsafe { ::std::mem::transmute(weighted_pred_flag) }; + weighted_pred_flag as u64 + }); + __bindgen_bitfield_unit.set(2usize, 2u8, { + let weighted_bipred_idc: u32 = unsafe { ::std::mem::transmute(weighted_bipred_idc) }; + weighted_bipred_idc as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let transform_8x8_mode_flag: u32 = + unsafe { ::std::mem::transmute(transform_8x8_mode_flag) }; + transform_8x8_mode_flag as u64 + }); + __bindgen_bitfield_unit.set(5usize, 1u8, { + let field_pic_flag: u32 = unsafe { ::std::mem::transmute(field_pic_flag) }; + field_pic_flag as u64 + }); + __bindgen_bitfield_unit.set(6usize, 1u8, { + let constrained_intra_pred_flag: u32 = + unsafe { ::std::mem::transmute(constrained_intra_pred_flag) }; + constrained_intra_pred_flag as u64 + }); + __bindgen_bitfield_unit.set(7usize, 1u8, { + let pic_order_present_flag: u32 = + unsafe { ::std::mem::transmute(pic_order_present_flag) }; + pic_order_present_flag as u64 + }); + __bindgen_bitfield_unit.set(8usize, 1u8, { + let deblocking_filter_control_present_flag: u32 = + unsafe { ::std::mem::transmute(deblocking_filter_control_present_flag) }; + deblocking_filter_control_present_flag as u64 + }); + __bindgen_bitfield_unit.set(9usize, 1u8, { + let redundant_pic_cnt_present_flag: u32 = + unsafe { ::std::mem::transmute(redundant_pic_cnt_present_flag) }; + redundant_pic_cnt_present_flag as u64 + }); + __bindgen_bitfield_unit.set(10usize, 1u8, { + let reference_pic_flag: u32 = unsafe { ::std::mem::transmute(reference_pic_flag) }; + reference_pic_flag as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAPictureParameterBufferH264__bindgen_ty_2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAPictureParameterBufferH264 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAPictureParameterBufferH264 = _VAPictureParameterBufferH264; +#[repr(C)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub struct _VAIQMatrixBufferH264 { + pub ScalingList4x4: [[u8; 16usize]; 6usize], + pub ScalingList8x8: [[u8; 64usize]; 2usize], + pub va_reserved: [u32; 4usize], +} +impl Default for _VAIQMatrixBufferH264 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAIQMatrixBufferH264 = _VAIQMatrixBufferH264; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VASliceParameterBufferH264 { + pub slice_data_size: u32, + pub slice_data_offset: u32, + pub slice_data_flag: u32, + pub slice_data_bit_offset: u16, + pub first_mb_in_slice: u16, + pub slice_type: u8, + pub direct_spatial_mv_pred_flag: u8, + pub num_ref_idx_l0_active_minus1: u8, + pub num_ref_idx_l1_active_minus1: u8, + pub cabac_init_idc: u8, + pub slice_qp_delta: i8, + pub disable_deblocking_filter_idc: u8, + pub slice_alpha_c0_offset_div2: i8, + pub slice_beta_offset_div2: i8, + pub RefPicList0: [VAPictureH264; 32usize], + pub RefPicList1: [VAPictureH264; 32usize], + pub luma_log2_weight_denom: u8, + pub chroma_log2_weight_denom: u8, + pub luma_weight_l0_flag: u8, + pub luma_weight_l0: [i16; 32usize], + pub luma_offset_l0: [i16; 32usize], + pub chroma_weight_l0_flag: u8, + pub chroma_weight_l0: [[i16; 2usize]; 32usize], + pub chroma_offset_l0: [[i16; 2usize]; 32usize], + pub luma_weight_l1_flag: u8, + pub luma_weight_l1: [i16; 32usize], + pub luma_offset_l1: [i16; 32usize], + pub chroma_weight_l1_flag: u8, + pub chroma_weight_l1: [[i16; 2usize]; 32usize], + pub chroma_offset_l1: [[i16; 2usize]; 32usize], + pub va_reserved: [u32; 4usize], +} +pub type VASliceParameterBufferH264 = _VASliceParameterBufferH264; +pub mod VAEncPictureType { + pub type Type = ::std::os::raw::c_uint; + pub const VAEncPictureTypeIntra: Type = 0; + pub const VAEncPictureTypePredictive: Type = 1; + pub const VAEncPictureTypeBidirectional: Type = 2; +} +extern "C" { + pub fn vaCreateBuffer( + dpy: VADisplay, + context: VAContextID, + type_: VABufferType::Type, + size: ::std::os::raw::c_uint, + num_elements: ::std::os::raw::c_uint, + data: *mut ::std::os::raw::c_void, + buf_id: *mut VABufferID, + ) -> VAStatus; +} +extern "C" { + pub fn vaCreateBuffer2( + dpy: VADisplay, + context: VAContextID, + type_: VABufferType::Type, + width: ::std::os::raw::c_uint, + height: ::std::os::raw::c_uint, + unit_size: *mut ::std::os::raw::c_uint, + pitch: *mut ::std::os::raw::c_uint, + buf_id: *mut VABufferID, + ) -> VAStatus; +} +extern "C" { + pub fn vaBufferSetNumElements( + dpy: VADisplay, + buf_id: VABufferID, + num_elements: ::std::os::raw::c_uint, + ) -> VAStatus; +} +extern "C" { + pub fn vaMapBuffer( + dpy: VADisplay, + buf_id: VABufferID, + pbuf: *mut *mut ::std::os::raw::c_void, + ) -> VAStatus; +} +extern "C" { + pub fn vaUnmapBuffer(dpy: VADisplay, buf_id: VABufferID) -> VAStatus; +} +extern "C" { + pub fn vaDestroyBuffer(dpy: VADisplay, buffer_id: VABufferID) -> VAStatus; +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct VABufferInfo { + pub handle: usize, + pub type_: u32, + pub mem_type: u32, + pub mem_size: usize, + pub va_reserved: [u32; 4usize], +} +extern "C" { + pub fn vaAcquireBufferHandle( + dpy: VADisplay, + buf_id: VABufferID, + buf_info: *mut VABufferInfo, + ) -> VAStatus; +} +extern "C" { + pub fn vaReleaseBufferHandle(dpy: VADisplay, buf_id: VABufferID) -> VAStatus; +} +extern "C" { + pub fn vaExportSurfaceHandle( + dpy: VADisplay, + surface_id: VASurfaceID, + mem_type: u32, + flags: u32, + descriptor: *mut ::std::os::raw::c_void, + ) -> VAStatus; +} +extern "C" { + pub fn vaBeginPicture( + dpy: VADisplay, + context: VAContextID, + render_target: VASurfaceID, + ) -> VAStatus; +} +extern "C" { + pub fn vaRenderPicture( + dpy: VADisplay, + context: VAContextID, + buffers: *mut VABufferID, + num_buffers: ::std::os::raw::c_int, + ) -> VAStatus; +} +extern "C" { + pub fn vaEndPicture(dpy: VADisplay, context: VAContextID) -> VAStatus; +} +extern "C" { + pub fn vaMFSubmit( + dpy: VADisplay, + mf_context: VAMFContextID, + contexts: *mut VAContextID, + num_contexts: ::std::os::raw::c_int, + ) -> VAStatus; +} +extern "C" { + pub fn vaSyncSurface(dpy: VADisplay, render_target: VASurfaceID) -> VAStatus; +} +extern "C" { + pub fn vaSyncSurface2(dpy: VADisplay, surface: VASurfaceID, timeout_ns: u64) -> VAStatus; +} +pub mod VASurfaceStatus { + pub type Type = ::std::os::raw::c_uint; + pub const VASurfaceRendering: Type = 1; + pub const VASurfaceDisplaying: Type = 2; + pub const VASurfaceReady: Type = 4; + pub const VASurfaceSkipped: Type = 8; +} +extern "C" { + pub fn vaQuerySurfaceStatus( + dpy: VADisplay, + render_target: VASurfaceID, + status: *mut VASurfaceStatus::Type, + ) -> VAStatus; +} +extern "C" { + pub fn vaQuerySurfaceError( + dpy: VADisplay, + surface: VASurfaceID, + error_status: VAStatus, + error_info: *mut *mut ::std::os::raw::c_void, + ) -> VAStatus; +} +extern "C" { + pub fn vaSyncBuffer(dpy: VADisplay, buf_id: VABufferID, timeout_ns: u64) -> VAStatus; +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAImageFormat { + pub fourcc: u32, + pub byte_order: u32, + pub bits_per_pixel: u32, + pub depth: u32, + pub red_mask: u32, + pub green_mask: u32, + pub blue_mask: u32, + pub alpha_mask: u32, + pub va_reserved: [u32; 4usize], +} +pub type VAImageFormat = _VAImageFormat; +pub type VAImageID = VAGenericID; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAImage { + pub image_id: VAImageID, + pub format: VAImageFormat, + pub buf: VABufferID, + pub width: u16, + pub height: u16, + pub data_size: u32, + pub num_planes: u32, + pub pitches: [u32; 3usize], + pub offsets: [u32; 3usize], + pub num_palette_entries: i32, + pub entry_bytes: i32, + pub component_order: [i8; 4usize], + pub va_reserved: [u32; 4usize], +} +pub type VAImage = _VAImage; +extern "C" { + pub fn vaMaxNumImageFormats(dpy: VADisplay) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vaQueryImageFormats( + dpy: VADisplay, + format_list: *mut VAImageFormat, + num_formats: *mut ::std::os::raw::c_int, + ) -> VAStatus; +} +extern "C" { + pub fn vaCreateImage( + dpy: VADisplay, + format: *mut VAImageFormat, + width: ::std::os::raw::c_int, + height: ::std::os::raw::c_int, + image: *mut VAImage, + ) -> VAStatus; +} +extern "C" { + pub fn vaDestroyImage(dpy: VADisplay, image: VAImageID) -> VAStatus; +} +extern "C" { + pub fn vaSetImagePalette( + dpy: VADisplay, + image: VAImageID, + palette: *mut ::std::os::raw::c_uchar, + ) -> VAStatus; +} +extern "C" { + pub fn vaGetImage( + dpy: VADisplay, + surface: VASurfaceID, + x: ::std::os::raw::c_int, + y: ::std::os::raw::c_int, + width: ::std::os::raw::c_uint, + height: ::std::os::raw::c_uint, + image: VAImageID, + ) -> VAStatus; +} +extern "C" { + pub fn vaPutImage( + dpy: VADisplay, + surface: VASurfaceID, + image: VAImageID, + src_x: ::std::os::raw::c_int, + src_y: ::std::os::raw::c_int, + src_width: ::std::os::raw::c_uint, + src_height: ::std::os::raw::c_uint, + dest_x: ::std::os::raw::c_int, + dest_y: ::std::os::raw::c_int, + dest_width: ::std::os::raw::c_uint, + dest_height: ::std::os::raw::c_uint, + ) -> VAStatus; +} +extern "C" { + pub fn vaDeriveImage(dpy: VADisplay, surface: VASurfaceID, image: *mut VAImage) -> VAStatus; +} +pub type VASubpictureID = VAGenericID; +extern "C" { + pub fn vaMaxNumSubpictureFormats(dpy: VADisplay) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vaQuerySubpictureFormats( + dpy: VADisplay, + format_list: *mut VAImageFormat, + flags: *mut ::std::os::raw::c_uint, + num_formats: *mut ::std::os::raw::c_uint, + ) -> VAStatus; +} +extern "C" { + pub fn vaCreateSubpicture( + dpy: VADisplay, + image: VAImageID, + subpicture: *mut VASubpictureID, + ) -> VAStatus; +} +extern "C" { + pub fn vaDestroySubpicture(dpy: VADisplay, subpicture: VASubpictureID) -> VAStatus; +} +extern "C" { + pub fn vaSetSubpictureImage( + dpy: VADisplay, + subpicture: VASubpictureID, + image: VAImageID, + ) -> VAStatus; +} +extern "C" { + pub fn vaSetSubpictureChromakey( + dpy: VADisplay, + subpicture: VASubpictureID, + chromakey_min: ::std::os::raw::c_uint, + chromakey_max: ::std::os::raw::c_uint, + chromakey_mask: ::std::os::raw::c_uint, + ) -> VAStatus; +} +extern "C" { + pub fn vaSetSubpictureGlobalAlpha( + dpy: VADisplay, + subpicture: VASubpictureID, + global_alpha: f32, + ) -> VAStatus; +} +extern "C" { + pub fn vaAssociateSubpicture( + dpy: VADisplay, + subpicture: VASubpictureID, + target_surfaces: *mut VASurfaceID, + num_surfaces: ::std::os::raw::c_int, + src_x: i16, + src_y: i16, + src_width: u16, + src_height: u16, + dest_x: i16, + dest_y: i16, + dest_width: u16, + dest_height: u16, + flags: u32, + ) -> VAStatus; +} +extern "C" { + pub fn vaDeassociateSubpicture( + dpy: VADisplay, + subpicture: VASubpictureID, + target_surfaces: *mut VASurfaceID, + num_surfaces: ::std::os::raw::c_int, + ) -> VAStatus; +} +pub mod VADisplayAttribType { + pub type Type = ::std::os::raw::c_uint; + pub const VADisplayAttribBrightness: Type = 0; + pub const VADisplayAttribContrast: Type = 1; + pub const VADisplayAttribHue: Type = 2; + pub const VADisplayAttribSaturation: Type = 3; + pub const VADisplayAttribBackgroundColor: Type = 4; + pub const VADisplayAttribDirectSurface: Type = 5; + pub const VADisplayAttribRotation: Type = 6; + pub const VADisplayAttribOutofLoopDeblock: Type = 7; + pub const VADisplayAttribBLEBlackMode: Type = 8; + pub const VADisplayAttribBLEWhiteMode: Type = 9; + pub const VADisplayAttribBlueStretch: Type = 10; + pub const VADisplayAttribSkinColorCorrection: Type = 11; + pub const VADisplayAttribCSCMatrix: Type = 12; + pub const VADisplayAttribBlendColor: Type = 13; + pub const VADisplayAttribOverlayAutoPaintColorKey: Type = 14; + pub const VADisplayAttribOverlayColorKey: Type = 15; + pub const VADisplayAttribRenderMode: Type = 16; + pub const VADisplayAttribRenderDevice: Type = 17; + pub const VADisplayAttribRenderRect: Type = 18; + pub const VADisplayAttribSubDevice: Type = 19; + pub const VADisplayAttribCopy: Type = 20; + pub const VADisplayPCIID: Type = 21; +} +#[repr(C)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub struct _VADisplayAttribute { + pub type_: VADisplayAttribType::Type, + pub min_value: i32, + pub max_value: i32, + pub value: i32, + pub flags: u32, + pub va_reserved: [u32; 4usize], +} +impl Default for _VADisplayAttribute { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VADisplayAttribute = _VADisplayAttribute; +extern "C" { + pub fn vaMaxNumDisplayAttributes(dpy: VADisplay) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vaQueryDisplayAttributes( + dpy: VADisplay, + attr_list: *mut VADisplayAttribute, + num_attributes: *mut ::std::os::raw::c_int, + ) -> VAStatus; +} +extern "C" { + pub fn vaGetDisplayAttributes( + dpy: VADisplay, + attr_list: *mut VADisplayAttribute, + num_attributes: ::std::os::raw::c_int, + ) -> VAStatus; +} +extern "C" { + pub fn vaSetDisplayAttributes( + dpy: VADisplay, + attr_list: *mut VADisplayAttribute, + num_attributes: ::std::os::raw::c_int, + ) -> VAStatus; +} +pub mod VACopyObjectType { + pub type Type = ::std::os::raw::c_uint; + pub const VACopyObjectSurface: Type = 0; + pub const VACopyObjectBuffer: Type = 1; +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VACopyObject { + pub obj_type: VACopyObjectType::Type, + pub object: _VACopyObject__bindgen_ty_1, + pub va_reserved: [u32; 8usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VACopyObject__bindgen_ty_1 { + pub surface_id: VASurfaceID, + pub buffer_id: VABufferID, +} +impl Default for _VACopyObject__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VACopyObject { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VACopyObject = _VACopyObject; +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VACopyOption { + pub bits: _VACopyOption__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VACopyOption__bindgen_ty_1 { + pub _bitfield_align_1: [u32; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>, +} +impl _VACopyOption__bindgen_ty_1 { + #[inline] + pub fn va_copy_sync(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) } + } + #[inline] + pub fn set_va_copy_sync(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 2u8, val as u64) + } + } + #[inline] + pub fn va_copy_mode(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 4u8) as u32) } + } + #[inline] + pub fn set_va_copy_mode(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 4u8, val as u64) + } + } + #[inline] + pub fn reserved(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 26u8) as u32) } + } + #[inline] + pub fn set_reserved(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(6usize, 26u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + va_copy_sync: u32, + va_copy_mode: u32, + reserved: u32, + ) -> __BindgenBitfieldUnit<[u8; 4usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 2u8, { + let va_copy_sync: u32 = unsafe { ::std::mem::transmute(va_copy_sync) }; + va_copy_sync as u64 + }); + __bindgen_bitfield_unit.set(2usize, 4u8, { + let va_copy_mode: u32 = unsafe { ::std::mem::transmute(va_copy_mode) }; + va_copy_mode as u64 + }); + __bindgen_bitfield_unit.set(6usize, 26u8, { + let reserved: u32 = unsafe { ::std::mem::transmute(reserved) }; + reserved as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VACopyOption { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VACopyOption = _VACopyOption; +extern "C" { + pub fn vaCopy( + dpy: VADisplay, + dst: *mut VACopyObject, + src: *mut VACopyObject, + option: VACopyOption, + ) -> VAStatus; +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VABoolCoderContextVPX { + pub range: u8, + pub value: u8, + pub count: u8, +} +pub type VABoolCoderContextVPX = _VABoolCoderContextVPX; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAPictureParameterBufferVP8 { + pub frame_width: u32, + pub frame_height: u32, + pub last_ref_frame: VASurfaceID, + pub golden_ref_frame: VASurfaceID, + pub alt_ref_frame: VASurfaceID, + pub out_of_loop_frame: VASurfaceID, + pub pic_fields: _VAPictureParameterBufferVP8__bindgen_ty_1, + pub mb_segment_tree_probs: [u8; 3usize], + pub loop_filter_level: [u8; 4usize], + pub loop_filter_deltas_ref_frame: [i8; 4usize], + pub loop_filter_deltas_mode: [i8; 4usize], + pub prob_skip_false: u8, + pub prob_intra: u8, + pub prob_last: u8, + pub prob_gf: u8, + pub y_mode_probs: [u8; 4usize], + pub uv_mode_probs: [u8; 3usize], + pub mv_probs: [[u8; 19usize]; 2usize], + pub bool_coder_ctx: VABoolCoderContextVPX, + pub va_reserved: [u32; 4usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAPictureParameterBufferVP8__bindgen_ty_1 { + pub bits: _VAPictureParameterBufferVP8__bindgen_ty_1__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAPictureParameterBufferVP8__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 3usize]>, + pub __bindgen_padding_0: u8, +} +impl _VAPictureParameterBufferVP8__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn key_frame(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + } + #[inline] + pub fn set_key_frame(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn version(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 3u8) as u32) } + } + #[inline] + pub fn set_version(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 3u8, val as u64) + } + } + #[inline] + pub fn segmentation_enabled(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) } + } + #[inline] + pub fn set_segmentation_enabled(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn update_mb_segmentation_map(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u32) } + } + #[inline] + pub fn set_update_mb_segmentation_map(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 1u8, val as u64) + } + } + #[inline] + pub fn update_segment_feature_data(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u32) } + } + #[inline] + pub fn set_update_segment_feature_data(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(6usize, 1u8, val as u64) + } + } + #[inline] + pub fn filter_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) } + } + #[inline] + pub fn set_filter_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(7usize, 1u8, val as u64) + } + } + #[inline] + pub fn sharpness_level(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 3u8) as u32) } + } + #[inline] + pub fn set_sharpness_level(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 3u8, val as u64) + } + } + #[inline] + pub fn loop_filter_adj_enable(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(11usize, 1u8) as u32) } + } + #[inline] + pub fn set_loop_filter_adj_enable(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(11usize, 1u8, val as u64) + } + } + #[inline] + pub fn mode_ref_lf_delta_update(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 1u8) as u32) } + } + #[inline] + pub fn set_mode_ref_lf_delta_update(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(12usize, 1u8, val as u64) + } + } + #[inline] + pub fn sign_bias_golden(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(13usize, 1u8) as u32) } + } + #[inline] + pub fn set_sign_bias_golden(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(13usize, 1u8, val as u64) + } + } + #[inline] + pub fn sign_bias_alternate(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(14usize, 1u8) as u32) } + } + #[inline] + pub fn set_sign_bias_alternate(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(14usize, 1u8, val as u64) + } + } + #[inline] + pub fn mb_no_coeff_skip(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(15usize, 1u8) as u32) } + } + #[inline] + pub fn set_mb_no_coeff_skip(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(15usize, 1u8, val as u64) + } + } + #[inline] + pub fn loop_filter_disable(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 1u8) as u32) } + } + #[inline] + pub fn set_loop_filter_disable(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(16usize, 1u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + key_frame: u32, + version: u32, + segmentation_enabled: u32, + update_mb_segmentation_map: u32, + update_segment_feature_data: u32, + filter_type: u32, + sharpness_level: u32, + loop_filter_adj_enable: u32, + mode_ref_lf_delta_update: u32, + sign_bias_golden: u32, + sign_bias_alternate: u32, + mb_no_coeff_skip: u32, + loop_filter_disable: u32, + ) -> __BindgenBitfieldUnit<[u8; 3usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 3usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let key_frame: u32 = unsafe { ::std::mem::transmute(key_frame) }; + key_frame as u64 + }); + __bindgen_bitfield_unit.set(1usize, 3u8, { + let version: u32 = unsafe { ::std::mem::transmute(version) }; + version as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let segmentation_enabled: u32 = unsafe { ::std::mem::transmute(segmentation_enabled) }; + segmentation_enabled as u64 + }); + __bindgen_bitfield_unit.set(5usize, 1u8, { + let update_mb_segmentation_map: u32 = + unsafe { ::std::mem::transmute(update_mb_segmentation_map) }; + update_mb_segmentation_map as u64 + }); + __bindgen_bitfield_unit.set(6usize, 1u8, { + let update_segment_feature_data: u32 = + unsafe { ::std::mem::transmute(update_segment_feature_data) }; + update_segment_feature_data as u64 + }); + __bindgen_bitfield_unit.set(7usize, 1u8, { + let filter_type: u32 = unsafe { ::std::mem::transmute(filter_type) }; + filter_type as u64 + }); + __bindgen_bitfield_unit.set(8usize, 3u8, { + let sharpness_level: u32 = unsafe { ::std::mem::transmute(sharpness_level) }; + sharpness_level as u64 + }); + __bindgen_bitfield_unit.set(11usize, 1u8, { + let loop_filter_adj_enable: u32 = + unsafe { ::std::mem::transmute(loop_filter_adj_enable) }; + loop_filter_adj_enable as u64 + }); + __bindgen_bitfield_unit.set(12usize, 1u8, { + let mode_ref_lf_delta_update: u32 = + unsafe { ::std::mem::transmute(mode_ref_lf_delta_update) }; + mode_ref_lf_delta_update as u64 + }); + __bindgen_bitfield_unit.set(13usize, 1u8, { + let sign_bias_golden: u32 = unsafe { ::std::mem::transmute(sign_bias_golden) }; + sign_bias_golden as u64 + }); + __bindgen_bitfield_unit.set(14usize, 1u8, { + let sign_bias_alternate: u32 = unsafe { ::std::mem::transmute(sign_bias_alternate) }; + sign_bias_alternate as u64 + }); + __bindgen_bitfield_unit.set(15usize, 1u8, { + let mb_no_coeff_skip: u32 = unsafe { ::std::mem::transmute(mb_no_coeff_skip) }; + mb_no_coeff_skip as u64 + }); + __bindgen_bitfield_unit.set(16usize, 1u8, { + let loop_filter_disable: u32 = unsafe { ::std::mem::transmute(loop_filter_disable) }; + loop_filter_disable as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAPictureParameterBufferVP8__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAPictureParameterBufferVP8 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAPictureParameterBufferVP8 = _VAPictureParameterBufferVP8; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VASliceParameterBufferVP8 { + pub slice_data_size: u32, + pub slice_data_offset: u32, + pub slice_data_flag: u32, + pub macroblock_offset: u32, + pub num_of_partitions: u8, + pub partition_size: [u32; 9usize], + pub va_reserved: [u32; 4usize], +} +pub type VASliceParameterBufferVP8 = _VASliceParameterBufferVP8; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAProbabilityDataBufferVP8 { + pub dct_coeff_probs: [[[[u8; 11usize]; 3usize]; 8usize]; 4usize], + pub va_reserved: [u32; 4usize], +} +pub type VAProbabilityDataBufferVP8 = _VAProbabilityDataBufferVP8; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAIQMatrixBufferVP8 { + pub quantization_index: [[u16; 6usize]; 4usize], + pub va_reserved: [u32; 4usize], +} +pub type VAIQMatrixBufferVP8 = _VAIQMatrixBufferVP8; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VADecPictureParameterBufferVP9 { + pub frame_width: u16, + pub frame_height: u16, + pub reference_frames: [VASurfaceID; 8usize], + pub pic_fields: _VADecPictureParameterBufferVP9__bindgen_ty_1, + pub filter_level: u8, + pub sharpness_level: u8, + pub log2_tile_rows: u8, + pub log2_tile_columns: u8, + pub frame_header_length_in_bytes: u8, + pub first_partition_size: u16, + pub mb_segment_tree_probs: [u8; 7usize], + pub segment_pred_probs: [u8; 3usize], + pub profile: u8, + pub bit_depth: u8, + pub va_reserved: [u32; 8usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VADecPictureParameterBufferVP9__bindgen_ty_1 { + pub bits: _VADecPictureParameterBufferVP9__bindgen_ty_1__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VADecPictureParameterBufferVP9__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>, +} +impl _VADecPictureParameterBufferVP9__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn subsampling_x(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + } + #[inline] + pub fn set_subsampling_x(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn subsampling_y(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) } + } + #[inline] + pub fn set_subsampling_y(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 1u8, val as u64) + } + } + #[inline] + pub fn frame_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) } + } + #[inline] + pub fn set_frame_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 1u8, val as u64) + } + } + #[inline] + pub fn show_frame(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) } + } + #[inline] + pub fn set_show_frame(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn error_resilient_mode(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) } + } + #[inline] + pub fn set_error_resilient_mode(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn intra_only(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u32) } + } + #[inline] + pub fn set_intra_only(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 1u8, val as u64) + } + } + #[inline] + pub fn allow_high_precision_mv(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u32) } + } + #[inline] + pub fn set_allow_high_precision_mv(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(6usize, 1u8, val as u64) + } + } + #[inline] + pub fn mcomp_filter_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 3u8) as u32) } + } + #[inline] + pub fn set_mcomp_filter_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(7usize, 3u8, val as u64) + } + } + #[inline] + pub fn frame_parallel_decoding_mode(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u32) } + } + #[inline] + pub fn set_frame_parallel_decoding_mode(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(10usize, 1u8, val as u64) + } + } + #[inline] + pub fn reset_frame_context(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(11usize, 2u8) as u32) } + } + #[inline] + pub fn set_reset_frame_context(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(11usize, 2u8, val as u64) + } + } + #[inline] + pub fn refresh_frame_context(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(13usize, 1u8) as u32) } + } + #[inline] + pub fn set_refresh_frame_context(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(13usize, 1u8, val as u64) + } + } + #[inline] + pub fn frame_context_idx(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(14usize, 2u8) as u32) } + } + #[inline] + pub fn set_frame_context_idx(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(14usize, 2u8, val as u64) + } + } + #[inline] + pub fn segmentation_enabled(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 1u8) as u32) } + } + #[inline] + pub fn set_segmentation_enabled(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(16usize, 1u8, val as u64) + } + } + #[inline] + pub fn segmentation_temporal_update(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(17usize, 1u8) as u32) } + } + #[inline] + pub fn set_segmentation_temporal_update(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(17usize, 1u8, val as u64) + } + } + #[inline] + pub fn segmentation_update_map(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(18usize, 1u8) as u32) } + } + #[inline] + pub fn set_segmentation_update_map(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(18usize, 1u8, val as u64) + } + } + #[inline] + pub fn last_ref_frame(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(19usize, 3u8) as u32) } + } + #[inline] + pub fn set_last_ref_frame(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(19usize, 3u8, val as u64) + } + } + #[inline] + pub fn last_ref_frame_sign_bias(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(22usize, 1u8) as u32) } + } + #[inline] + pub fn set_last_ref_frame_sign_bias(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(22usize, 1u8, val as u64) + } + } + #[inline] + pub fn golden_ref_frame(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(23usize, 3u8) as u32) } + } + #[inline] + pub fn set_golden_ref_frame(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(23usize, 3u8, val as u64) + } + } + #[inline] + pub fn golden_ref_frame_sign_bias(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(26usize, 1u8) as u32) } + } + #[inline] + pub fn set_golden_ref_frame_sign_bias(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(26usize, 1u8, val as u64) + } + } + #[inline] + pub fn alt_ref_frame(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(27usize, 3u8) as u32) } + } + #[inline] + pub fn set_alt_ref_frame(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(27usize, 3u8, val as u64) + } + } + #[inline] + pub fn alt_ref_frame_sign_bias(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(30usize, 1u8) as u32) } + } + #[inline] + pub fn set_alt_ref_frame_sign_bias(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(30usize, 1u8, val as u64) + } + } + #[inline] + pub fn lossless_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(31usize, 1u8) as u32) } + } + #[inline] + pub fn set_lossless_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(31usize, 1u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + subsampling_x: u32, + subsampling_y: u32, + frame_type: u32, + show_frame: u32, + error_resilient_mode: u32, + intra_only: u32, + allow_high_precision_mv: u32, + mcomp_filter_type: u32, + frame_parallel_decoding_mode: u32, + reset_frame_context: u32, + refresh_frame_context: u32, + frame_context_idx: u32, + segmentation_enabled: u32, + segmentation_temporal_update: u32, + segmentation_update_map: u32, + last_ref_frame: u32, + last_ref_frame_sign_bias: u32, + golden_ref_frame: u32, + golden_ref_frame_sign_bias: u32, + alt_ref_frame: u32, + alt_ref_frame_sign_bias: u32, + lossless_flag: u32, + ) -> __BindgenBitfieldUnit<[u8; 4usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let subsampling_x: u32 = unsafe { ::std::mem::transmute(subsampling_x) }; + subsampling_x as u64 + }); + __bindgen_bitfield_unit.set(1usize, 1u8, { + let subsampling_y: u32 = unsafe { ::std::mem::transmute(subsampling_y) }; + subsampling_y as u64 + }); + __bindgen_bitfield_unit.set(2usize, 1u8, { + let frame_type: u32 = unsafe { ::std::mem::transmute(frame_type) }; + frame_type as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let show_frame: u32 = unsafe { ::std::mem::transmute(show_frame) }; + show_frame as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let error_resilient_mode: u32 = unsafe { ::std::mem::transmute(error_resilient_mode) }; + error_resilient_mode as u64 + }); + __bindgen_bitfield_unit.set(5usize, 1u8, { + let intra_only: u32 = unsafe { ::std::mem::transmute(intra_only) }; + intra_only as u64 + }); + __bindgen_bitfield_unit.set(6usize, 1u8, { + let allow_high_precision_mv: u32 = + unsafe { ::std::mem::transmute(allow_high_precision_mv) }; + allow_high_precision_mv as u64 + }); + __bindgen_bitfield_unit.set(7usize, 3u8, { + let mcomp_filter_type: u32 = unsafe { ::std::mem::transmute(mcomp_filter_type) }; + mcomp_filter_type as u64 + }); + __bindgen_bitfield_unit.set(10usize, 1u8, { + let frame_parallel_decoding_mode: u32 = + unsafe { ::std::mem::transmute(frame_parallel_decoding_mode) }; + frame_parallel_decoding_mode as u64 + }); + __bindgen_bitfield_unit.set(11usize, 2u8, { + let reset_frame_context: u32 = unsafe { ::std::mem::transmute(reset_frame_context) }; + reset_frame_context as u64 + }); + __bindgen_bitfield_unit.set(13usize, 1u8, { + let refresh_frame_context: u32 = + unsafe { ::std::mem::transmute(refresh_frame_context) }; + refresh_frame_context as u64 + }); + __bindgen_bitfield_unit.set(14usize, 2u8, { + let frame_context_idx: u32 = unsafe { ::std::mem::transmute(frame_context_idx) }; + frame_context_idx as u64 + }); + __bindgen_bitfield_unit.set(16usize, 1u8, { + let segmentation_enabled: u32 = unsafe { ::std::mem::transmute(segmentation_enabled) }; + segmentation_enabled as u64 + }); + __bindgen_bitfield_unit.set(17usize, 1u8, { + let segmentation_temporal_update: u32 = + unsafe { ::std::mem::transmute(segmentation_temporal_update) }; + segmentation_temporal_update as u64 + }); + __bindgen_bitfield_unit.set(18usize, 1u8, { + let segmentation_update_map: u32 = + unsafe { ::std::mem::transmute(segmentation_update_map) }; + segmentation_update_map as u64 + }); + __bindgen_bitfield_unit.set(19usize, 3u8, { + let last_ref_frame: u32 = unsafe { ::std::mem::transmute(last_ref_frame) }; + last_ref_frame as u64 + }); + __bindgen_bitfield_unit.set(22usize, 1u8, { + let last_ref_frame_sign_bias: u32 = + unsafe { ::std::mem::transmute(last_ref_frame_sign_bias) }; + last_ref_frame_sign_bias as u64 + }); + __bindgen_bitfield_unit.set(23usize, 3u8, { + let golden_ref_frame: u32 = unsafe { ::std::mem::transmute(golden_ref_frame) }; + golden_ref_frame as u64 + }); + __bindgen_bitfield_unit.set(26usize, 1u8, { + let golden_ref_frame_sign_bias: u32 = + unsafe { ::std::mem::transmute(golden_ref_frame_sign_bias) }; + golden_ref_frame_sign_bias as u64 + }); + __bindgen_bitfield_unit.set(27usize, 3u8, { + let alt_ref_frame: u32 = unsafe { ::std::mem::transmute(alt_ref_frame) }; + alt_ref_frame as u64 + }); + __bindgen_bitfield_unit.set(30usize, 1u8, { + let alt_ref_frame_sign_bias: u32 = + unsafe { ::std::mem::transmute(alt_ref_frame_sign_bias) }; + alt_ref_frame_sign_bias as u64 + }); + __bindgen_bitfield_unit.set(31usize, 1u8, { + let lossless_flag: u32 = unsafe { ::std::mem::transmute(lossless_flag) }; + lossless_flag as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VADecPictureParameterBufferVP9__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VADecPictureParameterBufferVP9 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VADecPictureParameterBufferVP9 = _VADecPictureParameterBufferVP9; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VASegmentParameterVP9 { + pub segment_flags: _VASegmentParameterVP9__bindgen_ty_1, + pub filter_level: [[u8; 2usize]; 4usize], + pub luma_ac_quant_scale: i16, + pub luma_dc_quant_scale: i16, + pub chroma_ac_quant_scale: i16, + pub chroma_dc_quant_scale: i16, + pub va_reserved: [u32; 4usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VASegmentParameterVP9__bindgen_ty_1 { + pub fields: _VASegmentParameterVP9__bindgen_ty_1__bindgen_ty_1, + pub value: u16, +} +#[repr(C)] +#[repr(align(2))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VASegmentParameterVP9__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, + pub __bindgen_padding_0: u8, +} +impl _VASegmentParameterVP9__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn segment_reference_enabled(&self) -> u16 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u16) } + } + #[inline] + pub fn set_segment_reference_enabled(&mut self, val: u16) { + unsafe { + let val: u16 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn segment_reference(&self) -> u16 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 2u8) as u16) } + } + #[inline] + pub fn set_segment_reference(&mut self, val: u16) { + unsafe { + let val: u16 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 2u8, val as u64) + } + } + #[inline] + pub fn segment_reference_skipped(&self) -> u16 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u16) } + } + #[inline] + pub fn set_segment_reference_skipped(&mut self, val: u16) { + unsafe { + let val: u16 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + segment_reference_enabled: u16, + segment_reference: u16, + segment_reference_skipped: u16, + ) -> __BindgenBitfieldUnit<[u8; 1usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let segment_reference_enabled: u16 = + unsafe { ::std::mem::transmute(segment_reference_enabled) }; + segment_reference_enabled as u64 + }); + __bindgen_bitfield_unit.set(1usize, 2u8, { + let segment_reference: u16 = unsafe { ::std::mem::transmute(segment_reference) }; + segment_reference as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let segment_reference_skipped: u16 = + unsafe { ::std::mem::transmute(segment_reference_skipped) }; + segment_reference_skipped as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VASegmentParameterVP9__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VASegmentParameterVP9 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VASegmentParameterVP9 = _VASegmentParameterVP9; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VASliceParameterBufferVP9 { + pub slice_data_size: u32, + pub slice_data_offset: u32, + pub slice_data_flag: u32, + pub seg_param: [VASegmentParameterVP9; 8usize], + pub va_reserved: [u32; 4usize], +} +impl Default for _VASliceParameterBufferVP9 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VASliceParameterBufferVP9 = _VASliceParameterBufferVP9; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAPictureStats { + pub picture_id: VASurfaceID, + pub flags: u32, +} +pub type VAPictureStats = _VAPictureStats; +#[repr(C)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub struct _VAStatsStatisticsParameter { + pub input: VAPictureStats, + pub past_references: *mut VAPictureStats, + pub num_past_references: u32, + pub past_ref_stat_buf: *mut VABufferID, + pub future_references: *mut VAPictureStats, + pub num_future_references: u32, + pub future_ref_stat_buf: *mut VABufferID, + pub outputs: *mut VABufferID, + pub mv_predictor: VABufferID, + pub qp: VABufferID, +} +impl Default for _VAStatsStatisticsParameter { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAStatsStatisticsParameter = _VAStatsStatisticsParameter; +pub mod VAEncPackedHeaderTypeH264 { + pub type Type = ::std::os::raw::c_uint; + pub const VAEncPackedHeaderH264_SPS: Type = 1; + pub const VAEncPackedHeaderH264_PPS: Type = 2; + pub const VAEncPackedHeaderH264_Slice: Type = 3; + pub const VAEncPackedHeaderH264_SEI: Type = 2147483649; +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAEncSequenceParameterBufferH264 { + pub seq_parameter_set_id: u8, + pub level_idc: u8, + pub intra_period: u32, + pub intra_idr_period: u32, + pub ip_period: u32, + pub bits_per_second: u32, + pub max_num_ref_frames: u32, + pub picture_width_in_mbs: u16, + pub picture_height_in_mbs: u16, + pub seq_fields: _VAEncSequenceParameterBufferH264__bindgen_ty_1, + pub bit_depth_luma_minus8: u8, + pub bit_depth_chroma_minus8: u8, + pub num_ref_frames_in_pic_order_cnt_cycle: u8, + pub offset_for_non_ref_pic: i32, + pub offset_for_top_to_bottom_field: i32, + pub offset_for_ref_frame: [i32; 256usize], + pub frame_cropping_flag: u8, + pub frame_crop_left_offset: u32, + pub frame_crop_right_offset: u32, + pub frame_crop_top_offset: u32, + pub frame_crop_bottom_offset: u32, + pub vui_parameters_present_flag: u8, + pub vui_fields: _VAEncSequenceParameterBufferH264__bindgen_ty_2, + pub aspect_ratio_idc: u8, + pub sar_width: u32, + pub sar_height: u32, + pub num_units_in_tick: u32, + pub time_scale: u32, + pub va_reserved: [u32; 4usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncSequenceParameterBufferH264__bindgen_ty_1 { + pub bits: _VAEncSequenceParameterBufferH264__bindgen_ty_1__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncSequenceParameterBufferH264__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 3usize]>, + pub __bindgen_padding_0: u8, +} +impl _VAEncSequenceParameterBufferH264__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn chroma_format_idc(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) } + } + #[inline] + pub fn set_chroma_format_idc(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 2u8, val as u64) + } + } + #[inline] + pub fn frame_mbs_only_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) } + } + #[inline] + pub fn set_frame_mbs_only_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 1u8, val as u64) + } + } + #[inline] + pub fn mb_adaptive_frame_field_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) } + } + #[inline] + pub fn set_mb_adaptive_frame_field_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn seq_scaling_matrix_present_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) } + } + #[inline] + pub fn set_seq_scaling_matrix_present_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn direct_8x8_inference_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u32) } + } + #[inline] + pub fn set_direct_8x8_inference_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 1u8, val as u64) + } + } + #[inline] + pub fn log2_max_frame_num_minus4(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 4u8) as u32) } + } + #[inline] + pub fn set_log2_max_frame_num_minus4(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(6usize, 4u8, val as u64) + } + } + #[inline] + pub fn pic_order_cnt_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 2u8) as u32) } + } + #[inline] + pub fn set_pic_order_cnt_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(10usize, 2u8, val as u64) + } + } + #[inline] + pub fn log2_max_pic_order_cnt_lsb_minus4(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 4u8) as u32) } + } + #[inline] + pub fn set_log2_max_pic_order_cnt_lsb_minus4(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(12usize, 4u8, val as u64) + } + } + #[inline] + pub fn delta_pic_order_always_zero_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 1u8) as u32) } + } + #[inline] + pub fn set_delta_pic_order_always_zero_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(16usize, 1u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + chroma_format_idc: u32, + frame_mbs_only_flag: u32, + mb_adaptive_frame_field_flag: u32, + seq_scaling_matrix_present_flag: u32, + direct_8x8_inference_flag: u32, + log2_max_frame_num_minus4: u32, + pic_order_cnt_type: u32, + log2_max_pic_order_cnt_lsb_minus4: u32, + delta_pic_order_always_zero_flag: u32, + ) -> __BindgenBitfieldUnit<[u8; 3usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 3usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 2u8, { + let chroma_format_idc: u32 = unsafe { ::std::mem::transmute(chroma_format_idc) }; + chroma_format_idc as u64 + }); + __bindgen_bitfield_unit.set(2usize, 1u8, { + let frame_mbs_only_flag: u32 = unsafe { ::std::mem::transmute(frame_mbs_only_flag) }; + frame_mbs_only_flag as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let mb_adaptive_frame_field_flag: u32 = + unsafe { ::std::mem::transmute(mb_adaptive_frame_field_flag) }; + mb_adaptive_frame_field_flag as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let seq_scaling_matrix_present_flag: u32 = + unsafe { ::std::mem::transmute(seq_scaling_matrix_present_flag) }; + seq_scaling_matrix_present_flag as u64 + }); + __bindgen_bitfield_unit.set(5usize, 1u8, { + let direct_8x8_inference_flag: u32 = + unsafe { ::std::mem::transmute(direct_8x8_inference_flag) }; + direct_8x8_inference_flag as u64 + }); + __bindgen_bitfield_unit.set(6usize, 4u8, { + let log2_max_frame_num_minus4: u32 = + unsafe { ::std::mem::transmute(log2_max_frame_num_minus4) }; + log2_max_frame_num_minus4 as u64 + }); + __bindgen_bitfield_unit.set(10usize, 2u8, { + let pic_order_cnt_type: u32 = unsafe { ::std::mem::transmute(pic_order_cnt_type) }; + pic_order_cnt_type as u64 + }); + __bindgen_bitfield_unit.set(12usize, 4u8, { + let log2_max_pic_order_cnt_lsb_minus4: u32 = + unsafe { ::std::mem::transmute(log2_max_pic_order_cnt_lsb_minus4) }; + log2_max_pic_order_cnt_lsb_minus4 as u64 + }); + __bindgen_bitfield_unit.set(16usize, 1u8, { + let delta_pic_order_always_zero_flag: u32 = + unsafe { ::std::mem::transmute(delta_pic_order_always_zero_flag) }; + delta_pic_order_always_zero_flag as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAEncSequenceParameterBufferH264__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncSequenceParameterBufferH264__bindgen_ty_2 { + pub bits: _VAEncSequenceParameterBufferH264__bindgen_ty_2__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncSequenceParameterBufferH264__bindgen_ty_2__bindgen_ty_1 { + pub _bitfield_align_1: [u16; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>, +} +impl _VAEncSequenceParameterBufferH264__bindgen_ty_2__bindgen_ty_1 { + #[inline] + pub fn aspect_ratio_info_present_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + } + #[inline] + pub fn set_aspect_ratio_info_present_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn timing_info_present_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) } + } + #[inline] + pub fn set_timing_info_present_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 1u8, val as u64) + } + } + #[inline] + pub fn bitstream_restriction_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) } + } + #[inline] + pub fn set_bitstream_restriction_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 1u8, val as u64) + } + } + #[inline] + pub fn log2_max_mv_length_horizontal(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 5u8) as u32) } + } + #[inline] + pub fn set_log2_max_mv_length_horizontal(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 5u8, val as u64) + } + } + #[inline] + pub fn log2_max_mv_length_vertical(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 5u8) as u32) } + } + #[inline] + pub fn set_log2_max_mv_length_vertical(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 5u8, val as u64) + } + } + #[inline] + pub fn fixed_frame_rate_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(13usize, 1u8) as u32) } + } + #[inline] + pub fn set_fixed_frame_rate_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(13usize, 1u8, val as u64) + } + } + #[inline] + pub fn low_delay_hrd_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(14usize, 1u8) as u32) } + } + #[inline] + pub fn set_low_delay_hrd_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(14usize, 1u8, val as u64) + } + } + #[inline] + pub fn motion_vectors_over_pic_boundaries_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(15usize, 1u8) as u32) } + } + #[inline] + pub fn set_motion_vectors_over_pic_boundaries_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(15usize, 1u8, val as u64) + } + } + #[inline] + pub fn reserved(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 16u8) as u32) } + } + #[inline] + pub fn set_reserved(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(16usize, 16u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + aspect_ratio_info_present_flag: u32, + timing_info_present_flag: u32, + bitstream_restriction_flag: u32, + log2_max_mv_length_horizontal: u32, + log2_max_mv_length_vertical: u32, + fixed_frame_rate_flag: u32, + low_delay_hrd_flag: u32, + motion_vectors_over_pic_boundaries_flag: u32, + reserved: u32, + ) -> __BindgenBitfieldUnit<[u8; 4usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let aspect_ratio_info_present_flag: u32 = + unsafe { ::std::mem::transmute(aspect_ratio_info_present_flag) }; + aspect_ratio_info_present_flag as u64 + }); + __bindgen_bitfield_unit.set(1usize, 1u8, { + let timing_info_present_flag: u32 = + unsafe { ::std::mem::transmute(timing_info_present_flag) }; + timing_info_present_flag as u64 + }); + __bindgen_bitfield_unit.set(2usize, 1u8, { + let bitstream_restriction_flag: u32 = + unsafe { ::std::mem::transmute(bitstream_restriction_flag) }; + bitstream_restriction_flag as u64 + }); + __bindgen_bitfield_unit.set(3usize, 5u8, { + let log2_max_mv_length_horizontal: u32 = + unsafe { ::std::mem::transmute(log2_max_mv_length_horizontal) }; + log2_max_mv_length_horizontal as u64 + }); + __bindgen_bitfield_unit.set(8usize, 5u8, { + let log2_max_mv_length_vertical: u32 = + unsafe { ::std::mem::transmute(log2_max_mv_length_vertical) }; + log2_max_mv_length_vertical as u64 + }); + __bindgen_bitfield_unit.set(13usize, 1u8, { + let fixed_frame_rate_flag: u32 = + unsafe { ::std::mem::transmute(fixed_frame_rate_flag) }; + fixed_frame_rate_flag as u64 + }); + __bindgen_bitfield_unit.set(14usize, 1u8, { + let low_delay_hrd_flag: u32 = unsafe { ::std::mem::transmute(low_delay_hrd_flag) }; + low_delay_hrd_flag as u64 + }); + __bindgen_bitfield_unit.set(15usize, 1u8, { + let motion_vectors_over_pic_boundaries_flag: u32 = + unsafe { ::std::mem::transmute(motion_vectors_over_pic_boundaries_flag) }; + motion_vectors_over_pic_boundaries_flag as u64 + }); + __bindgen_bitfield_unit.set(16usize, 16u8, { + let reserved: u32 = unsafe { ::std::mem::transmute(reserved) }; + reserved as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAEncSequenceParameterBufferH264__bindgen_ty_2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAEncSequenceParameterBufferH264 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAEncSequenceParameterBufferH264 = _VAEncSequenceParameterBufferH264; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAEncPictureParameterBufferH264 { + pub CurrPic: VAPictureH264, + pub ReferenceFrames: [VAPictureH264; 16usize], + pub coded_buf: VABufferID, + pub pic_parameter_set_id: u8, + pub seq_parameter_set_id: u8, + pub last_picture: u8, + pub frame_num: u16, + pub pic_init_qp: u8, + pub num_ref_idx_l0_active_minus1: u8, + pub num_ref_idx_l1_active_minus1: u8, + pub chroma_qp_index_offset: i8, + pub second_chroma_qp_index_offset: i8, + pub pic_fields: _VAEncPictureParameterBufferH264__bindgen_ty_1, + pub va_reserved: [u32; 4usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncPictureParameterBufferH264__bindgen_ty_1 { + pub bits: _VAEncPictureParameterBufferH264__bindgen_ty_1__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncPictureParameterBufferH264__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>, + pub __bindgen_padding_0: u16, +} +impl _VAEncPictureParameterBufferH264__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn idr_pic_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + } + #[inline] + pub fn set_idr_pic_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn reference_pic_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 2u8) as u32) } + } + #[inline] + pub fn set_reference_pic_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 2u8, val as u64) + } + } + #[inline] + pub fn entropy_coding_mode_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) } + } + #[inline] + pub fn set_entropy_coding_mode_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn weighted_pred_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) } + } + #[inline] + pub fn set_weighted_pred_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn weighted_bipred_idc(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 2u8) as u32) } + } + #[inline] + pub fn set_weighted_bipred_idc(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 2u8, val as u64) + } + } + #[inline] + pub fn constrained_intra_pred_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) } + } + #[inline] + pub fn set_constrained_intra_pred_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(7usize, 1u8, val as u64) + } + } + #[inline] + pub fn transform_8x8_mode_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u32) } + } + #[inline] + pub fn set_transform_8x8_mode_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 1u8, val as u64) + } + } + #[inline] + pub fn deblocking_filter_control_present_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u32) } + } + #[inline] + pub fn set_deblocking_filter_control_present_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(9usize, 1u8, val as u64) + } + } + #[inline] + pub fn redundant_pic_cnt_present_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u32) } + } + #[inline] + pub fn set_redundant_pic_cnt_present_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(10usize, 1u8, val as u64) + } + } + #[inline] + pub fn pic_order_present_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(11usize, 1u8) as u32) } + } + #[inline] + pub fn set_pic_order_present_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(11usize, 1u8, val as u64) + } + } + #[inline] + pub fn pic_scaling_matrix_present_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 1u8) as u32) } + } + #[inline] + pub fn set_pic_scaling_matrix_present_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(12usize, 1u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + idr_pic_flag: u32, + reference_pic_flag: u32, + entropy_coding_mode_flag: u32, + weighted_pred_flag: u32, + weighted_bipred_idc: u32, + constrained_intra_pred_flag: u32, + transform_8x8_mode_flag: u32, + deblocking_filter_control_present_flag: u32, + redundant_pic_cnt_present_flag: u32, + pic_order_present_flag: u32, + pic_scaling_matrix_present_flag: u32, + ) -> __BindgenBitfieldUnit<[u8; 2usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let idr_pic_flag: u32 = unsafe { ::std::mem::transmute(idr_pic_flag) }; + idr_pic_flag as u64 + }); + __bindgen_bitfield_unit.set(1usize, 2u8, { + let reference_pic_flag: u32 = unsafe { ::std::mem::transmute(reference_pic_flag) }; + reference_pic_flag as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let entropy_coding_mode_flag: u32 = + unsafe { ::std::mem::transmute(entropy_coding_mode_flag) }; + entropy_coding_mode_flag as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let weighted_pred_flag: u32 = unsafe { ::std::mem::transmute(weighted_pred_flag) }; + weighted_pred_flag as u64 + }); + __bindgen_bitfield_unit.set(5usize, 2u8, { + let weighted_bipred_idc: u32 = unsafe { ::std::mem::transmute(weighted_bipred_idc) }; + weighted_bipred_idc as u64 + }); + __bindgen_bitfield_unit.set(7usize, 1u8, { + let constrained_intra_pred_flag: u32 = + unsafe { ::std::mem::transmute(constrained_intra_pred_flag) }; + constrained_intra_pred_flag as u64 + }); + __bindgen_bitfield_unit.set(8usize, 1u8, { + let transform_8x8_mode_flag: u32 = + unsafe { ::std::mem::transmute(transform_8x8_mode_flag) }; + transform_8x8_mode_flag as u64 + }); + __bindgen_bitfield_unit.set(9usize, 1u8, { + let deblocking_filter_control_present_flag: u32 = + unsafe { ::std::mem::transmute(deblocking_filter_control_present_flag) }; + deblocking_filter_control_present_flag as u64 + }); + __bindgen_bitfield_unit.set(10usize, 1u8, { + let redundant_pic_cnt_present_flag: u32 = + unsafe { ::std::mem::transmute(redundant_pic_cnt_present_flag) }; + redundant_pic_cnt_present_flag as u64 + }); + __bindgen_bitfield_unit.set(11usize, 1u8, { + let pic_order_present_flag: u32 = + unsafe { ::std::mem::transmute(pic_order_present_flag) }; + pic_order_present_flag as u64 + }); + __bindgen_bitfield_unit.set(12usize, 1u8, { + let pic_scaling_matrix_present_flag: u32 = + unsafe { ::std::mem::transmute(pic_scaling_matrix_present_flag) }; + pic_scaling_matrix_present_flag as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAEncPictureParameterBufferH264__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAEncPictureParameterBufferH264 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAEncPictureParameterBufferH264 = _VAEncPictureParameterBufferH264; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncQPBufferH264 { + pub qp: u8, +} +pub type VAEncQPBufferH264 = _VAEncQPBufferH264; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncSliceParameterBufferH264 { + pub macroblock_address: u32, + pub num_macroblocks: u32, + pub macroblock_info: VABufferID, + pub slice_type: u8, + pub pic_parameter_set_id: u8, + pub idr_pic_id: u16, + pub pic_order_cnt_lsb: u16, + pub delta_pic_order_cnt_bottom: i32, + pub delta_pic_order_cnt: [i32; 2usize], + pub direct_spatial_mv_pred_flag: u8, + pub num_ref_idx_active_override_flag: u8, + pub num_ref_idx_l0_active_minus1: u8, + pub num_ref_idx_l1_active_minus1: u8, + pub RefPicList0: [VAPictureH264; 32usize], + pub RefPicList1: [VAPictureH264; 32usize], + pub luma_log2_weight_denom: u8, + pub chroma_log2_weight_denom: u8, + pub luma_weight_l0_flag: u8, + pub luma_weight_l0: [::std::os::raw::c_short; 32usize], + pub luma_offset_l0: [::std::os::raw::c_short; 32usize], + pub chroma_weight_l0_flag: u8, + pub chroma_weight_l0: [[::std::os::raw::c_short; 2usize]; 32usize], + pub chroma_offset_l0: [[::std::os::raw::c_short; 2usize]; 32usize], + pub luma_weight_l1_flag: u8, + pub luma_weight_l1: [::std::os::raw::c_short; 32usize], + pub luma_offset_l1: [::std::os::raw::c_short; 32usize], + pub chroma_weight_l1_flag: u8, + pub chroma_weight_l1: [[::std::os::raw::c_short; 2usize]; 32usize], + pub chroma_offset_l1: [[::std::os::raw::c_short; 2usize]; 32usize], + pub cabac_init_idc: u8, + pub slice_qp_delta: i8, + pub disable_deblocking_filter_idc: u8, + pub slice_alpha_c0_offset_div2: i8, + pub slice_beta_offset_div2: i8, + pub va_reserved: [u32; 4usize], +} +pub type VAEncSliceParameterBufferH264 = _VAEncSliceParameterBufferH264; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAEncMacroblockParameterBufferH264 { + pub qp: u8, + pub info: _VAEncMacroblockParameterBufferH264__bindgen_ty_1, + pub va_reserved: [u32; 4usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncMacroblockParameterBufferH264__bindgen_ty_1 { + pub intra_fields: _VAEncMacroblockParameterBufferH264__bindgen_ty_1__bindgen_ty_1, + pub inter_fields: _VAEncMacroblockParameterBufferH264__bindgen_ty_1__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncMacroblockParameterBufferH264__bindgen_ty_1__bindgen_ty_1 { + pub bits: _VAEncMacroblockParameterBufferH264__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncMacroblockParameterBufferH264__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>, + pub __bindgen_padding_0: u16, +} +impl _VAEncMacroblockParameterBufferH264__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn pred_avail_override_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + } + #[inline] + pub fn set_pred_avail_override_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn pred_avail_flags(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 8u8) as u32) } + } + #[inline] + pub fn set_pred_avail_flags(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 8u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + pred_avail_override_flag: u32, + pred_avail_flags: u32, + ) -> __BindgenBitfieldUnit<[u8; 2usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let pred_avail_override_flag: u32 = + unsafe { ::std::mem::transmute(pred_avail_override_flag) }; + pred_avail_override_flag as u64 + }); + __bindgen_bitfield_unit.set(1usize, 8u8, { + let pred_avail_flags: u32 = unsafe { ::std::mem::transmute(pred_avail_flags) }; + pred_avail_flags as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAEncMacroblockParameterBufferH264__bindgen_ty_1__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncMacroblockParameterBufferH264__bindgen_ty_1__bindgen_ty_2 { + pub bits: _VAEncMacroblockParameterBufferH264__bindgen_ty_1__bindgen_ty_2__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncMacroblockParameterBufferH264__bindgen_ty_1__bindgen_ty_2__bindgen_ty_1 { + pub reserved: u32, +} +impl Default for _VAEncMacroblockParameterBufferH264__bindgen_ty_1__bindgen_ty_2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAEncMacroblockParameterBufferH264__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAEncMacroblockParameterBufferH264 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAEncMacroblockParameterBufferH264 = _VAEncMacroblockParameterBufferH264; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAEncMiscParameterSubMbPartPelH264 { + pub disable_inter_sub_mb_partition: u32, + pub inter_sub_mb_partition_mask: _VAEncMiscParameterSubMbPartPelH264__bindgen_ty_1, + pub enable_sub_pel_mode: u32, + pub sub_pel_mode: u8, + pub reserved: [u8; 3usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncMiscParameterSubMbPartPelH264__bindgen_ty_1 { + pub bits: _VAEncMiscParameterSubMbPartPelH264__bindgen_ty_1__bindgen_ty_1, + pub value: u8, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncMiscParameterSubMbPartPelH264__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, + pub __bindgen_padding_0: [u8; 3usize], +} +impl _VAEncMiscParameterSubMbPartPelH264__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn disable_16x16_inter_mb_partition(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + } + #[inline] + pub fn set_disable_16x16_inter_mb_partition(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn disable_16x8_inter_mb_partition(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) } + } + #[inline] + pub fn set_disable_16x8_inter_mb_partition(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 1u8, val as u64) + } + } + #[inline] + pub fn disable_8x16_inter_mb_partition(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) } + } + #[inline] + pub fn set_disable_8x16_inter_mb_partition(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 1u8, val as u64) + } + } + #[inline] + pub fn disable_8x8_inter_mb_partition(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) } + } + #[inline] + pub fn set_disable_8x8_inter_mb_partition(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn disable_8x4_inter_mb_partition(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) } + } + #[inline] + pub fn set_disable_8x4_inter_mb_partition(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn disable_4x8_inter_mb_partition(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u32) } + } + #[inline] + pub fn set_disable_4x8_inter_mb_partition(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 1u8, val as u64) + } + } + #[inline] + pub fn disable_4x4_inter_mb_partition(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u32) } + } + #[inline] + pub fn set_disable_4x4_inter_mb_partition(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(6usize, 1u8, val as u64) + } + } + #[inline] + pub fn reserved(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) } + } + #[inline] + pub fn set_reserved(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(7usize, 1u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + disable_16x16_inter_mb_partition: u32, + disable_16x8_inter_mb_partition: u32, + disable_8x16_inter_mb_partition: u32, + disable_8x8_inter_mb_partition: u32, + disable_8x4_inter_mb_partition: u32, + disable_4x8_inter_mb_partition: u32, + disable_4x4_inter_mb_partition: u32, + reserved: u32, + ) -> __BindgenBitfieldUnit<[u8; 1usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let disable_16x16_inter_mb_partition: u32 = + unsafe { ::std::mem::transmute(disable_16x16_inter_mb_partition) }; + disable_16x16_inter_mb_partition as u64 + }); + __bindgen_bitfield_unit.set(1usize, 1u8, { + let disable_16x8_inter_mb_partition: u32 = + unsafe { ::std::mem::transmute(disable_16x8_inter_mb_partition) }; + disable_16x8_inter_mb_partition as u64 + }); + __bindgen_bitfield_unit.set(2usize, 1u8, { + let disable_8x16_inter_mb_partition: u32 = + unsafe { ::std::mem::transmute(disable_8x16_inter_mb_partition) }; + disable_8x16_inter_mb_partition as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let disable_8x8_inter_mb_partition: u32 = + unsafe { ::std::mem::transmute(disable_8x8_inter_mb_partition) }; + disable_8x8_inter_mb_partition as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let disable_8x4_inter_mb_partition: u32 = + unsafe { ::std::mem::transmute(disable_8x4_inter_mb_partition) }; + disable_8x4_inter_mb_partition as u64 + }); + __bindgen_bitfield_unit.set(5usize, 1u8, { + let disable_4x8_inter_mb_partition: u32 = + unsafe { ::std::mem::transmute(disable_4x8_inter_mb_partition) }; + disable_4x8_inter_mb_partition as u64 + }); + __bindgen_bitfield_unit.set(6usize, 1u8, { + let disable_4x4_inter_mb_partition: u32 = + unsafe { ::std::mem::transmute(disable_4x4_inter_mb_partition) }; + disable_4x4_inter_mb_partition as u64 + }); + __bindgen_bitfield_unit.set(7usize, 1u8, { + let reserved: u32 = unsafe { ::std::mem::transmute(reserved) }; + reserved as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAEncMiscParameterSubMbPartPelH264__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAEncMiscParameterSubMbPartPelH264 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAEncMiscParameterSubMbPartPelH264 = _VAEncMiscParameterSubMbPartPelH264; +pub type VAQMatrixBufferMPEG2 = VAIQMatrixBufferMPEG2; +pub mod VAEncPackedHeaderTypeMPEG2 { + pub type Type = ::std::os::raw::c_uint; + pub const VAEncPackedHeaderMPEG2_SPS: Type = 1; + pub const VAEncPackedHeaderMPEG2_PPS: Type = 2; + pub const VAEncPackedHeaderMPEG2_Slice: Type = 3; +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAEncSequenceParameterBufferMPEG2 { + pub intra_period: u32, + pub ip_period: u32, + pub picture_width: u16, + pub picture_height: u16, + pub bits_per_second: u32, + pub frame_rate: f32, + pub aspect_ratio_information: u16, + pub vbv_buffer_size: u32, + pub sequence_extension: _VAEncSequenceParameterBufferMPEG2__bindgen_ty_1, + pub new_gop_header: u32, + pub gop_header: _VAEncSequenceParameterBufferMPEG2__bindgen_ty_2, + pub va_reserved: [u32; 4usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncSequenceParameterBufferMPEG2__bindgen_ty_1 { + pub bits: _VAEncSequenceParameterBufferMPEG2__bindgen_ty_1__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncSequenceParameterBufferMPEG2__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 3usize]>, + pub __bindgen_padding_0: u8, +} +impl _VAEncSequenceParameterBufferMPEG2__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn profile_and_level_indication(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 8u8) as u32) } + } + #[inline] + pub fn set_profile_and_level_indication(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 8u8, val as u64) + } + } + #[inline] + pub fn progressive_sequence(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u32) } + } + #[inline] + pub fn set_progressive_sequence(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 1u8, val as u64) + } + } + #[inline] + pub fn chroma_format(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 2u8) as u32) } + } + #[inline] + pub fn set_chroma_format(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(9usize, 2u8, val as u64) + } + } + #[inline] + pub fn low_delay(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(11usize, 1u8) as u32) } + } + #[inline] + pub fn set_low_delay(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(11usize, 1u8, val as u64) + } + } + #[inline] + pub fn frame_rate_extension_n(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 2u8) as u32) } + } + #[inline] + pub fn set_frame_rate_extension_n(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(12usize, 2u8, val as u64) + } + } + #[inline] + pub fn frame_rate_extension_d(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(14usize, 5u8) as u32) } + } + #[inline] + pub fn set_frame_rate_extension_d(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(14usize, 5u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + profile_and_level_indication: u32, + progressive_sequence: u32, + chroma_format: u32, + low_delay: u32, + frame_rate_extension_n: u32, + frame_rate_extension_d: u32, + ) -> __BindgenBitfieldUnit<[u8; 3usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 3usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 8u8, { + let profile_and_level_indication: u32 = + unsafe { ::std::mem::transmute(profile_and_level_indication) }; + profile_and_level_indication as u64 + }); + __bindgen_bitfield_unit.set(8usize, 1u8, { + let progressive_sequence: u32 = unsafe { ::std::mem::transmute(progressive_sequence) }; + progressive_sequence as u64 + }); + __bindgen_bitfield_unit.set(9usize, 2u8, { + let chroma_format: u32 = unsafe { ::std::mem::transmute(chroma_format) }; + chroma_format as u64 + }); + __bindgen_bitfield_unit.set(11usize, 1u8, { + let low_delay: u32 = unsafe { ::std::mem::transmute(low_delay) }; + low_delay as u64 + }); + __bindgen_bitfield_unit.set(12usize, 2u8, { + let frame_rate_extension_n: u32 = + unsafe { ::std::mem::transmute(frame_rate_extension_n) }; + frame_rate_extension_n as u64 + }); + __bindgen_bitfield_unit.set(14usize, 5u8, { + let frame_rate_extension_d: u32 = + unsafe { ::std::mem::transmute(frame_rate_extension_d) }; + frame_rate_extension_d as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAEncSequenceParameterBufferMPEG2__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncSequenceParameterBufferMPEG2__bindgen_ty_2 { + pub bits: _VAEncSequenceParameterBufferMPEG2__bindgen_ty_2__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncSequenceParameterBufferMPEG2__bindgen_ty_2__bindgen_ty_1 { + pub _bitfield_align_1: [u32; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>, +} +impl _VAEncSequenceParameterBufferMPEG2__bindgen_ty_2__bindgen_ty_1 { + #[inline] + pub fn time_code(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 25u8) as u32) } + } + #[inline] + pub fn set_time_code(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 25u8, val as u64) + } + } + #[inline] + pub fn closed_gop(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(25usize, 1u8) as u32) } + } + #[inline] + pub fn set_closed_gop(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(25usize, 1u8, val as u64) + } + } + #[inline] + pub fn broken_link(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(26usize, 1u8) as u32) } + } + #[inline] + pub fn set_broken_link(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(26usize, 1u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + time_code: u32, + closed_gop: u32, + broken_link: u32, + ) -> __BindgenBitfieldUnit<[u8; 4usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 25u8, { + let time_code: u32 = unsafe { ::std::mem::transmute(time_code) }; + time_code as u64 + }); + __bindgen_bitfield_unit.set(25usize, 1u8, { + let closed_gop: u32 = unsafe { ::std::mem::transmute(closed_gop) }; + closed_gop as u64 + }); + __bindgen_bitfield_unit.set(26usize, 1u8, { + let broken_link: u32 = unsafe { ::std::mem::transmute(broken_link) }; + broken_link as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAEncSequenceParameterBufferMPEG2__bindgen_ty_2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAEncSequenceParameterBufferMPEG2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAEncSequenceParameterBufferMPEG2 = _VAEncSequenceParameterBufferMPEG2; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAEncPictureParameterBufferMPEG2 { + pub forward_reference_picture: VASurfaceID, + pub backward_reference_picture: VASurfaceID, + pub reconstructed_picture: VASurfaceID, + pub coded_buf: VABufferID, + pub last_picture: u8, + pub picture_type: VAEncPictureType::Type, + pub temporal_reference: u32, + pub vbv_delay: u32, + pub f_code: [[u8; 2usize]; 2usize], + pub picture_coding_extension: _VAEncPictureParameterBufferMPEG2__bindgen_ty_1, + pub composite_display: _VAEncPictureParameterBufferMPEG2__bindgen_ty_2, + pub va_reserved: [u32; 4usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncPictureParameterBufferMPEG2__bindgen_ty_1 { + pub bits: _VAEncPictureParameterBufferMPEG2__bindgen_ty_1__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncPictureParameterBufferMPEG2__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>, + pub __bindgen_padding_0: u16, +} +impl _VAEncPictureParameterBufferMPEG2__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn intra_dc_precision(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) } + } + #[inline] + pub fn set_intra_dc_precision(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 2u8, val as u64) + } + } + #[inline] + pub fn picture_structure(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 2u8) as u32) } + } + #[inline] + pub fn set_picture_structure(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 2u8, val as u64) + } + } + #[inline] + pub fn top_field_first(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) } + } + #[inline] + pub fn set_top_field_first(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn frame_pred_frame_dct(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u32) } + } + #[inline] + pub fn set_frame_pred_frame_dct(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 1u8, val as u64) + } + } + #[inline] + pub fn concealment_motion_vectors(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u32) } + } + #[inline] + pub fn set_concealment_motion_vectors(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(6usize, 1u8, val as u64) + } + } + #[inline] + pub fn q_scale_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) } + } + #[inline] + pub fn set_q_scale_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(7usize, 1u8, val as u64) + } + } + #[inline] + pub fn intra_vlc_format(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u32) } + } + #[inline] + pub fn set_intra_vlc_format(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 1u8, val as u64) + } + } + #[inline] + pub fn alternate_scan(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u32) } + } + #[inline] + pub fn set_alternate_scan(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(9usize, 1u8, val as u64) + } + } + #[inline] + pub fn repeat_first_field(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u32) } + } + #[inline] + pub fn set_repeat_first_field(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(10usize, 1u8, val as u64) + } + } + #[inline] + pub fn progressive_frame(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(11usize, 1u8) as u32) } + } + #[inline] + pub fn set_progressive_frame(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(11usize, 1u8, val as u64) + } + } + #[inline] + pub fn composite_display_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 1u8) as u32) } + } + #[inline] + pub fn set_composite_display_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(12usize, 1u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + intra_dc_precision: u32, + picture_structure: u32, + top_field_first: u32, + frame_pred_frame_dct: u32, + concealment_motion_vectors: u32, + q_scale_type: u32, + intra_vlc_format: u32, + alternate_scan: u32, + repeat_first_field: u32, + progressive_frame: u32, + composite_display_flag: u32, + ) -> __BindgenBitfieldUnit<[u8; 2usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 2u8, { + let intra_dc_precision: u32 = unsafe { ::std::mem::transmute(intra_dc_precision) }; + intra_dc_precision as u64 + }); + __bindgen_bitfield_unit.set(2usize, 2u8, { + let picture_structure: u32 = unsafe { ::std::mem::transmute(picture_structure) }; + picture_structure as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let top_field_first: u32 = unsafe { ::std::mem::transmute(top_field_first) }; + top_field_first as u64 + }); + __bindgen_bitfield_unit.set(5usize, 1u8, { + let frame_pred_frame_dct: u32 = unsafe { ::std::mem::transmute(frame_pred_frame_dct) }; + frame_pred_frame_dct as u64 + }); + __bindgen_bitfield_unit.set(6usize, 1u8, { + let concealment_motion_vectors: u32 = + unsafe { ::std::mem::transmute(concealment_motion_vectors) }; + concealment_motion_vectors as u64 + }); + __bindgen_bitfield_unit.set(7usize, 1u8, { + let q_scale_type: u32 = unsafe { ::std::mem::transmute(q_scale_type) }; + q_scale_type as u64 + }); + __bindgen_bitfield_unit.set(8usize, 1u8, { + let intra_vlc_format: u32 = unsafe { ::std::mem::transmute(intra_vlc_format) }; + intra_vlc_format as u64 + }); + __bindgen_bitfield_unit.set(9usize, 1u8, { + let alternate_scan: u32 = unsafe { ::std::mem::transmute(alternate_scan) }; + alternate_scan as u64 + }); + __bindgen_bitfield_unit.set(10usize, 1u8, { + let repeat_first_field: u32 = unsafe { ::std::mem::transmute(repeat_first_field) }; + repeat_first_field as u64 + }); + __bindgen_bitfield_unit.set(11usize, 1u8, { + let progressive_frame: u32 = unsafe { ::std::mem::transmute(progressive_frame) }; + progressive_frame as u64 + }); + __bindgen_bitfield_unit.set(12usize, 1u8, { + let composite_display_flag: u32 = + unsafe { ::std::mem::transmute(composite_display_flag) }; + composite_display_flag as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAEncPictureParameterBufferMPEG2__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncPictureParameterBufferMPEG2__bindgen_ty_2 { + pub bits: _VAEncPictureParameterBufferMPEG2__bindgen_ty_2__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncPictureParameterBufferMPEG2__bindgen_ty_2__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 3usize]>, + pub __bindgen_padding_0: u8, +} +impl _VAEncPictureParameterBufferMPEG2__bindgen_ty_2__bindgen_ty_1 { + #[inline] + pub fn v_axis(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + } + #[inline] + pub fn set_v_axis(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn field_sequence(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 3u8) as u32) } + } + #[inline] + pub fn set_field_sequence(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 3u8, val as u64) + } + } + #[inline] + pub fn sub_carrier(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) } + } + #[inline] + pub fn set_sub_carrier(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn burst_amplitude(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 7u8) as u32) } + } + #[inline] + pub fn set_burst_amplitude(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 7u8, val as u64) + } + } + #[inline] + pub fn sub_carrier_phase(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 8u8) as u32) } + } + #[inline] + pub fn set_sub_carrier_phase(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(12usize, 8u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + v_axis: u32, + field_sequence: u32, + sub_carrier: u32, + burst_amplitude: u32, + sub_carrier_phase: u32, + ) -> __BindgenBitfieldUnit<[u8; 3usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 3usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let v_axis: u32 = unsafe { ::std::mem::transmute(v_axis) }; + v_axis as u64 + }); + __bindgen_bitfield_unit.set(1usize, 3u8, { + let field_sequence: u32 = unsafe { ::std::mem::transmute(field_sequence) }; + field_sequence as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let sub_carrier: u32 = unsafe { ::std::mem::transmute(sub_carrier) }; + sub_carrier as u64 + }); + __bindgen_bitfield_unit.set(5usize, 7u8, { + let burst_amplitude: u32 = unsafe { ::std::mem::transmute(burst_amplitude) }; + burst_amplitude as u64 + }); + __bindgen_bitfield_unit.set(12usize, 8u8, { + let sub_carrier_phase: u32 = unsafe { ::std::mem::transmute(sub_carrier_phase) }; + sub_carrier_phase as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAEncPictureParameterBufferMPEG2__bindgen_ty_2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAEncPictureParameterBufferMPEG2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAEncPictureParameterBufferMPEG2 = _VAEncPictureParameterBufferMPEG2; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncSliceParameterBufferMPEG2 { + pub macroblock_address: u32, + pub num_macroblocks: u32, + pub quantiser_scale_code: i32, + pub is_intra_slice: i32, + pub va_reserved: [u32; 4usize], +} +pub type VAEncSliceParameterBufferMPEG2 = _VAEncSliceParameterBufferMPEG2; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncMiscParameterExtensionDataSeqDisplayMPEG2 { + pub extension_start_code_identifier: u8, + pub video_format: u8, + pub colour_description: u8, + pub colour_primaries: u8, + pub transfer_characteristics: u8, + pub matrix_coefficients: u8, + pub display_horizontal_size: u16, + pub display_vertical_size: u16, +} +pub type VAEncMiscParameterExtensionDataSeqDisplayMPEG2 = + _VAEncMiscParameterExtensionDataSeqDisplayMPEG2; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncSequenceParameterBufferVP8 { + pub frame_width: u32, + pub frame_height: u32, + pub frame_width_scale: u32, + pub frame_height_scale: u32, + pub error_resilient: u32, + pub kf_auto: u32, + pub kf_min_dist: u32, + pub kf_max_dist: u32, + pub bits_per_second: u32, + pub intra_period: u32, + pub reference_frames: [VASurfaceID; 4usize], + pub va_reserved: [u32; 4usize], +} +pub type VAEncSequenceParameterBufferVP8 = _VAEncSequenceParameterBufferVP8; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAEncPictureParameterBufferVP8 { + pub reconstructed_frame: VASurfaceID, + pub ref_last_frame: VASurfaceID, + pub ref_gf_frame: VASurfaceID, + pub ref_arf_frame: VASurfaceID, + pub coded_buf: VABufferID, + pub ref_flags: _VAEncPictureParameterBufferVP8__bindgen_ty_1, + pub pic_flags: _VAEncPictureParameterBufferVP8__bindgen_ty_2, + pub loop_filter_level: [i8; 4usize], + pub ref_lf_delta: [i8; 4usize], + pub mode_lf_delta: [i8; 4usize], + pub sharpness_level: u8, + pub clamp_qindex_high: u8, + pub clamp_qindex_low: u8, + pub va_reserved: [u32; 4usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncPictureParameterBufferVP8__bindgen_ty_1 { + pub bits: _VAEncPictureParameterBufferVP8__bindgen_ty_1__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncPictureParameterBufferVP8__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_align_1: [u16; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>, +} +impl _VAEncPictureParameterBufferVP8__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn force_kf(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + } + #[inline] + pub fn set_force_kf(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn no_ref_last(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) } + } + #[inline] + pub fn set_no_ref_last(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 1u8, val as u64) + } + } + #[inline] + pub fn no_ref_gf(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) } + } + #[inline] + pub fn set_no_ref_gf(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 1u8, val as u64) + } + } + #[inline] + pub fn no_ref_arf(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) } + } + #[inline] + pub fn set_no_ref_arf(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn temporal_id(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 8u8) as u32) } + } + #[inline] + pub fn set_temporal_id(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 8u8, val as u64) + } + } + #[inline] + pub fn first_ref(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 2u8) as u32) } + } + #[inline] + pub fn set_first_ref(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(12usize, 2u8, val as u64) + } + } + #[inline] + pub fn second_ref(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(14usize, 2u8) as u32) } + } + #[inline] + pub fn set_second_ref(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(14usize, 2u8, val as u64) + } + } + #[inline] + pub fn reserved(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 16u8) as u32) } + } + #[inline] + pub fn set_reserved(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(16usize, 16u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + force_kf: u32, + no_ref_last: u32, + no_ref_gf: u32, + no_ref_arf: u32, + temporal_id: u32, + first_ref: u32, + second_ref: u32, + reserved: u32, + ) -> __BindgenBitfieldUnit<[u8; 4usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let force_kf: u32 = unsafe { ::std::mem::transmute(force_kf) }; + force_kf as u64 + }); + __bindgen_bitfield_unit.set(1usize, 1u8, { + let no_ref_last: u32 = unsafe { ::std::mem::transmute(no_ref_last) }; + no_ref_last as u64 + }); + __bindgen_bitfield_unit.set(2usize, 1u8, { + let no_ref_gf: u32 = unsafe { ::std::mem::transmute(no_ref_gf) }; + no_ref_gf as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let no_ref_arf: u32 = unsafe { ::std::mem::transmute(no_ref_arf) }; + no_ref_arf as u64 + }); + __bindgen_bitfield_unit.set(4usize, 8u8, { + let temporal_id: u32 = unsafe { ::std::mem::transmute(temporal_id) }; + temporal_id as u64 + }); + __bindgen_bitfield_unit.set(12usize, 2u8, { + let first_ref: u32 = unsafe { ::std::mem::transmute(first_ref) }; + first_ref as u64 + }); + __bindgen_bitfield_unit.set(14usize, 2u8, { + let second_ref: u32 = unsafe { ::std::mem::transmute(second_ref) }; + second_ref as u64 + }); + __bindgen_bitfield_unit.set(16usize, 16u8, { + let reserved: u32 = unsafe { ::std::mem::transmute(reserved) }; + reserved as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAEncPictureParameterBufferVP8__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncPictureParameterBufferVP8__bindgen_ty_2 { + pub bits: _VAEncPictureParameterBufferVP8__bindgen_ty_2__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncPictureParameterBufferVP8__bindgen_ty_2__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>, +} +impl _VAEncPictureParameterBufferVP8__bindgen_ty_2__bindgen_ty_1 { + #[inline] + pub fn frame_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + } + #[inline] + pub fn set_frame_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn version(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 3u8) as u32) } + } + #[inline] + pub fn set_version(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 3u8, val as u64) + } + } + #[inline] + pub fn show_frame(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) } + } + #[inline] + pub fn set_show_frame(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn color_space(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u32) } + } + #[inline] + pub fn set_color_space(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 1u8, val as u64) + } + } + #[inline] + pub fn recon_filter_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 2u8) as u32) } + } + #[inline] + pub fn set_recon_filter_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(6usize, 2u8, val as u64) + } + } + #[inline] + pub fn loop_filter_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 2u8) as u32) } + } + #[inline] + pub fn set_loop_filter_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 2u8, val as u64) + } + } + #[inline] + pub fn auto_partitions(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u32) } + } + #[inline] + pub fn set_auto_partitions(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(10usize, 1u8, val as u64) + } + } + #[inline] + pub fn num_token_partitions(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(11usize, 2u8) as u32) } + } + #[inline] + pub fn set_num_token_partitions(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(11usize, 2u8, val as u64) + } + } + #[inline] + pub fn clamping_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(13usize, 1u8) as u32) } + } + #[inline] + pub fn set_clamping_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(13usize, 1u8, val as u64) + } + } + #[inline] + pub fn segmentation_enabled(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(14usize, 1u8) as u32) } + } + #[inline] + pub fn set_segmentation_enabled(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(14usize, 1u8, val as u64) + } + } + #[inline] + pub fn update_mb_segmentation_map(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(15usize, 1u8) as u32) } + } + #[inline] + pub fn set_update_mb_segmentation_map(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(15usize, 1u8, val as u64) + } + } + #[inline] + pub fn update_segment_feature_data(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 1u8) as u32) } + } + #[inline] + pub fn set_update_segment_feature_data(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(16usize, 1u8, val as u64) + } + } + #[inline] + pub fn loop_filter_adj_enable(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(17usize, 1u8) as u32) } + } + #[inline] + pub fn set_loop_filter_adj_enable(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(17usize, 1u8, val as u64) + } + } + #[inline] + pub fn refresh_entropy_probs(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(18usize, 1u8) as u32) } + } + #[inline] + pub fn set_refresh_entropy_probs(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(18usize, 1u8, val as u64) + } + } + #[inline] + pub fn refresh_golden_frame(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(19usize, 1u8) as u32) } + } + #[inline] + pub fn set_refresh_golden_frame(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(19usize, 1u8, val as u64) + } + } + #[inline] + pub fn refresh_alternate_frame(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(20usize, 1u8) as u32) } + } + #[inline] + pub fn set_refresh_alternate_frame(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(20usize, 1u8, val as u64) + } + } + #[inline] + pub fn refresh_last(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(21usize, 1u8) as u32) } + } + #[inline] + pub fn set_refresh_last(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(21usize, 1u8, val as u64) + } + } + #[inline] + pub fn copy_buffer_to_golden(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(22usize, 2u8) as u32) } + } + #[inline] + pub fn set_copy_buffer_to_golden(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(22usize, 2u8, val as u64) + } + } + #[inline] + pub fn copy_buffer_to_alternate(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 2u8) as u32) } + } + #[inline] + pub fn set_copy_buffer_to_alternate(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(24usize, 2u8, val as u64) + } + } + #[inline] + pub fn sign_bias_golden(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(26usize, 1u8) as u32) } + } + #[inline] + pub fn set_sign_bias_golden(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(26usize, 1u8, val as u64) + } + } + #[inline] + pub fn sign_bias_alternate(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(27usize, 1u8) as u32) } + } + #[inline] + pub fn set_sign_bias_alternate(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(27usize, 1u8, val as u64) + } + } + #[inline] + pub fn mb_no_coeff_skip(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(28usize, 1u8) as u32) } + } + #[inline] + pub fn set_mb_no_coeff_skip(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(28usize, 1u8, val as u64) + } + } + #[inline] + pub fn forced_lf_adjustment(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(29usize, 1u8) as u32) } + } + #[inline] + pub fn set_forced_lf_adjustment(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(29usize, 1u8, val as u64) + } + } + #[inline] + pub fn reserved(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(30usize, 2u8) as u32) } + } + #[inline] + pub fn set_reserved(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(30usize, 2u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + frame_type: u32, + version: u32, + show_frame: u32, + color_space: u32, + recon_filter_type: u32, + loop_filter_type: u32, + auto_partitions: u32, + num_token_partitions: u32, + clamping_type: u32, + segmentation_enabled: u32, + update_mb_segmentation_map: u32, + update_segment_feature_data: u32, + loop_filter_adj_enable: u32, + refresh_entropy_probs: u32, + refresh_golden_frame: u32, + refresh_alternate_frame: u32, + refresh_last: u32, + copy_buffer_to_golden: u32, + copy_buffer_to_alternate: u32, + sign_bias_golden: u32, + sign_bias_alternate: u32, + mb_no_coeff_skip: u32, + forced_lf_adjustment: u32, + reserved: u32, + ) -> __BindgenBitfieldUnit<[u8; 4usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let frame_type: u32 = unsafe { ::std::mem::transmute(frame_type) }; + frame_type as u64 + }); + __bindgen_bitfield_unit.set(1usize, 3u8, { + let version: u32 = unsafe { ::std::mem::transmute(version) }; + version as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let show_frame: u32 = unsafe { ::std::mem::transmute(show_frame) }; + show_frame as u64 + }); + __bindgen_bitfield_unit.set(5usize, 1u8, { + let color_space: u32 = unsafe { ::std::mem::transmute(color_space) }; + color_space as u64 + }); + __bindgen_bitfield_unit.set(6usize, 2u8, { + let recon_filter_type: u32 = unsafe { ::std::mem::transmute(recon_filter_type) }; + recon_filter_type as u64 + }); + __bindgen_bitfield_unit.set(8usize, 2u8, { + let loop_filter_type: u32 = unsafe { ::std::mem::transmute(loop_filter_type) }; + loop_filter_type as u64 + }); + __bindgen_bitfield_unit.set(10usize, 1u8, { + let auto_partitions: u32 = unsafe { ::std::mem::transmute(auto_partitions) }; + auto_partitions as u64 + }); + __bindgen_bitfield_unit.set(11usize, 2u8, { + let num_token_partitions: u32 = unsafe { ::std::mem::transmute(num_token_partitions) }; + num_token_partitions as u64 + }); + __bindgen_bitfield_unit.set(13usize, 1u8, { + let clamping_type: u32 = unsafe { ::std::mem::transmute(clamping_type) }; + clamping_type as u64 + }); + __bindgen_bitfield_unit.set(14usize, 1u8, { + let segmentation_enabled: u32 = unsafe { ::std::mem::transmute(segmentation_enabled) }; + segmentation_enabled as u64 + }); + __bindgen_bitfield_unit.set(15usize, 1u8, { + let update_mb_segmentation_map: u32 = + unsafe { ::std::mem::transmute(update_mb_segmentation_map) }; + update_mb_segmentation_map as u64 + }); + __bindgen_bitfield_unit.set(16usize, 1u8, { + let update_segment_feature_data: u32 = + unsafe { ::std::mem::transmute(update_segment_feature_data) }; + update_segment_feature_data as u64 + }); + __bindgen_bitfield_unit.set(17usize, 1u8, { + let loop_filter_adj_enable: u32 = + unsafe { ::std::mem::transmute(loop_filter_adj_enable) }; + loop_filter_adj_enable as u64 + }); + __bindgen_bitfield_unit.set(18usize, 1u8, { + let refresh_entropy_probs: u32 = + unsafe { ::std::mem::transmute(refresh_entropy_probs) }; + refresh_entropy_probs as u64 + }); + __bindgen_bitfield_unit.set(19usize, 1u8, { + let refresh_golden_frame: u32 = unsafe { ::std::mem::transmute(refresh_golden_frame) }; + refresh_golden_frame as u64 + }); + __bindgen_bitfield_unit.set(20usize, 1u8, { + let refresh_alternate_frame: u32 = + unsafe { ::std::mem::transmute(refresh_alternate_frame) }; + refresh_alternate_frame as u64 + }); + __bindgen_bitfield_unit.set(21usize, 1u8, { + let refresh_last: u32 = unsafe { ::std::mem::transmute(refresh_last) }; + refresh_last as u64 + }); + __bindgen_bitfield_unit.set(22usize, 2u8, { + let copy_buffer_to_golden: u32 = + unsafe { ::std::mem::transmute(copy_buffer_to_golden) }; + copy_buffer_to_golden as u64 + }); + __bindgen_bitfield_unit.set(24usize, 2u8, { + let copy_buffer_to_alternate: u32 = + unsafe { ::std::mem::transmute(copy_buffer_to_alternate) }; + copy_buffer_to_alternate as u64 + }); + __bindgen_bitfield_unit.set(26usize, 1u8, { + let sign_bias_golden: u32 = unsafe { ::std::mem::transmute(sign_bias_golden) }; + sign_bias_golden as u64 + }); + __bindgen_bitfield_unit.set(27usize, 1u8, { + let sign_bias_alternate: u32 = unsafe { ::std::mem::transmute(sign_bias_alternate) }; + sign_bias_alternate as u64 + }); + __bindgen_bitfield_unit.set(28usize, 1u8, { + let mb_no_coeff_skip: u32 = unsafe { ::std::mem::transmute(mb_no_coeff_skip) }; + mb_no_coeff_skip as u64 + }); + __bindgen_bitfield_unit.set(29usize, 1u8, { + let forced_lf_adjustment: u32 = unsafe { ::std::mem::transmute(forced_lf_adjustment) }; + forced_lf_adjustment as u64 + }); + __bindgen_bitfield_unit.set(30usize, 2u8, { + let reserved: u32 = unsafe { ::std::mem::transmute(reserved) }; + reserved as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAEncPictureParameterBufferVP8__bindgen_ty_2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAEncPictureParameterBufferVP8 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAEncPictureParameterBufferVP8 = _VAEncPictureParameterBufferVP8; +#[repr(C)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncMBMapBufferVP8 { + pub num_mbs: u32, + pub mb_segment_id: *mut u8, + pub va_reserved: [u32; 4usize], +} +impl Default for _VAEncMBMapBufferVP8 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAEncMBMapBufferVP8 = _VAEncMBMapBufferVP8; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAQMatrixBufferVP8 { + pub quantization_index: [u16; 4usize], + pub quantization_index_delta: [i16; 5usize], + pub va_reserved: [u32; 4usize], +} +pub type VAQMatrixBufferVP8 = _VAQMatrixBufferVP8; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VACodedBufferVP9Status { + pub base_qp_index: u16, + pub loop_filter_level: u8, + pub long_term_indication: u8, + pub next_frame_width: u16, + pub next_frame_height: u16, + pub va_reserved: [u32; 4usize], +} +pub type VACodedBufferVP9Status = _VACodedBufferVP9Status; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncSequenceParameterBufferVP9 { + pub max_frame_width: u32, + pub max_frame_height: u32, + pub kf_auto: u32, + pub kf_min_dist: u32, + pub kf_max_dist: u32, + pub bits_per_second: u32, + pub intra_period: u32, + pub va_reserved: [u32; 4usize], +} +pub type VAEncSequenceParameterBufferVP9 = _VAEncSequenceParameterBufferVP9; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAEncPictureParameterBufferVP9 { + pub frame_width_src: u32, + pub frame_height_src: u32, + pub frame_width_dst: u32, + pub frame_height_dst: u32, + pub reconstructed_frame: VASurfaceID, + pub reference_frames: [VASurfaceID; 8usize], + pub coded_buf: VABufferID, + pub ref_flags: _VAEncPictureParameterBufferVP9__bindgen_ty_1, + pub pic_flags: _VAEncPictureParameterBufferVP9__bindgen_ty_2, + pub refresh_frame_flags: u8, + pub luma_ac_qindex: u8, + pub luma_dc_qindex_delta: i8, + pub chroma_ac_qindex_delta: i8, + pub chroma_dc_qindex_delta: i8, + pub filter_level: u8, + pub sharpness_level: u8, + pub ref_lf_delta: [i8; 4usize], + pub mode_lf_delta: [i8; 2usize], + pub bit_offset_ref_lf_delta: u16, + pub bit_offset_mode_lf_delta: u16, + pub bit_offset_lf_level: u16, + pub bit_offset_qindex: u16, + pub bit_offset_first_partition_size: u16, + pub bit_offset_segmentation: u16, + pub bit_size_segmentation: u16, + pub log2_tile_rows: u8, + pub log2_tile_columns: u8, + pub skip_frame_flag: u8, + pub number_skip_frames: u8, + pub skip_frames_size: u32, + pub va_reserved: [u32; 8usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncPictureParameterBufferVP9__bindgen_ty_1 { + pub bits: _VAEncPictureParameterBufferVP9__bindgen_ty_1__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncPictureParameterBufferVP9__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>, +} +impl _VAEncPictureParameterBufferVP9__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn force_kf(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + } + #[inline] + pub fn set_force_kf(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn ref_frame_ctrl_l0(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 3u8) as u32) } + } + #[inline] + pub fn set_ref_frame_ctrl_l0(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 3u8, val as u64) + } + } + #[inline] + pub fn ref_frame_ctrl_l1(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 3u8) as u32) } + } + #[inline] + pub fn set_ref_frame_ctrl_l1(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 3u8, val as u64) + } + } + #[inline] + pub fn ref_last_idx(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 3u8) as u32) } + } + #[inline] + pub fn set_ref_last_idx(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(7usize, 3u8, val as u64) + } + } + #[inline] + pub fn ref_last_sign_bias(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u32) } + } + #[inline] + pub fn set_ref_last_sign_bias(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(10usize, 1u8, val as u64) + } + } + #[inline] + pub fn ref_gf_idx(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(11usize, 3u8) as u32) } + } + #[inline] + pub fn set_ref_gf_idx(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(11usize, 3u8, val as u64) + } + } + #[inline] + pub fn ref_gf_sign_bias(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(14usize, 1u8) as u32) } + } + #[inline] + pub fn set_ref_gf_sign_bias(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(14usize, 1u8, val as u64) + } + } + #[inline] + pub fn ref_arf_idx(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(15usize, 3u8) as u32) } + } + #[inline] + pub fn set_ref_arf_idx(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(15usize, 3u8, val as u64) + } + } + #[inline] + pub fn ref_arf_sign_bias(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(18usize, 1u8) as u32) } + } + #[inline] + pub fn set_ref_arf_sign_bias(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(18usize, 1u8, val as u64) + } + } + #[inline] + pub fn temporal_id(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(19usize, 8u8) as u32) } + } + #[inline] + pub fn set_temporal_id(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(19usize, 8u8, val as u64) + } + } + #[inline] + pub fn reserved(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(27usize, 5u8) as u32) } + } + #[inline] + pub fn set_reserved(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(27usize, 5u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + force_kf: u32, + ref_frame_ctrl_l0: u32, + ref_frame_ctrl_l1: u32, + ref_last_idx: u32, + ref_last_sign_bias: u32, + ref_gf_idx: u32, + ref_gf_sign_bias: u32, + ref_arf_idx: u32, + ref_arf_sign_bias: u32, + temporal_id: u32, + reserved: u32, + ) -> __BindgenBitfieldUnit<[u8; 4usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let force_kf: u32 = unsafe { ::std::mem::transmute(force_kf) }; + force_kf as u64 + }); + __bindgen_bitfield_unit.set(1usize, 3u8, { + let ref_frame_ctrl_l0: u32 = unsafe { ::std::mem::transmute(ref_frame_ctrl_l0) }; + ref_frame_ctrl_l0 as u64 + }); + __bindgen_bitfield_unit.set(4usize, 3u8, { + let ref_frame_ctrl_l1: u32 = unsafe { ::std::mem::transmute(ref_frame_ctrl_l1) }; + ref_frame_ctrl_l1 as u64 + }); + __bindgen_bitfield_unit.set(7usize, 3u8, { + let ref_last_idx: u32 = unsafe { ::std::mem::transmute(ref_last_idx) }; + ref_last_idx as u64 + }); + __bindgen_bitfield_unit.set(10usize, 1u8, { + let ref_last_sign_bias: u32 = unsafe { ::std::mem::transmute(ref_last_sign_bias) }; + ref_last_sign_bias as u64 + }); + __bindgen_bitfield_unit.set(11usize, 3u8, { + let ref_gf_idx: u32 = unsafe { ::std::mem::transmute(ref_gf_idx) }; + ref_gf_idx as u64 + }); + __bindgen_bitfield_unit.set(14usize, 1u8, { + let ref_gf_sign_bias: u32 = unsafe { ::std::mem::transmute(ref_gf_sign_bias) }; + ref_gf_sign_bias as u64 + }); + __bindgen_bitfield_unit.set(15usize, 3u8, { + let ref_arf_idx: u32 = unsafe { ::std::mem::transmute(ref_arf_idx) }; + ref_arf_idx as u64 + }); + __bindgen_bitfield_unit.set(18usize, 1u8, { + let ref_arf_sign_bias: u32 = unsafe { ::std::mem::transmute(ref_arf_sign_bias) }; + ref_arf_sign_bias as u64 + }); + __bindgen_bitfield_unit.set(19usize, 8u8, { + let temporal_id: u32 = unsafe { ::std::mem::transmute(temporal_id) }; + temporal_id as u64 + }); + __bindgen_bitfield_unit.set(27usize, 5u8, { + let reserved: u32 = unsafe { ::std::mem::transmute(reserved) }; + reserved as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAEncPictureParameterBufferVP9__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncPictureParameterBufferVP9__bindgen_ty_2 { + pub bits: _VAEncPictureParameterBufferVP9__bindgen_ty_2__bindgen_ty_1, + pub value: u32, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncPictureParameterBufferVP9__bindgen_ty_2__bindgen_ty_1 { + pub _bitfield_align_1: [u16; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>, +} +impl _VAEncPictureParameterBufferVP9__bindgen_ty_2__bindgen_ty_1 { + #[inline] + pub fn frame_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + } + #[inline] + pub fn set_frame_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn show_frame(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) } + } + #[inline] + pub fn set_show_frame(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 1u8, val as u64) + } + } + #[inline] + pub fn error_resilient_mode(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) } + } + #[inline] + pub fn set_error_resilient_mode(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 1u8, val as u64) + } + } + #[inline] + pub fn intra_only(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) } + } + #[inline] + pub fn set_intra_only(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn allow_high_precision_mv(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) } + } + #[inline] + pub fn set_allow_high_precision_mv(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn mcomp_filter_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 3u8) as u32) } + } + #[inline] + pub fn set_mcomp_filter_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 3u8, val as u64) + } + } + #[inline] + pub fn frame_parallel_decoding_mode(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u32) } + } + #[inline] + pub fn set_frame_parallel_decoding_mode(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 1u8, val as u64) + } + } + #[inline] + pub fn reset_frame_context(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 2u8) as u32) } + } + #[inline] + pub fn set_reset_frame_context(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(9usize, 2u8, val as u64) + } + } + #[inline] + pub fn refresh_frame_context(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(11usize, 1u8) as u32) } + } + #[inline] + pub fn set_refresh_frame_context(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(11usize, 1u8, val as u64) + } + } + #[inline] + pub fn frame_context_idx(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(12usize, 2u8) as u32) } + } + #[inline] + pub fn set_frame_context_idx(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(12usize, 2u8, val as u64) + } + } + #[inline] + pub fn segmentation_enabled(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(14usize, 1u8) as u32) } + } + #[inline] + pub fn set_segmentation_enabled(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(14usize, 1u8, val as u64) + } + } + #[inline] + pub fn segmentation_temporal_update(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(15usize, 1u8) as u32) } + } + #[inline] + pub fn set_segmentation_temporal_update(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(15usize, 1u8, val as u64) + } + } + #[inline] + pub fn segmentation_update_map(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 1u8) as u32) } + } + #[inline] + pub fn set_segmentation_update_map(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(16usize, 1u8, val as u64) + } + } + #[inline] + pub fn lossless_mode(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(17usize, 1u8) as u32) } + } + #[inline] + pub fn set_lossless_mode(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(17usize, 1u8, val as u64) + } + } + #[inline] + pub fn comp_prediction_mode(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(18usize, 2u8) as u32) } + } + #[inline] + pub fn set_comp_prediction_mode(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(18usize, 2u8, val as u64) + } + } + #[inline] + pub fn auto_segmentation(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(20usize, 1u8) as u32) } + } + #[inline] + pub fn set_auto_segmentation(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(20usize, 1u8, val as u64) + } + } + #[inline] + pub fn super_frame_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(21usize, 1u8) as u32) } + } + #[inline] + pub fn set_super_frame_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(21usize, 1u8, val as u64) + } + } + #[inline] + pub fn reserved(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(22usize, 10u8) as u32) } + } + #[inline] + pub fn set_reserved(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(22usize, 10u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + frame_type: u32, + show_frame: u32, + error_resilient_mode: u32, + intra_only: u32, + allow_high_precision_mv: u32, + mcomp_filter_type: u32, + frame_parallel_decoding_mode: u32, + reset_frame_context: u32, + refresh_frame_context: u32, + frame_context_idx: u32, + segmentation_enabled: u32, + segmentation_temporal_update: u32, + segmentation_update_map: u32, + lossless_mode: u32, + comp_prediction_mode: u32, + auto_segmentation: u32, + super_frame_flag: u32, + reserved: u32, + ) -> __BindgenBitfieldUnit<[u8; 4usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let frame_type: u32 = unsafe { ::std::mem::transmute(frame_type) }; + frame_type as u64 + }); + __bindgen_bitfield_unit.set(1usize, 1u8, { + let show_frame: u32 = unsafe { ::std::mem::transmute(show_frame) }; + show_frame as u64 + }); + __bindgen_bitfield_unit.set(2usize, 1u8, { + let error_resilient_mode: u32 = unsafe { ::std::mem::transmute(error_resilient_mode) }; + error_resilient_mode as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let intra_only: u32 = unsafe { ::std::mem::transmute(intra_only) }; + intra_only as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let allow_high_precision_mv: u32 = + unsafe { ::std::mem::transmute(allow_high_precision_mv) }; + allow_high_precision_mv as u64 + }); + __bindgen_bitfield_unit.set(5usize, 3u8, { + let mcomp_filter_type: u32 = unsafe { ::std::mem::transmute(mcomp_filter_type) }; + mcomp_filter_type as u64 + }); + __bindgen_bitfield_unit.set(8usize, 1u8, { + let frame_parallel_decoding_mode: u32 = + unsafe { ::std::mem::transmute(frame_parallel_decoding_mode) }; + frame_parallel_decoding_mode as u64 + }); + __bindgen_bitfield_unit.set(9usize, 2u8, { + let reset_frame_context: u32 = unsafe { ::std::mem::transmute(reset_frame_context) }; + reset_frame_context as u64 + }); + __bindgen_bitfield_unit.set(11usize, 1u8, { + let refresh_frame_context: u32 = + unsafe { ::std::mem::transmute(refresh_frame_context) }; + refresh_frame_context as u64 + }); + __bindgen_bitfield_unit.set(12usize, 2u8, { + let frame_context_idx: u32 = unsafe { ::std::mem::transmute(frame_context_idx) }; + frame_context_idx as u64 + }); + __bindgen_bitfield_unit.set(14usize, 1u8, { + let segmentation_enabled: u32 = unsafe { ::std::mem::transmute(segmentation_enabled) }; + segmentation_enabled as u64 + }); + __bindgen_bitfield_unit.set(15usize, 1u8, { + let segmentation_temporal_update: u32 = + unsafe { ::std::mem::transmute(segmentation_temporal_update) }; + segmentation_temporal_update as u64 + }); + __bindgen_bitfield_unit.set(16usize, 1u8, { + let segmentation_update_map: u32 = + unsafe { ::std::mem::transmute(segmentation_update_map) }; + segmentation_update_map as u64 + }); + __bindgen_bitfield_unit.set(17usize, 1u8, { + let lossless_mode: u32 = unsafe { ::std::mem::transmute(lossless_mode) }; + lossless_mode as u64 + }); + __bindgen_bitfield_unit.set(18usize, 2u8, { + let comp_prediction_mode: u32 = unsafe { ::std::mem::transmute(comp_prediction_mode) }; + comp_prediction_mode as u64 + }); + __bindgen_bitfield_unit.set(20usize, 1u8, { + let auto_segmentation: u32 = unsafe { ::std::mem::transmute(auto_segmentation) }; + auto_segmentation as u64 + }); + __bindgen_bitfield_unit.set(21usize, 1u8, { + let super_frame_flag: u32 = unsafe { ::std::mem::transmute(super_frame_flag) }; + super_frame_flag as u64 + }); + __bindgen_bitfield_unit.set(22usize, 10u8, { + let reserved: u32 = unsafe { ::std::mem::transmute(reserved) }; + reserved as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAEncPictureParameterBufferVP9__bindgen_ty_2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAEncPictureParameterBufferVP9 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAEncPictureParameterBufferVP9 = _VAEncPictureParameterBufferVP9; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAEncSegParamVP9 { + pub seg_flags: _VAEncSegParamVP9__bindgen_ty_1, + pub segment_lf_level_delta: i8, + pub segment_qindex_delta: i16, + pub va_reserved: [u32; 4usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncSegParamVP9__bindgen_ty_1 { + pub bits: _VAEncSegParamVP9__bindgen_ty_1__bindgen_ty_1, + pub value: u8, +} +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncSegParamVP9__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, +} +impl _VAEncSegParamVP9__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn segment_reference_enabled(&self) -> u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) } + } + #[inline] + pub fn set_segment_reference_enabled(&mut self, val: u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn segment_reference(&self) -> u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 2u8) as u8) } + } + #[inline] + pub fn set_segment_reference(&mut self, val: u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 2u8, val as u64) + } + } + #[inline] + pub fn segment_reference_skipped(&self) -> u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u8) } + } + #[inline] + pub fn set_segment_reference_skipped(&mut self, val: u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn reserved(&self) -> u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 4u8) as u8) } + } + #[inline] + pub fn set_reserved(&mut self, val: u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 4u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + segment_reference_enabled: u8, + segment_reference: u8, + segment_reference_skipped: u8, + reserved: u8, + ) -> __BindgenBitfieldUnit<[u8; 1usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let segment_reference_enabled: u8 = + unsafe { ::std::mem::transmute(segment_reference_enabled) }; + segment_reference_enabled as u64 + }); + __bindgen_bitfield_unit.set(1usize, 2u8, { + let segment_reference: u8 = unsafe { ::std::mem::transmute(segment_reference) }; + segment_reference as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let segment_reference_skipped: u8 = + unsafe { ::std::mem::transmute(segment_reference_skipped) }; + segment_reference_skipped as u64 + }); + __bindgen_bitfield_unit.set(4usize, 4u8, { + let reserved: u8 = unsafe { ::std::mem::transmute(reserved) }; + reserved as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAEncSegParamVP9__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAEncSegParamVP9 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAEncSegParamVP9 = _VAEncSegParamVP9; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAEncMiscParameterTypeVP9PerSegmantParam { + pub seg_data: [VAEncSegParamVP9; 8usize], + pub va_reserved: [u32; 4usize], +} +impl Default for _VAEncMiscParameterTypeVP9PerSegmantParam { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAEncMiscParameterTypeVP9PerSegmantParam = _VAEncMiscParameterTypeVP9PerSegmantParam; +#[repr(C)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncMiscParameterFEIFrameControlH264 { + pub function: u32, + pub mb_ctrl: VABufferID, + pub distortion: VABufferID, + pub mv_data: VABufferID, + pub mb_code_data: VABufferID, + pub qp: VABufferID, + pub mv_predictor: VABufferID, + pub _bitfield_align_1: [u16; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 16usize]>, + pub max_frame_size: u32, + pub num_passes: u32, + pub delta_qp: *mut u8, + pub reserved3: [u32; 4usize], +} +impl Default for _VAEncMiscParameterFEIFrameControlH264 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl _VAEncMiscParameterFEIFrameControlH264 { + #[inline] + pub fn num_mv_predictors_l0(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 16u8) as u32) } + } + #[inline] + pub fn set_num_mv_predictors_l0(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 16u8, val as u64) + } + } + #[inline] + pub fn num_mv_predictors_l1(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 16u8) as u32) } + } + #[inline] + pub fn set_num_mv_predictors_l1(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(16usize, 16u8, val as u64) + } + } + #[inline] + pub fn search_path(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(32usize, 8u8) as u32) } + } + #[inline] + pub fn set_search_path(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(32usize, 8u8, val as u64) + } + } + #[inline] + pub fn len_sp(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(40usize, 8u8) as u32) } + } + #[inline] + pub fn set_len_sp(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(40usize, 8u8, val as u64) + } + } + #[inline] + pub fn reserved0(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(48usize, 16u8) as u32) } + } + #[inline] + pub fn set_reserved0(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(48usize, 16u8, val as u64) + } + } + #[inline] + pub fn sub_mb_part_mask(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(64usize, 7u8) as u32) } + } + #[inline] + pub fn set_sub_mb_part_mask(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(64usize, 7u8, val as u64) + } + } + #[inline] + pub fn intra_part_mask(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(71usize, 5u8) as u32) } + } + #[inline] + pub fn set_intra_part_mask(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(71usize, 5u8, val as u64) + } + } + #[inline] + pub fn multi_pred_l0(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(76usize, 1u8) as u32) } + } + #[inline] + pub fn set_multi_pred_l0(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(76usize, 1u8, val as u64) + } + } + #[inline] + pub fn multi_pred_l1(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(77usize, 1u8) as u32) } + } + #[inline] + pub fn set_multi_pred_l1(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(77usize, 1u8, val as u64) + } + } + #[inline] + pub fn sub_pel_mode(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(78usize, 2u8) as u32) } + } + #[inline] + pub fn set_sub_pel_mode(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(78usize, 2u8, val as u64) + } + } + #[inline] + pub fn inter_sad(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(80usize, 2u8) as u32) } + } + #[inline] + pub fn set_inter_sad(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(80usize, 2u8, val as u64) + } + } + #[inline] + pub fn intra_sad(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(82usize, 2u8) as u32) } + } + #[inline] + pub fn set_intra_sad(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(82usize, 2u8, val as u64) + } + } + #[inline] + pub fn distortion_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(84usize, 1u8) as u32) } + } + #[inline] + pub fn set_distortion_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(84usize, 1u8, val as u64) + } + } + #[inline] + pub fn repartition_check_enable(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(85usize, 1u8) as u32) } + } + #[inline] + pub fn set_repartition_check_enable(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(85usize, 1u8, val as u64) + } + } + #[inline] + pub fn adaptive_search(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(86usize, 1u8) as u32) } + } + #[inline] + pub fn set_adaptive_search(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(86usize, 1u8, val as u64) + } + } + #[inline] + pub fn mv_predictor_enable(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(87usize, 1u8) as u32) } + } + #[inline] + pub fn set_mv_predictor_enable(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(87usize, 1u8, val as u64) + } + } + #[inline] + pub fn mb_qp(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(88usize, 1u8) as u32) } + } + #[inline] + pub fn set_mb_qp(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(88usize, 1u8, val as u64) + } + } + #[inline] + pub fn mb_input(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(89usize, 1u8) as u32) } + } + #[inline] + pub fn set_mb_input(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(89usize, 1u8, val as u64) + } + } + #[inline] + pub fn mb_size_ctrl(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(90usize, 1u8) as u32) } + } + #[inline] + pub fn set_mb_size_ctrl(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(90usize, 1u8, val as u64) + } + } + #[inline] + pub fn colocated_mb_distortion(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(91usize, 1u8) as u32) } + } + #[inline] + pub fn set_colocated_mb_distortion(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(91usize, 1u8, val as u64) + } + } + #[inline] + pub fn reserved1(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(92usize, 4u8) as u32) } + } + #[inline] + pub fn set_reserved1(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(92usize, 4u8, val as u64) + } + } + #[inline] + pub fn ref_width(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(96usize, 8u8) as u32) } + } + #[inline] + pub fn set_ref_width(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(96usize, 8u8, val as u64) + } + } + #[inline] + pub fn ref_height(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(104usize, 8u8) as u32) } + } + #[inline] + pub fn set_ref_height(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(104usize, 8u8, val as u64) + } + } + #[inline] + pub fn search_window(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(112usize, 4u8) as u32) } + } + #[inline] + pub fn set_search_window(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(112usize, 4u8, val as u64) + } + } + #[inline] + pub fn reserved2(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(116usize, 12u8) as u32) } + } + #[inline] + pub fn set_reserved2(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(116usize, 12u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + num_mv_predictors_l0: u32, + num_mv_predictors_l1: u32, + search_path: u32, + len_sp: u32, + reserved0: u32, + sub_mb_part_mask: u32, + intra_part_mask: u32, + multi_pred_l0: u32, + multi_pred_l1: u32, + sub_pel_mode: u32, + inter_sad: u32, + intra_sad: u32, + distortion_type: u32, + repartition_check_enable: u32, + adaptive_search: u32, + mv_predictor_enable: u32, + mb_qp: u32, + mb_input: u32, + mb_size_ctrl: u32, + colocated_mb_distortion: u32, + reserved1: u32, + ref_width: u32, + ref_height: u32, + search_window: u32, + reserved2: u32, + ) -> __BindgenBitfieldUnit<[u8; 16usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 16u8, { + let num_mv_predictors_l0: u32 = unsafe { ::std::mem::transmute(num_mv_predictors_l0) }; + num_mv_predictors_l0 as u64 + }); + __bindgen_bitfield_unit.set(16usize, 16u8, { + let num_mv_predictors_l1: u32 = unsafe { ::std::mem::transmute(num_mv_predictors_l1) }; + num_mv_predictors_l1 as u64 + }); + __bindgen_bitfield_unit.set(32usize, 8u8, { + let search_path: u32 = unsafe { ::std::mem::transmute(search_path) }; + search_path as u64 + }); + __bindgen_bitfield_unit.set(40usize, 8u8, { + let len_sp: u32 = unsafe { ::std::mem::transmute(len_sp) }; + len_sp as u64 + }); + __bindgen_bitfield_unit.set(48usize, 16u8, { + let reserved0: u32 = unsafe { ::std::mem::transmute(reserved0) }; + reserved0 as u64 + }); + __bindgen_bitfield_unit.set(64usize, 7u8, { + let sub_mb_part_mask: u32 = unsafe { ::std::mem::transmute(sub_mb_part_mask) }; + sub_mb_part_mask as u64 + }); + __bindgen_bitfield_unit.set(71usize, 5u8, { + let intra_part_mask: u32 = unsafe { ::std::mem::transmute(intra_part_mask) }; + intra_part_mask as u64 + }); + __bindgen_bitfield_unit.set(76usize, 1u8, { + let multi_pred_l0: u32 = unsafe { ::std::mem::transmute(multi_pred_l0) }; + multi_pred_l0 as u64 + }); + __bindgen_bitfield_unit.set(77usize, 1u8, { + let multi_pred_l1: u32 = unsafe { ::std::mem::transmute(multi_pred_l1) }; + multi_pred_l1 as u64 + }); + __bindgen_bitfield_unit.set(78usize, 2u8, { + let sub_pel_mode: u32 = unsafe { ::std::mem::transmute(sub_pel_mode) }; + sub_pel_mode as u64 + }); + __bindgen_bitfield_unit.set(80usize, 2u8, { + let inter_sad: u32 = unsafe { ::std::mem::transmute(inter_sad) }; + inter_sad as u64 + }); + __bindgen_bitfield_unit.set(82usize, 2u8, { + let intra_sad: u32 = unsafe { ::std::mem::transmute(intra_sad) }; + intra_sad as u64 + }); + __bindgen_bitfield_unit.set(84usize, 1u8, { + let distortion_type: u32 = unsafe { ::std::mem::transmute(distortion_type) }; + distortion_type as u64 + }); + __bindgen_bitfield_unit.set(85usize, 1u8, { + let repartition_check_enable: u32 = + unsafe { ::std::mem::transmute(repartition_check_enable) }; + repartition_check_enable as u64 + }); + __bindgen_bitfield_unit.set(86usize, 1u8, { + let adaptive_search: u32 = unsafe { ::std::mem::transmute(adaptive_search) }; + adaptive_search as u64 + }); + __bindgen_bitfield_unit.set(87usize, 1u8, { + let mv_predictor_enable: u32 = unsafe { ::std::mem::transmute(mv_predictor_enable) }; + mv_predictor_enable as u64 + }); + __bindgen_bitfield_unit.set(88usize, 1u8, { + let mb_qp: u32 = unsafe { ::std::mem::transmute(mb_qp) }; + mb_qp as u64 + }); + __bindgen_bitfield_unit.set(89usize, 1u8, { + let mb_input: u32 = unsafe { ::std::mem::transmute(mb_input) }; + mb_input as u64 + }); + __bindgen_bitfield_unit.set(90usize, 1u8, { + let mb_size_ctrl: u32 = unsafe { ::std::mem::transmute(mb_size_ctrl) }; + mb_size_ctrl as u64 + }); + __bindgen_bitfield_unit.set(91usize, 1u8, { + let colocated_mb_distortion: u32 = + unsafe { ::std::mem::transmute(colocated_mb_distortion) }; + colocated_mb_distortion as u64 + }); + __bindgen_bitfield_unit.set(92usize, 4u8, { + let reserved1: u32 = unsafe { ::std::mem::transmute(reserved1) }; + reserved1 as u64 + }); + __bindgen_bitfield_unit.set(96usize, 8u8, { + let ref_width: u32 = unsafe { ::std::mem::transmute(ref_width) }; + ref_width as u64 + }); + __bindgen_bitfield_unit.set(104usize, 8u8, { + let ref_height: u32 = unsafe { ::std::mem::transmute(ref_height) }; + ref_height as u64 + }); + __bindgen_bitfield_unit.set(112usize, 4u8, { + let search_window: u32 = unsafe { ::std::mem::transmute(search_window) }; + search_window as u64 + }); + __bindgen_bitfield_unit.set(116usize, 12u8, { + let reserved2: u32 = unsafe { ::std::mem::transmute(reserved2) }; + reserved2 as u64 + }); + __bindgen_bitfield_unit + } +} +pub type VAEncMiscParameterFEIFrameControlH264 = _VAEncMiscParameterFEIFrameControlH264; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncFEIMBControlH264 { + pub _bitfield_align_1: [u32; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize]>, + pub reserved1: u32, + pub reserved2: u32, + pub _bitfield_align_2: [u16; 0], + pub _bitfield_2: __BindgenBitfieldUnit<[u8; 4usize]>, +} +impl _VAEncFEIMBControlH264 { + #[inline] + pub fn force_to_intra(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } + } + #[inline] + pub fn set_force_to_intra(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn force_to_skip(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) } + } + #[inline] + pub fn set_force_to_skip(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(1usize, 1u8, val as u64) + } + } + #[inline] + pub fn force_to_nonskip(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) } + } + #[inline] + pub fn set_force_to_nonskip(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 1u8, val as u64) + } + } + #[inline] + pub fn enable_direct_bias_adjustment(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) } + } + #[inline] + pub fn set_enable_direct_bias_adjustment(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn enable_motion_bias_adjustment(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) } + } + #[inline] + pub fn set_enable_motion_bias_adjustment(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 1u8, val as u64) + } + } + #[inline] + pub fn ext_mv_cost_scaling_factor(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 3u8) as u32) } + } + #[inline] + pub fn set_ext_mv_cost_scaling_factor(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(5usize, 3u8, val as u64) + } + } + #[inline] + pub fn reserved0(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 24u8) as u32) } + } + #[inline] + pub fn set_reserved0(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 24u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + force_to_intra: u32, + force_to_skip: u32, + force_to_nonskip: u32, + enable_direct_bias_adjustment: u32, + enable_motion_bias_adjustment: u32, + ext_mv_cost_scaling_factor: u32, + reserved0: u32, + ) -> __BindgenBitfieldUnit<[u8; 4usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let force_to_intra: u32 = unsafe { ::std::mem::transmute(force_to_intra) }; + force_to_intra as u64 + }); + __bindgen_bitfield_unit.set(1usize, 1u8, { + let force_to_skip: u32 = unsafe { ::std::mem::transmute(force_to_skip) }; + force_to_skip as u64 + }); + __bindgen_bitfield_unit.set(2usize, 1u8, { + let force_to_nonskip: u32 = unsafe { ::std::mem::transmute(force_to_nonskip) }; + force_to_nonskip as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let enable_direct_bias_adjustment: u32 = + unsafe { ::std::mem::transmute(enable_direct_bias_adjustment) }; + enable_direct_bias_adjustment as u64 + }); + __bindgen_bitfield_unit.set(4usize, 1u8, { + let enable_motion_bias_adjustment: u32 = + unsafe { ::std::mem::transmute(enable_motion_bias_adjustment) }; + enable_motion_bias_adjustment as u64 + }); + __bindgen_bitfield_unit.set(5usize, 3u8, { + let ext_mv_cost_scaling_factor: u32 = + unsafe { ::std::mem::transmute(ext_mv_cost_scaling_factor) }; + ext_mv_cost_scaling_factor as u64 + }); + __bindgen_bitfield_unit.set(8usize, 24u8, { + let reserved0: u32 = unsafe { ::std::mem::transmute(reserved0) }; + reserved0 as u64 + }); + __bindgen_bitfield_unit + } + #[inline] + pub fn reserved3(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_2.get(0usize, 16u8) as u32) } + } + #[inline] + pub fn set_reserved3(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_2.set(0usize, 16u8, val as u64) + } + } + #[inline] + pub fn target_size_in_word(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_2.get(16usize, 8u8) as u32) } + } + #[inline] + pub fn set_target_size_in_word(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_2.set(16usize, 8u8, val as u64) + } + } + #[inline] + pub fn max_size_in_word(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_2.get(24usize, 8u8) as u32) } + } + #[inline] + pub fn set_max_size_in_word(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_2.set(24usize, 8u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_2( + reserved3: u32, + target_size_in_word: u32, + max_size_in_word: u32, + ) -> __BindgenBitfieldUnit<[u8; 4usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 16u8, { + let reserved3: u32 = unsafe { ::std::mem::transmute(reserved3) }; + reserved3 as u64 + }); + __bindgen_bitfield_unit.set(16usize, 8u8, { + let target_size_in_word: u32 = unsafe { ::std::mem::transmute(target_size_in_word) }; + target_size_in_word as u64 + }); + __bindgen_bitfield_unit.set(24usize, 8u8, { + let max_size_in_word: u32 = unsafe { ::std::mem::transmute(max_size_in_word) }; + max_size_in_word as u64 + }); + __bindgen_bitfield_unit + } +} +pub type VAEncFEIMBControlH264 = _VAEncFEIMBControlH264; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncFEIMVPredictorH264 { + pub ref_idx: [_VAEncFEIMVPredictorH264__bindgen_ty_1; 4usize], + pub reserved: u32, + pub mv: [VAMotionVector; 4usize], +} +#[repr(C, packed)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncFEIMVPredictorH264__bindgen_ty_1 { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>, +} +impl _VAEncFEIMVPredictorH264__bindgen_ty_1 { + #[inline] + pub fn ref_idx_l0(&self) -> u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 4u8) as u8) } + } + #[inline] + pub fn set_ref_idx_l0(&mut self, val: u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 4u8, val as u64) + } + } + #[inline] + pub fn ref_idx_l1(&self) -> u8 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 4u8) as u8) } + } + #[inline] + pub fn set_ref_idx_l1(&mut self, val: u8) { + unsafe { + let val: u8 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 4u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1(ref_idx_l0: u8, ref_idx_l1: u8) -> __BindgenBitfieldUnit<[u8; 1usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 4u8, { + let ref_idx_l0: u8 = unsafe { ::std::mem::transmute(ref_idx_l0) }; + ref_idx_l0 as u64 + }); + __bindgen_bitfield_unit.set(4usize, 4u8, { + let ref_idx_l1: u8 = unsafe { ::std::mem::transmute(ref_idx_l1) }; + ref_idx_l1 as u64 + }); + __bindgen_bitfield_unit + } +} +pub type VAEncFEIMVPredictorH264 = _VAEncFEIMVPredictorH264; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct _VAEncFEIMBCodeH264 { + pub reserved0: [u32; 3usize], + pub _bitfield_align_1: [u32; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 16usize]>, + pub mb_mode: _VAEncFEIMBCodeH264__bindgen_ty_1, + pub _bitfield_align_2: [u16; 0], + pub _bitfield_2: __BindgenBitfieldUnit<[u8; 4usize]>, + pub reserved9: [u32; 4usize], + pub reserved10: u32, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union _VAEncFEIMBCodeH264__bindgen_ty_1 { + pub intra_mb: _VAEncFEIMBCodeH264__bindgen_ty_1__bindgen_ty_1, + pub inter_mb: _VAEncFEIMBCodeH264__bindgen_ty_1__bindgen_ty_2, +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncFEIMBCodeH264__bindgen_ty_1__bindgen_ty_1 { + pub _bitfield_align_1: [u32; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 12usize]>, +} +impl _VAEncFEIMBCodeH264__bindgen_ty_1__bindgen_ty_1 { + #[inline] + pub fn luma_intra_pred_modes0(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 16u8) as u32) } + } + #[inline] + pub fn set_luma_intra_pred_modes0(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 16u8, val as u64) + } + } + #[inline] + pub fn luma_intra_pred_modes1(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 16u8) as u32) } + } + #[inline] + pub fn set_luma_intra_pred_modes1(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(16usize, 16u8, val as u64) + } + } + #[inline] + pub fn luma_intra_pred_modes2(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(32usize, 16u8) as u32) } + } + #[inline] + pub fn set_luma_intra_pred_modes2(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(32usize, 16u8, val as u64) + } + } + #[inline] + pub fn luma_intra_pred_modes3(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(48usize, 16u8) as u32) } + } + #[inline] + pub fn set_luma_intra_pred_modes3(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(48usize, 16u8, val as u64) + } + } + #[inline] + pub fn chroma_intra_pred_mode(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(64usize, 2u8) as u32) } + } + #[inline] + pub fn set_chroma_intra_pred_mode(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(64usize, 2u8, val as u64) + } + } + #[inline] + pub fn intra_pred_avail_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(66usize, 5u8) as u32) } + } + #[inline] + pub fn set_intra_pred_avail_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(66usize, 5u8, val as u64) + } + } + #[inline] + pub fn intra_pred_avail_flagF(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(71usize, 1u8) as u32) } + } + #[inline] + pub fn set_intra_pred_avail_flagF(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(71usize, 1u8, val as u64) + } + } + #[inline] + pub fn reserved6(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(72usize, 24u8) as u32) } + } + #[inline] + pub fn set_reserved6(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(72usize, 24u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + luma_intra_pred_modes0: u32, + luma_intra_pred_modes1: u32, + luma_intra_pred_modes2: u32, + luma_intra_pred_modes3: u32, + chroma_intra_pred_mode: u32, + intra_pred_avail_flag: u32, + intra_pred_avail_flagF: u32, + reserved6: u32, + ) -> __BindgenBitfieldUnit<[u8; 12usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 12usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 16u8, { + let luma_intra_pred_modes0: u32 = + unsafe { ::std::mem::transmute(luma_intra_pred_modes0) }; + luma_intra_pred_modes0 as u64 + }); + __bindgen_bitfield_unit.set(16usize, 16u8, { + let luma_intra_pred_modes1: u32 = + unsafe { ::std::mem::transmute(luma_intra_pred_modes1) }; + luma_intra_pred_modes1 as u64 + }); + __bindgen_bitfield_unit.set(32usize, 16u8, { + let luma_intra_pred_modes2: u32 = + unsafe { ::std::mem::transmute(luma_intra_pred_modes2) }; + luma_intra_pred_modes2 as u64 + }); + __bindgen_bitfield_unit.set(48usize, 16u8, { + let luma_intra_pred_modes3: u32 = + unsafe { ::std::mem::transmute(luma_intra_pred_modes3) }; + luma_intra_pred_modes3 as u64 + }); + __bindgen_bitfield_unit.set(64usize, 2u8, { + let chroma_intra_pred_mode: u32 = + unsafe { ::std::mem::transmute(chroma_intra_pred_mode) }; + chroma_intra_pred_mode as u64 + }); + __bindgen_bitfield_unit.set(66usize, 5u8, { + let intra_pred_avail_flag: u32 = + unsafe { ::std::mem::transmute(intra_pred_avail_flag) }; + intra_pred_avail_flag as u64 + }); + __bindgen_bitfield_unit.set(71usize, 1u8, { + let intra_pred_avail_flagF: u32 = + unsafe { ::std::mem::transmute(intra_pred_avail_flagF) }; + intra_pred_avail_flagF as u64 + }); + __bindgen_bitfield_unit.set(72usize, 24u8, { + let reserved6: u32 = unsafe { ::std::mem::transmute(reserved6) }; + reserved6 as u64 + }); + __bindgen_bitfield_unit + } +} +#[repr(C)] +#[repr(align(4))] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncFEIMBCodeH264__bindgen_ty_1__bindgen_ty_2 { + pub _bitfield_align_1: [u16; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 12usize]>, +} +impl _VAEncFEIMBCodeH264__bindgen_ty_1__bindgen_ty_2 { + #[inline] + pub fn sub_mb_shapes(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 8u8) as u32) } + } + #[inline] + pub fn set_sub_mb_shapes(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 8u8, val as u64) + } + } + #[inline] + pub fn sub_mb_pred_modes(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 8u8) as u32) } + } + #[inline] + pub fn set_sub_mb_pred_modes(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 8u8, val as u64) + } + } + #[inline] + pub fn reserved7(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 16u8) as u32) } + } + #[inline] + pub fn set_reserved7(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(16usize, 16u8, val as u64) + } + } + #[inline] + pub fn ref_idx_l0_0(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(32usize, 8u8) as u32) } + } + #[inline] + pub fn set_ref_idx_l0_0(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(32usize, 8u8, val as u64) + } + } + #[inline] + pub fn ref_idx_l0_1(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(40usize, 8u8) as u32) } + } + #[inline] + pub fn set_ref_idx_l0_1(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(40usize, 8u8, val as u64) + } + } + #[inline] + pub fn ref_idx_l0_2(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(48usize, 8u8) as u32) } + } + #[inline] + pub fn set_ref_idx_l0_2(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(48usize, 8u8, val as u64) + } + } + #[inline] + pub fn ref_idx_l0_3(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(56usize, 8u8) as u32) } + } + #[inline] + pub fn set_ref_idx_l0_3(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(56usize, 8u8, val as u64) + } + } + #[inline] + pub fn ref_idx_l1_0(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(64usize, 8u8) as u32) } + } + #[inline] + pub fn set_ref_idx_l1_0(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(64usize, 8u8, val as u64) + } + } + #[inline] + pub fn ref_idx_l1_1(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(72usize, 8u8) as u32) } + } + #[inline] + pub fn set_ref_idx_l1_1(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(72usize, 8u8, val as u64) + } + } + #[inline] + pub fn ref_idx_l1_2(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(80usize, 8u8) as u32) } + } + #[inline] + pub fn set_ref_idx_l1_2(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(80usize, 8u8, val as u64) + } + } + #[inline] + pub fn ref_idx_l1_3(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(88usize, 8u8) as u32) } + } + #[inline] + pub fn set_ref_idx_l1_3(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(88usize, 8u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + sub_mb_shapes: u32, + sub_mb_pred_modes: u32, + reserved7: u32, + ref_idx_l0_0: u32, + ref_idx_l0_1: u32, + ref_idx_l0_2: u32, + ref_idx_l0_3: u32, + ref_idx_l1_0: u32, + ref_idx_l1_1: u32, + ref_idx_l1_2: u32, + ref_idx_l1_3: u32, + ) -> __BindgenBitfieldUnit<[u8; 12usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 12usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 8u8, { + let sub_mb_shapes: u32 = unsafe { ::std::mem::transmute(sub_mb_shapes) }; + sub_mb_shapes as u64 + }); + __bindgen_bitfield_unit.set(8usize, 8u8, { + let sub_mb_pred_modes: u32 = unsafe { ::std::mem::transmute(sub_mb_pred_modes) }; + sub_mb_pred_modes as u64 + }); + __bindgen_bitfield_unit.set(16usize, 16u8, { + let reserved7: u32 = unsafe { ::std::mem::transmute(reserved7) }; + reserved7 as u64 + }); + __bindgen_bitfield_unit.set(32usize, 8u8, { + let ref_idx_l0_0: u32 = unsafe { ::std::mem::transmute(ref_idx_l0_0) }; + ref_idx_l0_0 as u64 + }); + __bindgen_bitfield_unit.set(40usize, 8u8, { + let ref_idx_l0_1: u32 = unsafe { ::std::mem::transmute(ref_idx_l0_1) }; + ref_idx_l0_1 as u64 + }); + __bindgen_bitfield_unit.set(48usize, 8u8, { + let ref_idx_l0_2: u32 = unsafe { ::std::mem::transmute(ref_idx_l0_2) }; + ref_idx_l0_2 as u64 + }); + __bindgen_bitfield_unit.set(56usize, 8u8, { + let ref_idx_l0_3: u32 = unsafe { ::std::mem::transmute(ref_idx_l0_3) }; + ref_idx_l0_3 as u64 + }); + __bindgen_bitfield_unit.set(64usize, 8u8, { + let ref_idx_l1_0: u32 = unsafe { ::std::mem::transmute(ref_idx_l1_0) }; + ref_idx_l1_0 as u64 + }); + __bindgen_bitfield_unit.set(72usize, 8u8, { + let ref_idx_l1_1: u32 = unsafe { ::std::mem::transmute(ref_idx_l1_1) }; + ref_idx_l1_1 as u64 + }); + __bindgen_bitfield_unit.set(80usize, 8u8, { + let ref_idx_l1_2: u32 = unsafe { ::std::mem::transmute(ref_idx_l1_2) }; + ref_idx_l1_2 as u64 + }); + __bindgen_bitfield_unit.set(88usize, 8u8, { + let ref_idx_l1_3: u32 = unsafe { ::std::mem::transmute(ref_idx_l1_3) }; + ref_idx_l1_3 as u64 + }); + __bindgen_bitfield_unit + } +} +impl Default for _VAEncFEIMBCodeH264__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for _VAEncFEIMBCodeH264 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl _VAEncFEIMBCodeH264 { + #[inline] + pub fn inter_mb_mode(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 2u8) as u32) } + } + #[inline] + pub fn set_inter_mb_mode(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 2u8, val as u64) + } + } + #[inline] + pub fn mb_skip_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) } + } + #[inline] + pub fn set_mb_skip_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(2usize, 1u8, val as u64) + } + } + #[inline] + pub fn reserved1(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) } + } + #[inline] + pub fn set_reserved1(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(3usize, 1u8, val as u64) + } + } + #[inline] + pub fn intra_mb_mode(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 2u8) as u32) } + } + #[inline] + pub fn set_intra_mb_mode(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(4usize, 2u8, val as u64) + } + } + #[inline] + pub fn reserved2(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u32) } + } + #[inline] + pub fn set_reserved2(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(6usize, 1u8, val as u64) + } + } + #[inline] + pub fn field_mb_polarity_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) } + } + #[inline] + pub fn set_field_mb_polarity_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(7usize, 1u8, val as u64) + } + } + #[inline] + pub fn mb_type(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 5u8) as u32) } + } + #[inline] + pub fn set_mb_type(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 5u8, val as u64) + } + } + #[inline] + pub fn intra_mb_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(13usize, 1u8) as u32) } + } + #[inline] + pub fn set_intra_mb_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(13usize, 1u8, val as u64) + } + } + #[inline] + pub fn field_mb_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(14usize, 1u8) as u32) } + } + #[inline] + pub fn set_field_mb_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(14usize, 1u8, val as u64) + } + } + #[inline] + pub fn transform8x8_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(15usize, 1u8) as u32) } + } + #[inline] + pub fn set_transform8x8_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(15usize, 1u8, val as u64) + } + } + #[inline] + pub fn reserved3(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 1u8) as u32) } + } + #[inline] + pub fn set_reserved3(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(16usize, 1u8, val as u64) + } + } + #[inline] + pub fn dc_block_coded_cr_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(17usize, 1u8) as u32) } + } + #[inline] + pub fn set_dc_block_coded_cr_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(17usize, 1u8, val as u64) + } + } + #[inline] + pub fn dc_block_coded_cb_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(18usize, 1u8) as u32) } + } + #[inline] + pub fn set_dc_block_coded_cb_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(18usize, 1u8, val as u64) + } + } + #[inline] + pub fn dc_block_coded_y_flag(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(19usize, 1u8) as u32) } + } + #[inline] + pub fn set_dc_block_coded_y_flag(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(19usize, 1u8, val as u64) + } + } + #[inline] + pub fn reserved4(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(20usize, 12u8) as u32) } + } + #[inline] + pub fn set_reserved4(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(20usize, 12u8, val as u64) + } + } + #[inline] + pub fn horz_origin(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(32usize, 8u8) as u32) } + } + #[inline] + pub fn set_horz_origin(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(32usize, 8u8, val as u64) + } + } + #[inline] + pub fn vert_origin(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(40usize, 8u8) as u32) } + } + #[inline] + pub fn set_vert_origin(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(40usize, 8u8, val as u64) + } + } + #[inline] + pub fn cbp_y(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(48usize, 16u8) as u32) } + } + #[inline] + pub fn set_cbp_y(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(48usize, 16u8, val as u64) + } + } + #[inline] + pub fn cbp_cb(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(64usize, 16u8) as u32) } + } + #[inline] + pub fn set_cbp_cb(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(64usize, 16u8, val as u64) + } + } + #[inline] + pub fn cbp_cr(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(80usize, 16u8) as u32) } + } + #[inline] + pub fn set_cbp_cr(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(80usize, 16u8, val as u64) + } + } + #[inline] + pub fn qp_prime_y(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(96usize, 8u8) as u32) } + } + #[inline] + pub fn set_qp_prime_y(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(96usize, 8u8, val as u64) + } + } + #[inline] + pub fn reserved5(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(104usize, 17u8) as u32) } + } + #[inline] + pub fn set_reserved5(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(104usize, 17u8, val as u64) + } + } + #[inline] + pub fn mb_skip_conv_disable(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(121usize, 1u8) as u32) } + } + #[inline] + pub fn set_mb_skip_conv_disable(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(121usize, 1u8, val as u64) + } + } + #[inline] + pub fn is_last_mb(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(122usize, 1u8) as u32) } + } + #[inline] + pub fn set_is_last_mb(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(122usize, 1u8, val as u64) + } + } + #[inline] + pub fn enable_coefficient_clamp(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(123usize, 1u8) as u32) } + } + #[inline] + pub fn set_enable_coefficient_clamp(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(123usize, 1u8, val as u64) + } + } + #[inline] + pub fn direct8x8_pattern(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(124usize, 4u8) as u32) } + } + #[inline] + pub fn set_direct8x8_pattern(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(124usize, 4u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + inter_mb_mode: u32, + mb_skip_flag: u32, + reserved1: u32, + intra_mb_mode: u32, + reserved2: u32, + field_mb_polarity_flag: u32, + mb_type: u32, + intra_mb_flag: u32, + field_mb_flag: u32, + transform8x8_flag: u32, + reserved3: u32, + dc_block_coded_cr_flag: u32, + dc_block_coded_cb_flag: u32, + dc_block_coded_y_flag: u32, + reserved4: u32, + horz_origin: u32, + vert_origin: u32, + cbp_y: u32, + cbp_cb: u32, + cbp_cr: u32, + qp_prime_y: u32, + reserved5: u32, + mb_skip_conv_disable: u32, + is_last_mb: u32, + enable_coefficient_clamp: u32, + direct8x8_pattern: u32, + ) -> __BindgenBitfieldUnit<[u8; 16usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 2u8, { + let inter_mb_mode: u32 = unsafe { ::std::mem::transmute(inter_mb_mode) }; + inter_mb_mode as u64 + }); + __bindgen_bitfield_unit.set(2usize, 1u8, { + let mb_skip_flag: u32 = unsafe { ::std::mem::transmute(mb_skip_flag) }; + mb_skip_flag as u64 + }); + __bindgen_bitfield_unit.set(3usize, 1u8, { + let reserved1: u32 = unsafe { ::std::mem::transmute(reserved1) }; + reserved1 as u64 + }); + __bindgen_bitfield_unit.set(4usize, 2u8, { + let intra_mb_mode: u32 = unsafe { ::std::mem::transmute(intra_mb_mode) }; + intra_mb_mode as u64 + }); + __bindgen_bitfield_unit.set(6usize, 1u8, { + let reserved2: u32 = unsafe { ::std::mem::transmute(reserved2) }; + reserved2 as u64 + }); + __bindgen_bitfield_unit.set(7usize, 1u8, { + let field_mb_polarity_flag: u32 = + unsafe { ::std::mem::transmute(field_mb_polarity_flag) }; + field_mb_polarity_flag as u64 + }); + __bindgen_bitfield_unit.set(8usize, 5u8, { + let mb_type: u32 = unsafe { ::std::mem::transmute(mb_type) }; + mb_type as u64 + }); + __bindgen_bitfield_unit.set(13usize, 1u8, { + let intra_mb_flag: u32 = unsafe { ::std::mem::transmute(intra_mb_flag) }; + intra_mb_flag as u64 + }); + __bindgen_bitfield_unit.set(14usize, 1u8, { + let field_mb_flag: u32 = unsafe { ::std::mem::transmute(field_mb_flag) }; + field_mb_flag as u64 + }); + __bindgen_bitfield_unit.set(15usize, 1u8, { + let transform8x8_flag: u32 = unsafe { ::std::mem::transmute(transform8x8_flag) }; + transform8x8_flag as u64 + }); + __bindgen_bitfield_unit.set(16usize, 1u8, { + let reserved3: u32 = unsafe { ::std::mem::transmute(reserved3) }; + reserved3 as u64 + }); + __bindgen_bitfield_unit.set(17usize, 1u8, { + let dc_block_coded_cr_flag: u32 = + unsafe { ::std::mem::transmute(dc_block_coded_cr_flag) }; + dc_block_coded_cr_flag as u64 + }); + __bindgen_bitfield_unit.set(18usize, 1u8, { + let dc_block_coded_cb_flag: u32 = + unsafe { ::std::mem::transmute(dc_block_coded_cb_flag) }; + dc_block_coded_cb_flag as u64 + }); + __bindgen_bitfield_unit.set(19usize, 1u8, { + let dc_block_coded_y_flag: u32 = + unsafe { ::std::mem::transmute(dc_block_coded_y_flag) }; + dc_block_coded_y_flag as u64 + }); + __bindgen_bitfield_unit.set(20usize, 12u8, { + let reserved4: u32 = unsafe { ::std::mem::transmute(reserved4) }; + reserved4 as u64 + }); + __bindgen_bitfield_unit.set(32usize, 8u8, { + let horz_origin: u32 = unsafe { ::std::mem::transmute(horz_origin) }; + horz_origin as u64 + }); + __bindgen_bitfield_unit.set(40usize, 8u8, { + let vert_origin: u32 = unsafe { ::std::mem::transmute(vert_origin) }; + vert_origin as u64 + }); + __bindgen_bitfield_unit.set(48usize, 16u8, { + let cbp_y: u32 = unsafe { ::std::mem::transmute(cbp_y) }; + cbp_y as u64 + }); + __bindgen_bitfield_unit.set(64usize, 16u8, { + let cbp_cb: u32 = unsafe { ::std::mem::transmute(cbp_cb) }; + cbp_cb as u64 + }); + __bindgen_bitfield_unit.set(80usize, 16u8, { + let cbp_cr: u32 = unsafe { ::std::mem::transmute(cbp_cr) }; + cbp_cr as u64 + }); + __bindgen_bitfield_unit.set(96usize, 8u8, { + let qp_prime_y: u32 = unsafe { ::std::mem::transmute(qp_prime_y) }; + qp_prime_y as u64 + }); + __bindgen_bitfield_unit.set(104usize, 17u8, { + let reserved5: u32 = unsafe { ::std::mem::transmute(reserved5) }; + reserved5 as u64 + }); + __bindgen_bitfield_unit.set(121usize, 1u8, { + let mb_skip_conv_disable: u32 = unsafe { ::std::mem::transmute(mb_skip_conv_disable) }; + mb_skip_conv_disable as u64 + }); + __bindgen_bitfield_unit.set(122usize, 1u8, { + let is_last_mb: u32 = unsafe { ::std::mem::transmute(is_last_mb) }; + is_last_mb as u64 + }); + __bindgen_bitfield_unit.set(123usize, 1u8, { + let enable_coefficient_clamp: u32 = + unsafe { ::std::mem::transmute(enable_coefficient_clamp) }; + enable_coefficient_clamp as u64 + }); + __bindgen_bitfield_unit.set(124usize, 4u8, { + let direct8x8_pattern: u32 = unsafe { ::std::mem::transmute(direct8x8_pattern) }; + direct8x8_pattern as u64 + }); + __bindgen_bitfield_unit + } + #[inline] + pub fn reserved8(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_2.get(0usize, 16u8) as u32) } + } + #[inline] + pub fn set_reserved8(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_2.set(0usize, 16u8, val as u64) + } + } + #[inline] + pub fn target_size_in_word(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_2.get(16usize, 8u8) as u32) } + } + #[inline] + pub fn set_target_size_in_word(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_2.set(16usize, 8u8, val as u64) + } + } + #[inline] + pub fn max_size_in_word(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_2.get(24usize, 8u8) as u32) } + } + #[inline] + pub fn set_max_size_in_word(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_2.set(24usize, 8u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_2( + reserved8: u32, + target_size_in_word: u32, + max_size_in_word: u32, + ) -> __BindgenBitfieldUnit<[u8; 4usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 16u8, { + let reserved8: u32 = unsafe { ::std::mem::transmute(reserved8) }; + reserved8 as u64 + }); + __bindgen_bitfield_unit.set(16usize, 8u8, { + let target_size_in_word: u32 = unsafe { ::std::mem::transmute(target_size_in_word) }; + target_size_in_word as u64 + }); + __bindgen_bitfield_unit.set(24usize, 8u8, { + let max_size_in_word: u32 = unsafe { ::std::mem::transmute(max_size_in_word) }; + max_size_in_word as u64 + }); + __bindgen_bitfield_unit + } +} +pub type VAEncFEIMBCodeH264 = _VAEncFEIMBCodeH264; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAEncFEIDistortionH264 { + pub inter_distortion: [u16; 16usize], + pub _bitfield_align_1: [u16; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 8usize]>, + pub reserved1: [u32; 2usize], +} +impl _VAEncFEIDistortionH264 { + #[inline] + pub fn best_inter_distortion(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 16u8) as u32) } + } + #[inline] + pub fn set_best_inter_distortion(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 16u8, val as u64) + } + } + #[inline] + pub fn best_intra_distortion(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 16u8) as u32) } + } + #[inline] + pub fn set_best_intra_distortion(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(16usize, 16u8, val as u64) + } + } + #[inline] + pub fn colocated_mb_distortion(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(32usize, 16u8) as u32) } + } + #[inline] + pub fn set_colocated_mb_distortion(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(32usize, 16u8, val as u64) + } + } + #[inline] + pub fn reserved0(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(48usize, 16u8) as u32) } + } + #[inline] + pub fn set_reserved0(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(48usize, 16u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + best_inter_distortion: u32, + best_intra_distortion: u32, + colocated_mb_distortion: u32, + reserved0: u32, + ) -> __BindgenBitfieldUnit<[u8; 8usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 16u8, { + let best_inter_distortion: u32 = + unsafe { ::std::mem::transmute(best_inter_distortion) }; + best_inter_distortion as u64 + }); + __bindgen_bitfield_unit.set(16usize, 16u8, { + let best_intra_distortion: u32 = + unsafe { ::std::mem::transmute(best_intra_distortion) }; + best_intra_distortion as u64 + }); + __bindgen_bitfield_unit.set(32usize, 16u8, { + let colocated_mb_distortion: u32 = + unsafe { ::std::mem::transmute(colocated_mb_distortion) }; + colocated_mb_distortion as u64 + }); + __bindgen_bitfield_unit.set(48usize, 16u8, { + let reserved0: u32 = unsafe { ::std::mem::transmute(reserved0) }; + reserved0 as u64 + }); + __bindgen_bitfield_unit + } +} +pub type VAEncFEIDistortionH264 = _VAEncFEIDistortionH264; +#[repr(C)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub struct _VAStatsStatisticsParameterH264 { + pub stats_params: VAStatsStatisticsParameter, + pub _bitfield_align_1: [u32; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 16usize]>, + pub reserved4: [u32; 2usize], +} +impl Default for _VAStatsStatisticsParameterH264 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl _VAStatsStatisticsParameterH264 { + #[inline] + pub fn frame_qp(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 8u8) as u32) } + } + #[inline] + pub fn set_frame_qp(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 8u8, val as u64) + } + } + #[inline] + pub fn len_sp(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 8u8) as u32) } + } + #[inline] + pub fn set_len_sp(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(8usize, 8u8, val as u64) + } + } + #[inline] + pub fn search_path(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 8u8) as u32) } + } + #[inline] + pub fn set_search_path(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(16usize, 8u8, val as u64) + } + } + #[inline] + pub fn reserved0(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(24usize, 8u8) as u32) } + } + #[inline] + pub fn set_reserved0(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(24usize, 8u8, val as u64) + } + } + #[inline] + pub fn sub_mb_part_mask(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(32usize, 7u8) as u32) } + } + #[inline] + pub fn set_sub_mb_part_mask(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(32usize, 7u8, val as u64) + } + } + #[inline] + pub fn sub_pel_mode(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(39usize, 2u8) as u32) } + } + #[inline] + pub fn set_sub_pel_mode(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(39usize, 2u8, val as u64) + } + } + #[inline] + pub fn inter_sad(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(41usize, 2u8) as u32) } + } + #[inline] + pub fn set_inter_sad(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(41usize, 2u8, val as u64) + } + } + #[inline] + pub fn intra_sad(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(43usize, 2u8) as u32) } + } + #[inline] + pub fn set_intra_sad(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(43usize, 2u8, val as u64) + } + } + #[inline] + pub fn adaptive_search(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(45usize, 1u8) as u32) } + } + #[inline] + pub fn set_adaptive_search(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(45usize, 1u8, val as u64) + } + } + #[inline] + pub fn mv_predictor_ctrl(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(46usize, 3u8) as u32) } + } + #[inline] + pub fn set_mv_predictor_ctrl(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(46usize, 3u8, val as u64) + } + } + #[inline] + pub fn mb_qp(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(49usize, 1u8) as u32) } + } + #[inline] + pub fn set_mb_qp(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(49usize, 1u8, val as u64) + } + } + #[inline] + pub fn ft_enable(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(50usize, 1u8) as u32) } + } + #[inline] + pub fn set_ft_enable(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(50usize, 1u8, val as u64) + } + } + #[inline] + pub fn intra_part_mask(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(51usize, 5u8) as u32) } + } + #[inline] + pub fn set_intra_part_mask(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(51usize, 5u8, val as u64) + } + } + #[inline] + pub fn reserved1(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(56usize, 8u8) as u32) } + } + #[inline] + pub fn set_reserved1(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(56usize, 8u8, val as u64) + } + } + #[inline] + pub fn ref_width(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(64usize, 8u8) as u32) } + } + #[inline] + pub fn set_ref_width(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(64usize, 8u8, val as u64) + } + } + #[inline] + pub fn ref_height(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(72usize, 8u8) as u32) } + } + #[inline] + pub fn set_ref_height(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(72usize, 8u8, val as u64) + } + } + #[inline] + pub fn search_window(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(80usize, 4u8) as u32) } + } + #[inline] + pub fn set_search_window(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(80usize, 4u8, val as u64) + } + } + #[inline] + pub fn reserved2(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(84usize, 12u8) as u32) } + } + #[inline] + pub fn set_reserved2(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(84usize, 12u8, val as u64) + } + } + #[inline] + pub fn disable_mv_output(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(96usize, 1u8) as u32) } + } + #[inline] + pub fn set_disable_mv_output(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(96usize, 1u8, val as u64) + } + } + #[inline] + pub fn disable_statistics_output(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(97usize, 1u8) as u32) } + } + #[inline] + pub fn set_disable_statistics_output(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(97usize, 1u8, val as u64) + } + } + #[inline] + pub fn enable_8x8_statistics(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(98usize, 1u8) as u32) } + } + #[inline] + pub fn set_enable_8x8_statistics(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(98usize, 1u8, val as u64) + } + } + #[inline] + pub fn reserved3(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(99usize, 29u8) as u32) } + } + #[inline] + pub fn set_reserved3(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(99usize, 29u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + frame_qp: u32, + len_sp: u32, + search_path: u32, + reserved0: u32, + sub_mb_part_mask: u32, + sub_pel_mode: u32, + inter_sad: u32, + intra_sad: u32, + adaptive_search: u32, + mv_predictor_ctrl: u32, + mb_qp: u32, + ft_enable: u32, + intra_part_mask: u32, + reserved1: u32, + ref_width: u32, + ref_height: u32, + search_window: u32, + reserved2: u32, + disable_mv_output: u32, + disable_statistics_output: u32, + enable_8x8_statistics: u32, + reserved3: u32, + ) -> __BindgenBitfieldUnit<[u8; 16usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 8u8, { + let frame_qp: u32 = unsafe { ::std::mem::transmute(frame_qp) }; + frame_qp as u64 + }); + __bindgen_bitfield_unit.set(8usize, 8u8, { + let len_sp: u32 = unsafe { ::std::mem::transmute(len_sp) }; + len_sp as u64 + }); + __bindgen_bitfield_unit.set(16usize, 8u8, { + let search_path: u32 = unsafe { ::std::mem::transmute(search_path) }; + search_path as u64 + }); + __bindgen_bitfield_unit.set(24usize, 8u8, { + let reserved0: u32 = unsafe { ::std::mem::transmute(reserved0) }; + reserved0 as u64 + }); + __bindgen_bitfield_unit.set(32usize, 7u8, { + let sub_mb_part_mask: u32 = unsafe { ::std::mem::transmute(sub_mb_part_mask) }; + sub_mb_part_mask as u64 + }); + __bindgen_bitfield_unit.set(39usize, 2u8, { + let sub_pel_mode: u32 = unsafe { ::std::mem::transmute(sub_pel_mode) }; + sub_pel_mode as u64 + }); + __bindgen_bitfield_unit.set(41usize, 2u8, { + let inter_sad: u32 = unsafe { ::std::mem::transmute(inter_sad) }; + inter_sad as u64 + }); + __bindgen_bitfield_unit.set(43usize, 2u8, { + let intra_sad: u32 = unsafe { ::std::mem::transmute(intra_sad) }; + intra_sad as u64 + }); + __bindgen_bitfield_unit.set(45usize, 1u8, { + let adaptive_search: u32 = unsafe { ::std::mem::transmute(adaptive_search) }; + adaptive_search as u64 + }); + __bindgen_bitfield_unit.set(46usize, 3u8, { + let mv_predictor_ctrl: u32 = unsafe { ::std::mem::transmute(mv_predictor_ctrl) }; + mv_predictor_ctrl as u64 + }); + __bindgen_bitfield_unit.set(49usize, 1u8, { + let mb_qp: u32 = unsafe { ::std::mem::transmute(mb_qp) }; + mb_qp as u64 + }); + __bindgen_bitfield_unit.set(50usize, 1u8, { + let ft_enable: u32 = unsafe { ::std::mem::transmute(ft_enable) }; + ft_enable as u64 + }); + __bindgen_bitfield_unit.set(51usize, 5u8, { + let intra_part_mask: u32 = unsafe { ::std::mem::transmute(intra_part_mask) }; + intra_part_mask as u64 + }); + __bindgen_bitfield_unit.set(56usize, 8u8, { + let reserved1: u32 = unsafe { ::std::mem::transmute(reserved1) }; + reserved1 as u64 + }); + __bindgen_bitfield_unit.set(64usize, 8u8, { + let ref_width: u32 = unsafe { ::std::mem::transmute(ref_width) }; + ref_width as u64 + }); + __bindgen_bitfield_unit.set(72usize, 8u8, { + let ref_height: u32 = unsafe { ::std::mem::transmute(ref_height) }; + ref_height as u64 + }); + __bindgen_bitfield_unit.set(80usize, 4u8, { + let search_window: u32 = unsafe { ::std::mem::transmute(search_window) }; + search_window as u64 + }); + __bindgen_bitfield_unit.set(84usize, 12u8, { + let reserved2: u32 = unsafe { ::std::mem::transmute(reserved2) }; + reserved2 as u64 + }); + __bindgen_bitfield_unit.set(96usize, 1u8, { + let disable_mv_output: u32 = unsafe { ::std::mem::transmute(disable_mv_output) }; + disable_mv_output as u64 + }); + __bindgen_bitfield_unit.set(97usize, 1u8, { + let disable_statistics_output: u32 = + unsafe { ::std::mem::transmute(disable_statistics_output) }; + disable_statistics_output as u64 + }); + __bindgen_bitfield_unit.set(98usize, 1u8, { + let enable_8x8_statistics: u32 = + unsafe { ::std::mem::transmute(enable_8x8_statistics) }; + enable_8x8_statistics as u64 + }); + __bindgen_bitfield_unit.set(99usize, 29u8, { + let reserved3: u32 = unsafe { ::std::mem::transmute(reserved3) }; + reserved3 as u64 + }); + __bindgen_bitfield_unit + } +} +pub type VAStatsStatisticsParameterH264 = _VAStatsStatisticsParameterH264; +#[repr(C)] +#[derive(Debug, Default, Copy, Clone, PartialEq, Eq)] +pub struct _VAStatsStatisticsH264 { + pub _bitfield_align_1: [u16; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 16usize]>, + pub sum_coef: u32, + pub _bitfield_align_2: [u32; 0], + pub _bitfield_2: __BindgenBitfieldUnit<[u8; 4usize]>, + pub variance_16x16: u32, + pub variance_8x8: [u32; 4usize], + pub pixel_average_16x16: u32, + pub pixel_average_8x8: [u32; 4usize], +} +impl _VAStatsStatisticsH264 { + #[inline] + pub fn best_inter_distortion0(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 16u8) as u32) } + } + #[inline] + pub fn set_best_inter_distortion0(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(0usize, 16u8, val as u64) + } + } + #[inline] + pub fn inter_mode0(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(16usize, 16u8) as u32) } + } + #[inline] + pub fn set_inter_mode0(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(16usize, 16u8, val as u64) + } + } + #[inline] + pub fn best_inter_distortion1(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(32usize, 16u8) as u32) } + } + #[inline] + pub fn set_best_inter_distortion1(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(32usize, 16u8, val as u64) + } + } + #[inline] + pub fn inter_mode1(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(48usize, 16u8) as u32) } + } + #[inline] + pub fn set_inter_mode1(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(48usize, 16u8, val as u64) + } + } + #[inline] + pub fn best_intra_distortion(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(64usize, 16u8) as u32) } + } + #[inline] + pub fn set_best_intra_distortion(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(64usize, 16u8, val as u64) + } + } + #[inline] + pub fn intra_mode(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(80usize, 16u8) as u32) } + } + #[inline] + pub fn set_intra_mode(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(80usize, 16u8, val as u64) + } + } + #[inline] + pub fn num_non_zero_coef(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(96usize, 16u8) as u32) } + } + #[inline] + pub fn set_num_non_zero_coef(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(96usize, 16u8, val as u64) + } + } + #[inline] + pub fn reserved0(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_1.get(112usize, 16u8) as u32) } + } + #[inline] + pub fn set_reserved0(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_1.set(112usize, 16u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_1( + best_inter_distortion0: u32, + inter_mode0: u32, + best_inter_distortion1: u32, + inter_mode1: u32, + best_intra_distortion: u32, + intra_mode: u32, + num_non_zero_coef: u32, + reserved0: u32, + ) -> __BindgenBitfieldUnit<[u8; 16usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 16u8, { + let best_inter_distortion0: u32 = + unsafe { ::std::mem::transmute(best_inter_distortion0) }; + best_inter_distortion0 as u64 + }); + __bindgen_bitfield_unit.set(16usize, 16u8, { + let inter_mode0: u32 = unsafe { ::std::mem::transmute(inter_mode0) }; + inter_mode0 as u64 + }); + __bindgen_bitfield_unit.set(32usize, 16u8, { + let best_inter_distortion1: u32 = + unsafe { ::std::mem::transmute(best_inter_distortion1) }; + best_inter_distortion1 as u64 + }); + __bindgen_bitfield_unit.set(48usize, 16u8, { + let inter_mode1: u32 = unsafe { ::std::mem::transmute(inter_mode1) }; + inter_mode1 as u64 + }); + __bindgen_bitfield_unit.set(64usize, 16u8, { + let best_intra_distortion: u32 = + unsafe { ::std::mem::transmute(best_intra_distortion) }; + best_intra_distortion as u64 + }); + __bindgen_bitfield_unit.set(80usize, 16u8, { + let intra_mode: u32 = unsafe { ::std::mem::transmute(intra_mode) }; + intra_mode as u64 + }); + __bindgen_bitfield_unit.set(96usize, 16u8, { + let num_non_zero_coef: u32 = unsafe { ::std::mem::transmute(num_non_zero_coef) }; + num_non_zero_coef as u64 + }); + __bindgen_bitfield_unit.set(112usize, 16u8, { + let reserved0: u32 = unsafe { ::std::mem::transmute(reserved0) }; + reserved0 as u64 + }); + __bindgen_bitfield_unit + } + #[inline] + pub fn mb_is_flat(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_2.get(0usize, 1u8) as u32) } + } + #[inline] + pub fn set_mb_is_flat(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_2.set(0usize, 1u8, val as u64) + } + } + #[inline] + pub fn reserved1(&self) -> u32 { + unsafe { ::std::mem::transmute(self._bitfield_2.get(1usize, 31u8) as u32) } + } + #[inline] + pub fn set_reserved1(&mut self, val: u32) { + unsafe { + let val: u32 = ::std::mem::transmute(val); + self._bitfield_2.set(1usize, 31u8, val as u64) + } + } + #[inline] + pub fn new_bitfield_2(mb_is_flat: u32, reserved1: u32) -> __BindgenBitfieldUnit<[u8; 4usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize]> = Default::default(); + __bindgen_bitfield_unit.set(0usize, 1u8, { + let mb_is_flat: u32 = unsafe { ::std::mem::transmute(mb_is_flat) }; + mb_is_flat as u64 + }); + __bindgen_bitfield_unit.set(1usize, 31u8, { + let reserved1: u32 = unsafe { ::std::mem::transmute(reserved1) }; + reserved1 as u64 + }); + __bindgen_bitfield_unit + } +} +pub type VAStatsStatisticsH264 = _VAStatsStatisticsH264; +pub const _VAProcFilterType_VAProcFilterNone: _VAProcFilterType = 0; +pub const _VAProcFilterType_VAProcFilterNoiseReduction: _VAProcFilterType = 1; +pub const _VAProcFilterType_VAProcFilterDeinterlacing: _VAProcFilterType = 2; +pub const _VAProcFilterType_VAProcFilterSharpening: _VAProcFilterType = 3; +pub const _VAProcFilterType_VAProcFilterColorBalance: _VAProcFilterType = 4; +pub const _VAProcFilterType_VAProcFilterSkinToneEnhancement: _VAProcFilterType = 5; +pub const _VAProcFilterType_VAProcFilterTotalColorCorrection: _VAProcFilterType = 6; +pub const _VAProcFilterType_VAProcFilterHVSNoiseReduction: _VAProcFilterType = 7; +pub const _VAProcFilterType_VAProcFilterHighDynamicRangeToneMapping: _VAProcFilterType = 8; +pub const _VAProcFilterType_VAProcFilter3DLUT: _VAProcFilterType = 9; +pub const _VAProcFilterType_VAProcFilterCount: _VAProcFilterType = 10; +pub type _VAProcFilterType = ::std::os::raw::c_uint; +pub use self::_VAProcFilterType as VAProcFilterType; +pub const _VAProcColorStandardType_VAProcColorStandardNone: _VAProcColorStandardType = 0; +pub const _VAProcColorStandardType_VAProcColorStandardBT601: _VAProcColorStandardType = 1; +pub const _VAProcColorStandardType_VAProcColorStandardBT709: _VAProcColorStandardType = 2; +pub const _VAProcColorStandardType_VAProcColorStandardBT470M: _VAProcColorStandardType = 3; +pub const _VAProcColorStandardType_VAProcColorStandardBT470BG: _VAProcColorStandardType = 4; +pub const _VAProcColorStandardType_VAProcColorStandardSMPTE170M: _VAProcColorStandardType = 5; +pub const _VAProcColorStandardType_VAProcColorStandardSMPTE240M: _VAProcColorStandardType = 6; +pub const _VAProcColorStandardType_VAProcColorStandardGenericFilm: _VAProcColorStandardType = 7; +pub const _VAProcColorStandardType_VAProcColorStandardSRGB: _VAProcColorStandardType = 8; +pub const _VAProcColorStandardType_VAProcColorStandardSTRGB: _VAProcColorStandardType = 9; +pub const _VAProcColorStandardType_VAProcColorStandardXVYCC601: _VAProcColorStandardType = 10; +pub const _VAProcColorStandardType_VAProcColorStandardXVYCC709: _VAProcColorStandardType = 11; +pub const _VAProcColorStandardType_VAProcColorStandardBT2020: _VAProcColorStandardType = 12; +pub const _VAProcColorStandardType_VAProcColorStandardExplicit: _VAProcColorStandardType = 13; +pub const _VAProcColorStandardType_VAProcColorStandardCount: _VAProcColorStandardType = 14; +pub type _VAProcColorStandardType = ::std::os::raw::c_uint; +pub use self::_VAProcColorStandardType as VAProcColorStandardType; +#[repr(C)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub struct _VAProcPipelineCaps { + pub pipeline_flags: u32, + pub filter_flags: u32, + pub num_forward_references: u32, + pub num_backward_references: u32, + pub input_color_standards: *mut VAProcColorStandardType, + pub num_input_color_standards: u32, + pub output_color_standards: *mut VAProcColorStandardType, + pub num_output_color_standards: u32, + pub rotation_flags: u32, + pub blend_flags: u32, + pub mirror_flags: u32, + pub num_additional_outputs: u32, + pub num_input_pixel_formats: u32, + pub input_pixel_format: *mut u32, + pub num_output_pixel_formats: u32, + pub output_pixel_format: *mut u32, + pub max_input_width: u32, + pub max_input_height: u32, + pub min_input_width: u32, + pub min_input_height: u32, + pub max_output_width: u32, + pub max_output_height: u32, + pub min_output_width: u32, + pub min_output_height: u32, + pub va_reserved: [u32; 14usize], +} +impl Default for _VAProcPipelineCaps { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type VAProcPipelineCaps = _VAProcPipelineCaps; +extern "C" { + pub fn vaQueryVideoProcFilters( + dpy: VADisplay, + context: VAContextID, + filters: *mut VAProcFilterType, + num_filters: *mut ::std::os::raw::c_uint, + ) -> VAStatus; +} +extern "C" { + pub fn vaQueryVideoProcFilterCaps( + dpy: VADisplay, + context: VAContextID, + type_: VAProcFilterType, + filter_caps: *mut ::std::os::raw::c_void, + num_filter_caps: *mut ::std::os::raw::c_uint, + ) -> VAStatus; +} +extern "C" { + pub fn vaQueryVideoProcPipelineCaps( + dpy: VADisplay, + context: VAContextID, + filters: *mut VABufferID, + num_filters: ::std::os::raw::c_uint, + pipeline_caps: *mut VAProcPipelineCaps, + ) -> VAStatus; +} +pub type VAProtectedSessionID = VAGenericID; +extern "C" { + pub fn vaCreateProtectedSession( + dpy: VADisplay, + config_id: VAConfigID, + protected_session: *mut VAProtectedSessionID, + ) -> VAStatus; +} +extern "C" { + pub fn vaDestroyProtectedSession( + dpy: VADisplay, + protected_session: VAProtectedSessionID, + ) -> VAStatus; +} +extern "C" { + pub fn vaAttachProtectedSession( + dpy: VADisplay, + id: VAGenericID, + protected_session: VAProtectedSessionID, + ) -> VAStatus; +} +extern "C" { + pub fn vaDetachProtectedSession(dpy: VADisplay, id: VAGenericID) -> VAStatus; +} +extern "C" { + pub fn vaProtectedSessionExecute( + dpy: VADisplay, + protected_session: VAProtectedSessionID, + buf_id: VABufferID, + ) -> VAStatus; +} +extern "C" { + pub fn vaGetDisplayDRM(fd: ::std::os::raw::c_int) -> VADisplay; +} diff --git a/nihed-cros-libva/src/bindings/va/constants.rs b/nihed-cros-libva/src/bindings/va/constants.rs new file mode 100644 index 0000000..6d2d4cd --- /dev/null +++ b/nihed-cros-libva/src/bindings/va/constants.rs @@ -0,0 +1,347 @@ +/* automatically generated by tools/bindgen-all-the-things */ + +#![allow(clippy::missing_safety_doc)] +#![allow(clippy::upper_case_acronyms)] +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(dead_code)] + +pub const VA_MAJOR_VERSION: u32 = 1; +pub const VA_MINOR_VERSION: u32 = 15; +pub const VA_MICRO_VERSION: u32 = 0; +pub const VA_VERSION_S: &[u8; 7usize] = b"1.15.0\0"; +pub const VA_VERSION_HEX: u32 = 17760256; +pub const VA_STATUS_SUCCESS: u32 = 0; +pub const VA_STATUS_ERROR_OPERATION_FAILED: u32 = 1; +pub const VA_STATUS_ERROR_ALLOCATION_FAILED: u32 = 2; +pub const VA_STATUS_ERROR_INVALID_DISPLAY: u32 = 3; +pub const VA_STATUS_ERROR_INVALID_CONFIG: u32 = 4; +pub const VA_STATUS_ERROR_INVALID_CONTEXT: u32 = 5; +pub const VA_STATUS_ERROR_INVALID_SURFACE: u32 = 6; +pub const VA_STATUS_ERROR_INVALID_BUFFER: u32 = 7; +pub const VA_STATUS_ERROR_INVALID_IMAGE: u32 = 8; +pub const VA_STATUS_ERROR_INVALID_SUBPICTURE: u32 = 9; +pub const VA_STATUS_ERROR_ATTR_NOT_SUPPORTED: u32 = 10; +pub const VA_STATUS_ERROR_MAX_NUM_EXCEEDED: u32 = 11; +pub const VA_STATUS_ERROR_UNSUPPORTED_PROFILE: u32 = 12; +pub const VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT: u32 = 13; +pub const VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT: u32 = 14; +pub const VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE: u32 = 15; +pub const VA_STATUS_ERROR_SURFACE_BUSY: u32 = 16; +pub const VA_STATUS_ERROR_FLAG_NOT_SUPPORTED: u32 = 17; +pub const VA_STATUS_ERROR_INVALID_PARAMETER: u32 = 18; +pub const VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED: u32 = 19; +pub const VA_STATUS_ERROR_UNIMPLEMENTED: u32 = 20; +pub const VA_STATUS_ERROR_SURFACE_IN_DISPLAYING: u32 = 21; +pub const VA_STATUS_ERROR_INVALID_IMAGE_FORMAT: u32 = 22; +pub const VA_STATUS_ERROR_DECODING_ERROR: u32 = 23; +pub const VA_STATUS_ERROR_ENCODING_ERROR: u32 = 24; +pub const VA_STATUS_ERROR_INVALID_VALUE: u32 = 25; +pub const VA_STATUS_ERROR_UNSUPPORTED_FILTER: u32 = 32; +pub const VA_STATUS_ERROR_INVALID_FILTER_CHAIN: u32 = 33; +pub const VA_STATUS_ERROR_HW_BUSY: u32 = 34; +pub const VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE: u32 = 36; +pub const VA_STATUS_ERROR_NOT_ENOUGH_BUFFER: u32 = 37; +pub const VA_STATUS_ERROR_TIMEDOUT: u32 = 38; +pub const VA_STATUS_ERROR_UNKNOWN: u32 = 4294967295; +pub const VA_FRAME_PICTURE: u32 = 0; +pub const VA_TOP_FIELD: u32 = 1; +pub const VA_BOTTOM_FIELD: u32 = 2; +pub const VA_TOP_FIELD_FIRST: u32 = 4; +pub const VA_BOTTOM_FIELD_FIRST: u32 = 8; +pub const VA_ENABLE_BLEND: u32 = 4; +pub const VA_CLEAR_DRAWABLE: u32 = 8; +pub const VA_SRC_COLOR_MASK: u32 = 240; +pub const VA_SRC_BT601: u32 = 16; +pub const VA_SRC_BT709: u32 = 32; +pub const VA_SRC_SMPTE_240: u32 = 64; +pub const VA_FILTER_SCALING_DEFAULT: u32 = 0; +pub const VA_FILTER_SCALING_FAST: u32 = 256; +pub const VA_FILTER_SCALING_HQ: u32 = 512; +pub const VA_FILTER_SCALING_NL_ANAMORPHIC: u32 = 768; +pub const VA_FILTER_SCALING_MASK: u32 = 3840; +pub const VA_FILTER_INTERPOLATION_DEFAULT: u32 = 0; +pub const VA_FILTER_INTERPOLATION_NEAREST_NEIGHBOR: u32 = 4096; +pub const VA_FILTER_INTERPOLATION_BILINEAR: u32 = 8192; +pub const VA_FILTER_INTERPOLATION_ADVANCED: u32 = 12288; +pub const VA_FILTER_INTERPOLATION_MASK: u32 = 61440; +pub const VA_PADDING_LOW: u32 = 4; +pub const VA_PADDING_MEDIUM: u32 = 8; +pub const VA_PADDING_HIGH: u32 = 16; +pub const VA_PADDING_LARGE: u32 = 32; +pub const VA_EXEC_SYNC: u32 = 0; +pub const VA_EXEC_ASYNC: u32 = 1; +pub const VA_EXEC_MODE_DEFAULT: u32 = 0; +pub const VA_EXEC_MODE_POWER_SAVING: u32 = 1; +pub const VA_EXEC_MODE_PERFORMANCE: u32 = 2; +pub const VA_FEATURE_NOT_SUPPORTED: u32 = 0; +pub const VA_FEATURE_SUPPORTED: u32 = 1; +pub const VA_FEATURE_REQUIRED: u32 = 2; +pub const VA_RT_FORMAT_YUV420: u32 = 1; +pub const VA_RT_FORMAT_YUV422: u32 = 2; +pub const VA_RT_FORMAT_YUV444: u32 = 4; +pub const VA_RT_FORMAT_YUV411: u32 = 8; +pub const VA_RT_FORMAT_YUV400: u32 = 16; +pub const VA_RT_FORMAT_YUV420_10: u32 = 256; +pub const VA_RT_FORMAT_YUV422_10: u32 = 512; +pub const VA_RT_FORMAT_YUV444_10: u32 = 1024; +pub const VA_RT_FORMAT_YUV420_12: u32 = 4096; +pub const VA_RT_FORMAT_YUV422_12: u32 = 8192; +pub const VA_RT_FORMAT_YUV444_12: u32 = 16384; +pub const VA_RT_FORMAT_RGB16: u32 = 65536; +pub const VA_RT_FORMAT_RGB32: u32 = 131072; +pub const VA_RT_FORMAT_RGBP: u32 = 1048576; +pub const VA_RT_FORMAT_RGB32_10: u32 = 2097152; +pub const VA_RT_FORMAT_PROTECTED: u32 = 2147483648; +pub const VA_RT_FORMAT_RGB32_10BPP: u32 = 2097152; +pub const VA_RT_FORMAT_YUV420_10BPP: u32 = 256; +pub const VA_RC_NONE: u32 = 1; +pub const VA_RC_CBR: u32 = 2; +pub const VA_RC_VBR: u32 = 4; +pub const VA_RC_VCM: u32 = 8; +pub const VA_RC_CQP: u32 = 16; +pub const VA_RC_VBR_CONSTRAINED: u32 = 32; +pub const VA_RC_ICQ: u32 = 64; +pub const VA_RC_MB: u32 = 128; +pub const VA_RC_CFS: u32 = 256; +pub const VA_RC_PARALLEL: u32 = 512; +pub const VA_RC_QVBR: u32 = 1024; +pub const VA_RC_AVBR: u32 = 2048; +pub const VA_RC_TCBRC: u32 = 4096; +pub const VA_DEC_SLICE_MODE_NORMAL: u32 = 1; +pub const VA_DEC_SLICE_MODE_BASE: u32 = 2; +pub const VA_DEC_PROCESSING_NONE: u32 = 0; +pub const VA_DEC_PROCESSING: u32 = 1; +pub const VA_ENC_PACKED_HEADER_NONE: u32 = 0; +pub const VA_ENC_PACKED_HEADER_SEQUENCE: u32 = 1; +pub const VA_ENC_PACKED_HEADER_PICTURE: u32 = 2; +pub const VA_ENC_PACKED_HEADER_SLICE: u32 = 4; +pub const VA_ENC_PACKED_HEADER_MISC: u32 = 8; +pub const VA_ENC_PACKED_HEADER_RAW_DATA: u32 = 16; +pub const VA_ENC_INTERLACED_NONE: u32 = 0; +pub const VA_ENC_INTERLACED_FRAME: u32 = 1; +pub const VA_ENC_INTERLACED_FIELD: u32 = 2; +pub const VA_ENC_INTERLACED_MBAFF: u32 = 4; +pub const VA_ENC_INTERLACED_PAFF: u32 = 8; +pub const VA_ENC_SLICE_STRUCTURE_POWER_OF_TWO_ROWS: u32 = 1; +pub const VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS: u32 = 2; +pub const VA_ENC_SLICE_STRUCTURE_EQUAL_ROWS: u32 = 4; +pub const VA_ENC_SLICE_STRUCTURE_MAX_SLICE_SIZE: u32 = 8; +pub const VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS: u32 = 16; +pub const VA_ENC_SLICE_STRUCTURE_EQUAL_MULTI_ROWS: u32 = 32; +pub const VA_ENC_QUANTIZATION_NONE: u32 = 0; +pub const VA_ENC_QUANTIZATION_TRELLIS_SUPPORTED: u32 = 1; +pub const VA_PREDICTION_DIRECTION_PREVIOUS: u32 = 1; +pub const VA_PREDICTION_DIRECTION_FUTURE: u32 = 2; +pub const VA_PREDICTION_DIRECTION_BI_NOT_EMPTY: u32 = 4; +pub const VA_ENC_INTRA_REFRESH_NONE: u32 = 0; +pub const VA_ENC_INTRA_REFRESH_ROLLING_COLUMN: u32 = 1; +pub const VA_ENC_INTRA_REFRESH_ROLLING_ROW: u32 = 2; +pub const VA_ENC_INTRA_REFRESH_ADAPTIVE: u32 = 16; +pub const VA_ENC_INTRA_REFRESH_CYCLIC: u32 = 32; +pub const VA_ENC_INTRA_REFRESH_P_FRAME: u32 = 65536; +pub const VA_ENC_INTRA_REFRESH_B_FRAME: u32 = 131072; +pub const VA_ENC_INTRA_REFRESH_MULTI_REF: u32 = 262144; +pub const VA_PC_CIPHER_AES: u32 = 1; +pub const VA_PC_BLOCK_SIZE_128: u32 = 1; +pub const VA_PC_BLOCK_SIZE_192: u32 = 2; +pub const VA_PC_BLOCK_SIZE_256: u32 = 4; +pub const VA_PC_CIPHER_MODE_ECB: u32 = 1; +pub const VA_PC_CIPHER_MODE_CBC: u32 = 2; +pub const VA_PC_CIPHER_MODE_CTR: u32 = 4; +pub const VA_PC_SAMPLE_TYPE_FULLSAMPLE: u32 = 1; +pub const VA_PC_SAMPLE_TYPE_SUBSAMPLE: u32 = 2; +pub const VA_PC_USAGE_DEFAULT: u32 = 0; +pub const VA_PC_USAGE_WIDEVINE: u32 = 1; +pub const VA_PROCESSING_RATE_NONE: u32 = 0; +pub const VA_PROCESSING_RATE_ENCODE: u32 = 1; +pub const VA_PROCESSING_RATE_DECODE: u32 = 2; +pub const VA_ATTRIB_NOT_SUPPORTED: u32 = 2147483648; +pub const VA_INVALID_ID: u32 = 4294967295; +pub const VA_INVALID_SURFACE: u32 = 4294967295; +pub const VA_SURFACE_ATTRIB_NOT_SUPPORTED: u32 = 0; +pub const VA_SURFACE_ATTRIB_GETTABLE: u32 = 1; +pub const VA_SURFACE_ATTRIB_SETTABLE: u32 = 2; +pub const VA_SURFACE_ATTRIB_MEM_TYPE_VA: u32 = 1; +pub const VA_SURFACE_ATTRIB_MEM_TYPE_V4L2: u32 = 2; +pub const VA_SURFACE_ATTRIB_MEM_TYPE_USER_PTR: u32 = 4; +pub const VA_SURFACE_EXTBUF_DESC_ENABLE_TILING: u32 = 1; +pub const VA_SURFACE_EXTBUF_DESC_CACHED: u32 = 2; +pub const VA_SURFACE_EXTBUF_DESC_UNCACHED: u32 = 4; +pub const VA_SURFACE_EXTBUF_DESC_WC: u32 = 8; +pub const VA_SURFACE_EXTBUF_DESC_PROTECTED: u32 = 2147483648; +pub const VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC: u32 = 0; +pub const VA_SURFACE_ATTRIB_USAGE_HINT_DECODER: u32 = 1; +pub const VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER: u32 = 2; +pub const VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ: u32 = 4; +pub const VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE: u32 = 8; +pub const VA_SURFACE_ATTRIB_USAGE_HINT_DISPLAY: u32 = 16; +pub const VA_SURFACE_ATTRIB_USAGE_HINT_EXPORT: u32 = 32; +pub const VA_PROGRESSIVE: u32 = 1; +pub const VA_ENCRYPTION_TYPE_FULLSAMPLE_CTR: u32 = 1; +pub const VA_ENCRYPTION_TYPE_FULLSAMPLE_CBC: u32 = 2; +pub const VA_ENCRYPTION_TYPE_SUBSAMPLE_CTR: u32 = 4; +pub const VA_ENCRYPTION_TYPE_SUBSAMPLE_CBC: u32 = 8; +pub const VA_SLICE_DATA_FLAG_ALL: u32 = 0; +pub const VA_SLICE_DATA_FLAG_BEGIN: u32 = 1; +pub const VA_SLICE_DATA_FLAG_MIDDLE: u32 = 2; +pub const VA_SLICE_DATA_FLAG_END: u32 = 4; +pub const VA_MB_TYPE_MOTION_FORWARD: u32 = 2; +pub const VA_MB_TYPE_MOTION_BACKWARD: u32 = 4; +pub const VA_MB_TYPE_MOTION_PATTERN: u32 = 8; +pub const VA_MB_TYPE_MOTION_INTRA: u32 = 16; +pub const VA_PICTURE_H264_INVALID: u32 = 1; +pub const VA_PICTURE_H264_TOP_FIELD: u32 = 2; +pub const VA_PICTURE_H264_BOTTOM_FIELD: u32 = 4; +pub const VA_PICTURE_H264_SHORT_TERM_REFERENCE: u32 = 8; +pub const VA_PICTURE_H264_LONG_TERM_REFERENCE: u32 = 16; +pub const VA_CODED_BUF_STATUS_PICTURE_AVE_QP_MASK: u32 = 255; +pub const VA_CODED_BUF_STATUS_LARGE_SLICE_MASK: u32 = 256; +pub const VA_CODED_BUF_STATUS_SLICE_OVERFLOW_MASK: u32 = 512; +pub const VA_CODED_BUF_STATUS_BITRATE_OVERFLOW: u32 = 1024; +pub const VA_CODED_BUF_STATUS_BITRATE_HIGH: u32 = 2048; +pub const VA_CODED_BUF_STATUS_FRAME_SIZE_OVERFLOW: u32 = 4096; +pub const VA_CODED_BUF_STATUS_BAD_BITSTREAM: u32 = 32768; +pub const VA_CODED_BUF_STATUS_AIR_MB_OVER_THRESHOLD: u32 = 16711680; +pub const VA_CODED_BUF_STATUS_NUMBER_PASSES_MASK: u32 = 251658240; +pub const VA_CODED_BUF_STATUS_SINGLE_NALU: u32 = 268435456; +pub const VA_EXPORT_SURFACE_READ_ONLY: u32 = 1; +pub const VA_EXPORT_SURFACE_WRITE_ONLY: u32 = 2; +pub const VA_EXPORT_SURFACE_READ_WRITE: u32 = 3; +pub const VA_EXPORT_SURFACE_SEPARATE_LAYERS: u32 = 4; +pub const VA_EXPORT_SURFACE_COMPOSED_LAYERS: u32 = 8; +pub const VA_TIMEOUT_INFINITE: i32 = -1; +pub const VA_FOURCC_NV12: u32 = 842094158; +pub const VA_FOURCC_NV21: u32 = 825382478; +pub const VA_FOURCC_AI44: u32 = 875839817; +pub const VA_FOURCC_RGBA: u32 = 1094862674; +pub const VA_FOURCC_RGBX: u32 = 1480738642; +pub const VA_FOURCC_BGRA: u32 = 1095911234; +pub const VA_FOURCC_BGRX: u32 = 1481787202; +pub const VA_FOURCC_ARGB: u32 = 1111970369; +pub const VA_FOURCC_XRGB: u32 = 1111970392; +pub const VA_FOURCC_ABGR: u32 = 1380401729; +pub const VA_FOURCC_XBGR: u32 = 1380401752; +pub const VA_FOURCC_UYVY: u32 = 1498831189; +pub const VA_FOURCC_YUY2: u32 = 844715353; +pub const VA_FOURCC_AYUV: u32 = 1448433985; +pub const VA_FOURCC_NV11: u32 = 825316942; +pub const VA_FOURCC_YV12: u32 = 842094169; +pub const VA_FOURCC_P208: u32 = 942682704; +pub const VA_FOURCC_I420: u32 = 808596553; +pub const VA_FOURCC_YV24: u32 = 875714137; +pub const VA_FOURCC_YV32: u32 = 842225241; +pub const VA_FOURCC_Y800: u32 = 808466521; +pub const VA_FOURCC_IMC3: u32 = 860048713; +pub const VA_FOURCC_411P: u32 = 1345401140; +pub const VA_FOURCC_411R: u32 = 1378955572; +pub const VA_FOURCC_422H: u32 = 1211249204; +pub const VA_FOURCC_422V: u32 = 1446130228; +pub const VA_FOURCC_444P: u32 = 1345598516; +pub const VA_FOURCC_RGBP: u32 = 1346520914; +pub const VA_FOURCC_BGRP: u32 = 1347569474; +pub const VA_FOURCC_RGB565: u32 = 909199186; +pub const VA_FOURCC_BGR565: u32 = 909199170; +pub const VA_FOURCC_Y210: u32 = 808530521; +pub const VA_FOURCC_Y212: u32 = 842084953; +pub const VA_FOURCC_Y216: u32 = 909193817; +pub const VA_FOURCC_Y410: u32 = 808531033; +pub const VA_FOURCC_Y412: u32 = 842085465; +pub const VA_FOURCC_Y416: u32 = 909194329; +pub const VA_FOURCC_YV16: u32 = 909203033; +pub const VA_FOURCC_P010: u32 = 808530000; +pub const VA_FOURCC_P012: u32 = 842084432; +pub const VA_FOURCC_P016: u32 = 909193296; +pub const VA_FOURCC_I010: u32 = 808529993; +pub const VA_FOURCC_IYUV: u32 = 1448433993; +pub const VA_FOURCC_A2R10G10B10: u32 = 808669761; +pub const VA_FOURCC_A2B10G10R10: u32 = 808665665; +pub const VA_FOURCC_X2R10G10B10: u32 = 808669784; +pub const VA_FOURCC_X2B10G10R10: u32 = 808665688; +pub const VA_FOURCC_Y8: u32 = 538982489; +pub const VA_FOURCC_Y16: u32 = 540422489; +pub const VA_FOURCC_VYUY: u32 = 1498765654; +pub const VA_FOURCC_YVYU: u32 = 1431918169; +pub const VA_FOURCC_ARGB64: u32 = 877089345; +pub const VA_FOURCC_ABGR64: u32 = 877085249; +pub const VA_FOURCC_XYUV: u32 = 1448434008; +pub const VA_LSB_FIRST: u32 = 1; +pub const VA_MSB_FIRST: u32 = 2; +pub const VA_SUBPICTURE_CHROMA_KEYING: u32 = 1; +pub const VA_SUBPICTURE_GLOBAL_ALPHA: u32 = 2; +pub const VA_SUBPICTURE_DESTINATION_IS_SCREEN_COORD: u32 = 4; +pub const VA_ROTATION_NONE: u32 = 0; +pub const VA_ROTATION_90: u32 = 1; +pub const VA_ROTATION_180: u32 = 2; +pub const VA_ROTATION_270: u32 = 3; +pub const VA_MIRROR_NONE: u32 = 0; +pub const VA_MIRROR_HORIZONTAL: u32 = 1; +pub const VA_MIRROR_VERTICAL: u32 = 2; +pub const VA_OOL_DEBLOCKING_FALSE: u32 = 0; +pub const VA_OOL_DEBLOCKING_TRUE: u32 = 1; +pub const VA_RENDER_MODE_UNDEFINED: u32 = 0; +pub const VA_RENDER_MODE_LOCAL_OVERLAY: u32 = 1; +pub const VA_RENDER_MODE_LOCAL_GPU: u32 = 2; +pub const VA_RENDER_MODE_EXTERNAL_OVERLAY: u32 = 4; +pub const VA_RENDER_MODE_EXTERNAL_GPU: u32 = 8; +pub const VA_RENDER_DEVICE_UNDEFINED: u32 = 0; +pub const VA_RENDER_DEVICE_LOCAL: u32 = 1; +pub const VA_RENDER_DEVICE_EXTERNAL: u32 = 2; +pub const VA_DISPLAY_ATTRIB_NOT_SUPPORTED: u32 = 0; +pub const VA_DISPLAY_ATTRIB_GETTABLE: u32 = 1; +pub const VA_DISPLAY_ATTRIB_SETTABLE: u32 = 2; +pub const VA_PICTURE_HEVC_INVALID: u32 = 1; +pub const VA_PICTURE_HEVC_FIELD_PIC: u32 = 2; +pub const VA_PICTURE_HEVC_BOTTOM_FIELD: u32 = 4; +pub const VA_PICTURE_HEVC_LONG_TERM_REFERENCE: u32 = 8; +pub const VA_PICTURE_HEVC_RPS_ST_CURR_BEFORE: u32 = 16; +pub const VA_PICTURE_HEVC_RPS_ST_CURR_AFTER: u32 = 32; +pub const VA_PICTURE_HEVC_RPS_LT_CURR: u32 = 64; +pub const VA_FEI_FUNCTION_ENC: u32 = 1; +pub const VA_FEI_FUNCTION_PAK: u32 = 2; +pub const VA_FEI_FUNCTION_ENC_PAK: u32 = 4; +pub const VA_PICTURE_STATS_INVALID: u32 = 1; +pub const VA_PICTURE_STATS_PROGRESSIVE: u32 = 0; +pub const VA_PICTURE_STATS_TOP_FIELD: u32 = 2; +pub const VA_PICTURE_STATS_BOTTOM_FIELD: u32 = 4; +pub const VA_PICTURE_STATS_CONTENT_UPDATED: u32 = 16; +pub const VA_MB_PRED_AVAIL_TOP_LEFT: u32 = 4; +pub const VA_MB_PRED_AVAIL_TOP: u32 = 16; +pub const VA_MB_PRED_AVAIL_TOP_RIGHT: u32 = 8; +pub const VA_MB_PRED_AVAIL_LEFT: u32 = 64; +pub const VA_AV1_MAX_SEGMENTS: u32 = 8; +pub const VA_AV1_SEG_LVL_MAX: u32 = 8; +pub const VA_BLEND_GLOBAL_ALPHA: u32 = 1; +pub const VA_BLEND_PREMULTIPLIED_ALPHA: u32 = 2; +pub const VA_BLEND_LUMA_KEY: u32 = 16; +pub const VA_PROC_PIPELINE_SUBPICTURES: u32 = 1; +pub const VA_PROC_PIPELINE_FAST: u32 = 2; +pub const VA_PROC_FILTER_MANDATORY: u32 = 1; +pub const VA_PIPELINE_FLAG_END: u32 = 4; +pub const VA_CHROMA_SITING_UNKNOWN: u32 = 0; +pub const VA_CHROMA_SITING_VERTICAL_TOP: u32 = 1; +pub const VA_CHROMA_SITING_VERTICAL_CENTER: u32 = 2; +pub const VA_CHROMA_SITING_VERTICAL_BOTTOM: u32 = 3; +pub const VA_CHROMA_SITING_HORIZONTAL_LEFT: u32 = 4; +pub const VA_CHROMA_SITING_HORIZONTAL_CENTER: u32 = 8; +pub const VA_SOURCE_RANGE_UNKNOWN: u32 = 0; +pub const VA_SOURCE_RANGE_REDUCED: u32 = 1; +pub const VA_SOURCE_RANGE_FULL: u32 = 2; +pub const VA_TONE_MAPPING_HDR_TO_HDR: u32 = 1; +pub const VA_TONE_MAPPING_HDR_TO_SDR: u32 = 2; +pub const VA_TONE_MAPPING_HDR_TO_EDR: u32 = 4; +pub const VA_TONE_MAPPING_SDR_TO_HDR: u32 = 8; +pub const VA_DEINTERLACING_BOTTOM_FIELD_FIRST: u32 = 1; +pub const VA_DEINTERLACING_BOTTOM_FIELD: u32 = 2; +pub const VA_DEINTERLACING_ONE_FIELD: u32 = 4; +pub const VA_DEINTERLACING_FMD_ENABLE: u32 = 8; +pub const VA_DEINTERLACING_SCD_ENABLE: u32 = 16; +pub const VA_PROC_HVS_DENOISE_DEFAULT: u32 = 0; +pub const VA_PROC_HVS_DENOISE_AUTO_BDRATE: u32 = 1; +pub const VA_PROC_HVS_DENOISE_AUTO_SUBJECTIVE: u32 = 2; +pub const VA_PROC_HVS_DENOISE_MANUAL: u32 = 3; +pub const VA_3DLUT_CHANNEL_UNKNOWN: u32 = 0; +pub const VA_3DLUT_CHANNEL_RGB_RGB: u32 = 1; +pub const VA_3DLUT_CHANNEL_YUV_RGB: u32 = 2; +pub const VA_3DLUT_CHANNEL_VUY_RGB: u32 = 4; diff --git a/nihed-cros-libva/src/buffer.rs b/nihed-cros-libva/src/buffer.rs new file mode 100644 index 0000000..41d5934 --- /dev/null +++ b/nihed-cros-libva/src/buffer.rs @@ -0,0 +1,203 @@ +// Copyright 2022 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +//! Wrappers and helpers around `VABuffer`s. + +mod h264; +mod mpeg2; +mod vp8; +mod vp9; + +pub use h264::*; +pub use mpeg2::*; +pub use vp8::*; +pub use vp9::*; + +use std::rc::Rc; + +use anyhow::Result; +use log::error; + +use crate::bindings; +use crate::status::Status; +use crate::Context; + +/// Wrapper type representing a buffer created with `vaCreateBuffer`. +pub struct Buffer { + context: Rc, + id: bindings::VABufferID, +} + +impl Buffer { + /// Creates a new buffer by wrapping a `vaCreateBuffer` call. This is just a helper for + /// [`Context::create_buffer`]. + pub(crate) fn new(context: Rc, mut type_: BufferType) -> Result { + let mut buffer_id = 0; + + let (ptr, size) = match type_ { + BufferType::PictureParameter(ref mut picture_param) => match picture_param { + PictureParameter::MPEG2(ref mut wrapper) => ( + wrapper.inner_mut() as *mut _ as *mut std::ffi::c_void, + std::mem::size_of_val(wrapper.inner_mut()), + ), + PictureParameter::VP8(ref mut wrapper) => ( + wrapper.inner_mut() as *mut _ as *mut std::ffi::c_void, + std::mem::size_of_val(wrapper.inner_mut()), + ), + PictureParameter::VP9(ref mut wrapper) => ( + wrapper.inner_mut() as *mut _ as *mut std::ffi::c_void, + std::mem::size_of_val(wrapper.inner_mut()), + ), + PictureParameter::H264(ref mut wrapper) => ( + wrapper.inner_mut() as *mut _ as *mut std::ffi::c_void, + std::mem::size_of_val(wrapper.inner_mut()), + ), + }, + + BufferType::SliceParameter(ref mut slice_param) => match slice_param { + SliceParameter::MPEG2(ref mut wrapper) => ( + wrapper.inner_mut() as *mut _ as *mut std::ffi::c_void, + std::mem::size_of_val(wrapper.inner_mut()), + ), + SliceParameter::VP8(ref mut wrapper) => ( + wrapper.inner_mut() as *mut _ as *mut std::ffi::c_void, + std::mem::size_of_val(wrapper.inner_mut()), + ), + SliceParameter::VP9(ref mut wrapper) => ( + wrapper.inner_mut() as *mut _ as *mut std::ffi::c_void, + std::mem::size_of_val(wrapper.inner_mut()), + ), + SliceParameter::H264(ref mut wrapper) => ( + wrapper.inner_mut() as *mut _ as *mut std::ffi::c_void, + std::mem::size_of_val(wrapper.inner_mut()), + ), + }, + + BufferType::IQMatrix(ref mut iq_matrix) => match iq_matrix { + IQMatrix::MPEG2(ref mut wrapper) => ( + wrapper.inner_mut() as *mut _ as *mut std::ffi::c_void, + std::mem::size_of_val(wrapper.inner_mut()), + ), + IQMatrix::VP8(ref mut wrapper) => ( + wrapper.inner_mut() as *mut _ as *mut std::ffi::c_void, + std::mem::size_of_val(wrapper.inner_mut()), + ), + IQMatrix::H264(ref mut wrapper) => ( + wrapper.inner_mut() as *mut _ as *mut std::ffi::c_void, + std::mem::size_of_val(wrapper.inner_mut()), + ), + }, + + BufferType::Probability(ref mut wrapper) => ( + wrapper.inner_mut() as *mut _ as *mut std::ffi::c_void, + std::mem::size_of_val(wrapper.inner_mut()), + ), + + BufferType::SliceData(ref mut data) => { + (data.as_mut_ptr() as *mut std::ffi::c_void, data.len()) + } + }; + + // Safe because `self` represents a valid `VAContext`. `ptr` and `size` are also ensured to + // be correct, as `ptr` is just a cast to `*c_void` from a Rust struct, and `size` is + // computed from `std::mem::size_of_val`. + Status(unsafe { + bindings::vaCreateBuffer( + context.display().handle(), + context.id(), + type_.inner(), + size as u32, + 1, + ptr, + &mut buffer_id, + ) + }) + .check()?; + + Ok(Self { + context, + id: buffer_id, + }) + } + + /// Convenience function to return a `VABufferID` vector from a slice of `Buffer`s in order to + /// easily interface with the C API where a buffer array might be needed. + pub fn as_id_vec(buffers: &[Self]) -> Vec { + buffers.iter().map(|buffer| buffer.id).collect() + } +} + +impl Drop for Buffer { + fn drop(&mut self) { + // Safe because `self` represents a valid buffer, created with + // vaCreateBuffers. + let status = + Status(unsafe { bindings::vaDestroyBuffer(self.context.display().handle(), self.id) }) + .check(); + if status.is_err() { + error!("vaDestroyBuffer failed: {}", status.unwrap_err()); + } + } +} + +/// Abstraction over `VABufferType`s. +pub enum BufferType { + /// Abstraction over `VAPictureParameterBufferType`. Needed for MPEG2, VP8, VP9, H264. + PictureParameter(PictureParameter), + /// Abstraction over `VASliceParameterBufferType`. Needed for MPEG2, VP8, VP9, H264. + SliceParameter(SliceParameter), + /// Abstraction over `VAIQMatrixBufferType`. Needed for VP8, H264. + IQMatrix(IQMatrix), + /// Abstraction over `VAProbabilityDataBufferType`. Needed for VP8. + Probability(vp8::ProbabilityDataBufferVP8), + /// Abstraction over `VASliceDataBufferType`. Needed for VP9, H264. + SliceData(Vec), +} + +impl BufferType { + /// Returns the inner FFI buffer type. + pub(crate) fn inner(&self) -> bindings::VABufferType::Type { + match self { + BufferType::PictureParameter(_) => bindings::VABufferType::VAPictureParameterBufferType, + BufferType::SliceParameter(_) => bindings::VABufferType::VASliceParameterBufferType, + BufferType::IQMatrix(_) => bindings::VABufferType::VAIQMatrixBufferType, + BufferType::Probability(_) => bindings::VABufferType::VAProbabilityBufferType, + BufferType::SliceData { .. } => bindings::VABufferType::VASliceDataBufferType, + } + } +} + +/// Abstraction over the `PictureParameterBuffer` types we support. +pub enum PictureParameter { + /// Wrapper over VAPictureParameterBufferMPEG2. + MPEG2(mpeg2::PictureParameterBufferMPEG2), + /// Wrapper over VAPictureParameterBufferVP8. + VP8(vp8::PictureParameterBufferVP8), + /// Wrapper over VAPictureParameterBufferVP9. + VP9(vp9::PictureParameterBufferVP9), + /// Wrapper over VAPictureParameterBufferH264. + H264(h264::PictureParameterBufferH264), +} + +/// Abstraction over the `SliceParameterBuffer` types we support +pub enum SliceParameter { + /// Wrapper over VASliceParameterBufferMPEG2 + MPEG2(mpeg2::SliceParameterBufferMPEG2), + /// Wrapper over VASliceParameterBufferVP8 + VP8(vp8::SliceParameterBufferVP8), + /// Wrapper over VASliceParameterBufferVP9 + VP9(vp9::SliceParameterBufferVP9), + /// Wrapper over VASliceParameterBufferH264 + H264(h264::SliceParameterBufferH264), +} + +/// Abstraction over the `IQMatrixBuffer` types we support. +pub enum IQMatrix { + /// Abstraction over `VAIQMatrixBufferMPEG2` + MPEG2(mpeg2::IQMatrixBufferMPEG2), + /// Abstraction over `VAIQMatrixBufferVP8` + VP8(vp8::IQMatrixBufferVP8), + /// Abstraction over `VAIQMatrixBufferH264` + H264(h264::IQMatrixBufferH264), +} diff --git a/nihed-cros-libva/src/buffer/h264.rs b/nihed-cros-libva/src/buffer/h264.rs new file mode 100644 index 0000000..af60498 --- /dev/null +++ b/nihed-cros-libva/src/buffer/h264.rs @@ -0,0 +1,306 @@ +// Copyright 2023 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +//! Wrappers around H264 `VABuffer` types. + +use crate::bindings; + +/// Wrapper over the `VAPictureH264` FFI type. +pub struct PictureH264(bindings::VAPictureH264); + +impl PictureH264 { + /// Creates the wrapper + pub fn new( + picture_id: bindings::VASurfaceID, + frame_idx: u32, + flags: u32, + top_field_order_cnt: i32, + bottom_field_order_cnt: i32, + ) -> Self { + Self(bindings::VAPictureH264 { + picture_id, + frame_idx, + flags, + TopFieldOrderCnt: top_field_order_cnt, + BottomFieldOrderCnt: bottom_field_order_cnt, + va_reserved: Default::default(), + }) + } +} + +/// Wrapper over the `seq_fields` bindgen field in `VAPictureParameterBufferH264`. +pub struct H264SeqFields(bindings::_VAPictureParameterBufferH264__bindgen_ty_1); + +impl H264SeqFields { + /// Creates the bindgen field + #[allow(clippy::too_many_arguments)] + pub fn new( + chroma_format_idc: u32, + residual_colour_transform_flag: u32, + gaps_in_frame_num_value_allowed_flag: u32, + frame_mbs_only_flag: u32, + mb_adaptive_frame_field_flag: u32, + direct_8x8_inference_flag: u32, + min_luma_bi_pred_size8x8: u32, + log2_max_frame_num_minus4: u32, + pic_order_cnt_type: u32, + log2_max_pic_order_cnt_lsb_minus4: u32, + delta_pic_order_always_zero_flag: u32, + ) -> Self { + let _bitfield_1 = + bindings::_VAPictureParameterBufferH264__bindgen_ty_1__bindgen_ty_1::new_bitfield_1( + chroma_format_idc, + residual_colour_transform_flag, + gaps_in_frame_num_value_allowed_flag, + frame_mbs_only_flag, + mb_adaptive_frame_field_flag, + direct_8x8_inference_flag, + min_luma_bi_pred_size8x8, + log2_max_frame_num_minus4, + pic_order_cnt_type, + log2_max_pic_order_cnt_lsb_minus4, + delta_pic_order_always_zero_flag, + ); + + Self(bindings::_VAPictureParameterBufferH264__bindgen_ty_1 { + bits: bindings::_VAPictureParameterBufferH264__bindgen_ty_1__bindgen_ty_1 { + _bitfield_align_1: Default::default(), + _bitfield_1, + __bindgen_padding_0: Default::default(), + }, + }) + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&mut self) -> &bindings::_VAPictureParameterBufferH264__bindgen_ty_1 { + &self.0 + } +} + +/// Wrapper over the `pic_fields` bindgen field in `VAPictureParameterBufferH264`. +pub struct H264PicFields(bindings::_VAPictureParameterBufferH264__bindgen_ty_2); + +impl H264PicFields { + /// Creates the bindgen field + #[allow(clippy::too_many_arguments)] + pub fn new( + entropy_coding_mode_flag: u32, + weighted_pred_flag: u32, + weighted_bipred_idc: u32, + transform_8x8_mode_flag: u32, + field_pic_flag: u32, + constrained_intra_pred_flag: u32, + pic_order_present_flag: u32, + deblocking_filter_control_present_flag: u32, + redundant_pic_cnt_present_flag: u32, + reference_pic_flag: u32, + ) -> Self { + let _bitfield_1 = + bindings::_VAPictureParameterBufferH264__bindgen_ty_2__bindgen_ty_1::new_bitfield_1( + entropy_coding_mode_flag, + weighted_pred_flag, + weighted_bipred_idc, + transform_8x8_mode_flag, + field_pic_flag, + constrained_intra_pred_flag, + pic_order_present_flag, + deblocking_filter_control_present_flag, + redundant_pic_cnt_present_flag, + reference_pic_flag, + ); + + Self(bindings::_VAPictureParameterBufferH264__bindgen_ty_2 { + bits: bindings::_VAPictureParameterBufferH264__bindgen_ty_2__bindgen_ty_1 { + _bitfield_align_1: Default::default(), + _bitfield_1, + __bindgen_padding_0: Default::default(), + }, + }) + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&mut self) -> &bindings::_VAPictureParameterBufferH264__bindgen_ty_2 { + &self.0 + } +} + +/// A wrapper over `VAPictureParameterBufferH264` FFI type +pub struct PictureParameterBufferH264(Box); + +impl PictureParameterBufferH264 { + /// Creates the wrapper + #[allow(clippy::too_many_arguments)] + pub fn new( + curr_pic: PictureH264, + reference_frames: [PictureH264; 16], + picture_width_in_mbs_minus1: u16, + picture_height_in_mbs_minus1: u16, + bit_depth_luma_minus8: u8, + bit_depth_chroma_minus8: u8, + num_ref_frames: u8, + seq_fields: &H264SeqFields, + num_slice_groups_minus1: u8, + slice_group_map_type: u8, + slice_group_change_rate_minus1: u16, + pic_init_qp_minus26: i8, + pic_init_qs_minus26: i8, + chroma_qp_index_offset: i8, + second_chroma_qp_index_offset: i8, + pic_fields: &H264PicFields, + frame_num: u16, + ) -> Self { + let reference_frames = (0..16usize) + .map(|i| reference_frames[i].0) + .collect::>() + .try_into() + // try_into is guaranteed to work because the iterator and target array have the same + // size. + .unwrap(); + + let seq_fields = seq_fields.0; + let pic_fields = pic_fields.0; + + Self(Box::new(bindings::VAPictureParameterBufferH264 { + CurrPic: curr_pic.0, + ReferenceFrames: reference_frames, + picture_width_in_mbs_minus1, + picture_height_in_mbs_minus1, + bit_depth_luma_minus8, + bit_depth_chroma_minus8, + num_ref_frames, + seq_fields, + num_slice_groups_minus1, + slice_group_map_type, + slice_group_change_rate_minus1, + pic_init_qp_minus26, + pic_init_qs_minus26, + chroma_qp_index_offset, + second_chroma_qp_index_offset, + pic_fields, + frame_num, + va_reserved: Default::default(), + })) + } + + pub(crate) fn inner_mut(&mut self) -> &mut bindings::VAPictureParameterBufferH264 { + self.0.as_mut() + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&self) -> &bindings::VAPictureParameterBufferH264 { + self.0.as_ref() + } +} + +/// Wrapper over the `VASliceParameterBufferH264` FFI type. +pub struct SliceParameterBufferH264(Box); + +impl SliceParameterBufferH264 { + /// Creates the wrapper + #[allow(clippy::too_many_arguments)] + pub fn new( + slice_data_size: u32, + slice_data_offset: u32, + slice_data_flag: u32, + slice_data_bit_offset: u16, + first_mb_in_slice: u16, + slice_type: u8, + direct_spatial_mv_pred_flag: u8, + num_ref_idx_l0_active_minus1: u8, + num_ref_idx_l1_active_minus1: u8, + cabac_init_idc: u8, + slice_qp_delta: i8, + disable_deblocking_filter_idc: u8, + slice_alpha_c0_offset_div2: i8, + slice_beta_offset_div2: i8, + ref_pic_list_0: [PictureH264; 32usize], + ref_pic_list_1: [PictureH264; 32usize], + luma_log2_weight_denom: u8, + chroma_log2_weight_denom: u8, + luma_weight_l0_flag: u8, + luma_weight_l0: [i16; 32usize], + luma_offset_l0: [i16; 32usize], + chroma_weight_l0_flag: u8, + chroma_weight_l0: [[i16; 2usize]; 32usize], + chroma_offset_l0: [[i16; 2usize]; 32usize], + luma_weight_l1_flag: u8, + luma_weight_l1: [i16; 32usize], + luma_offset_l1: [i16; 32usize], + chroma_weight_l1_flag: u8, + chroma_weight_l1: [[i16; 2usize]; 32usize], + chroma_offset_l1: [[i16; 2usize]; 32usize], + ) -> Self { + let ref_pic_list_0 = ref_pic_list_0.map(|pic| pic.0); + let ref_pic_list_1 = ref_pic_list_1.map(|pic| pic.0); + + Self(Box::new(bindings::VASliceParameterBufferH264 { + slice_data_size, + slice_data_offset, + slice_data_flag, + slice_data_bit_offset, + first_mb_in_slice, + slice_type, + direct_spatial_mv_pred_flag, + num_ref_idx_l0_active_minus1, + num_ref_idx_l1_active_minus1, + cabac_init_idc, + slice_qp_delta, + disable_deblocking_filter_idc, + slice_alpha_c0_offset_div2, + slice_beta_offset_div2, + RefPicList0: ref_pic_list_0, + RefPicList1: ref_pic_list_1, + luma_log2_weight_denom, + chroma_log2_weight_denom, + luma_weight_l0_flag, + luma_weight_l0, + luma_offset_l0, + chroma_weight_l0_flag, + chroma_weight_l0, + chroma_offset_l0, + luma_weight_l1_flag, + luma_weight_l1, + luma_offset_l1, + chroma_weight_l1_flag, + chroma_weight_l1, + chroma_offset_l1, + va_reserved: Default::default(), + })) + } + + pub(crate) fn inner_mut(&mut self) -> &mut bindings::VASliceParameterBufferH264 { + self.0.as_mut() + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&self) -> &bindings::VASliceParameterBufferH264 { + self.0.as_ref() + } +} + +/// Wrapper over the `VAIQMatrixBufferH264` FFI type +pub struct IQMatrixBufferH264(Box); + +impl IQMatrixBufferH264 { + /// Creates the wrapper. + pub fn new( + scaling_list4x4: [[u8; 16usize]; 6usize], + scaling_list8x8: [[u8; 64usize]; 2usize], + ) -> Self { + Self(Box::new(bindings::VAIQMatrixBufferH264 { + ScalingList4x4: scaling_list4x4, + ScalingList8x8: scaling_list8x8, + va_reserved: Default::default(), + })) + } + + pub(crate) fn inner_mut(&mut self) -> &mut bindings::VAIQMatrixBufferH264 { + self.0.as_mut() + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&self) -> &bindings::VAIQMatrixBufferH264 { + self.0.as_ref() + } +} diff --git a/nihed-cros-libva/src/buffer/mpeg2.rs b/nihed-cros-libva/src/buffer/mpeg2.rs new file mode 100644 index 0000000..22df314 --- /dev/null +++ b/nihed-cros-libva/src/buffer/mpeg2.rs @@ -0,0 +1,172 @@ +// Copyright 2023 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +//! Wrappers around MPEG2 `VABuffer` types. + +use crate::bindings; + +/// Wrapper over the `picture_coding_extension` bindgen field in `VAPictureParameterBufferMPEG2`. +pub struct MPEG2PictureCodingExtension(bindings::_VAPictureParameterBufferMPEG2__bindgen_ty_1); + +impl MPEG2PictureCodingExtension { + /// Creates the bindgen field. + #[allow(clippy::too_many_arguments)] + pub fn new( + intra_dc_precision: u32, + picture_structure: u32, + top_field_first: u32, + frame_pred_frame_dct: u32, + concealment_motion_vectors: u32, + q_scale_type: u32, + intra_vlc_format: u32, + alternate_scan: u32, + repeat_first_field: u32, + progressive_frame: u32, + is_first_field: u32, + ) -> Self { + let _bitfield_1 = + bindings::_VAPictureParameterBufferMPEG2__bindgen_ty_1__bindgen_ty_1::new_bitfield_1( + intra_dc_precision, + picture_structure, + top_field_first, + frame_pred_frame_dct, + concealment_motion_vectors, + q_scale_type, + intra_vlc_format, + alternate_scan, + repeat_first_field, + progressive_frame, + is_first_field, + ); + + Self(bindings::_VAPictureParameterBufferMPEG2__bindgen_ty_1 { + bits: bindings::_VAPictureParameterBufferMPEG2__bindgen_ty_1__bindgen_ty_1 { + _bitfield_align_1: Default::default(), + _bitfield_1, + __bindgen_padding_0: Default::default(), + }, + }) + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&mut self) -> &bindings::_VAPictureParameterBufferMPEG2__bindgen_ty_1 { + &self.0 + } +} + +/// Wrapper over the `PictureParameterBufferMPEG2` FFI type. +pub struct PictureParameterBufferMPEG2(Box); + +impl PictureParameterBufferMPEG2 { + /// Creates the wrapper. + pub fn new( + horizontal_size: u16, + vertical_size: u16, + forward_reference_picture: bindings::VASurfaceID, + backward_reference_picture: bindings::VASurfaceID, + picture_coding_type: i32, + f_code: i32, + picture_coding_extension: &MPEG2PictureCodingExtension, + ) -> Self { + let picture_coding_extension = picture_coding_extension.0; + + Self(Box::new(bindings::VAPictureParameterBufferMPEG2 { + horizontal_size, + vertical_size, + forward_reference_picture, + backward_reference_picture, + picture_coding_type, + f_code, + picture_coding_extension, + va_reserved: Default::default(), + })) + } + + pub(crate) fn inner_mut(&mut self) -> &mut bindings::VAPictureParameterBufferMPEG2 { + self.0.as_mut() + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&mut self) -> &bindings::VAPictureParameterBufferMPEG2 { + self.0.as_ref() + } +} + +/// Wrapper over the `VASliceParameterBufferMPEG2` FFI type. +pub struct SliceParameterBufferMPEG2(Box); + +impl SliceParameterBufferMPEG2 { + /// Creates the wrapper. + #[allow(clippy::too_many_arguments)] + pub fn new( + slice_data_size: u32, + slice_data_offset: u32, + slice_data_flag: u32, + macroblock_offset: u32, + slice_horizontal_position: u32, + slice_vertical_position: u32, + quantiser_scale_code: i32, + intra_slice_flag: i32, + ) -> Self { + Self(Box::new(bindings::VASliceParameterBufferMPEG2 { + slice_data_size, + slice_data_offset, + slice_data_flag, + macroblock_offset, + slice_horizontal_position, + slice_vertical_position, + quantiser_scale_code, + intra_slice_flag, + va_reserved: Default::default(), + })) + } + + pub(crate) fn inner_mut(&mut self) -> &mut bindings::VASliceParameterBufferMPEG2 { + self.0.as_mut() + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&self) -> &bindings::VASliceParameterBufferMPEG2 { + self.0.as_ref() + } +} + +/// Wrapper over the `VAIQMatrixBufferMPEG2` FFI type. +pub struct IQMatrixBufferMPEG2(Box); + +impl IQMatrixBufferMPEG2 { + /// Creates the wrapper. + #[allow(clippy::too_many_arguments)] + pub fn new( + load_intra_quantiser_matrix: i32, + load_non_intra_quantiser_matrix: i32, + load_chroma_intra_quantiser_matrix: i32, + load_chroma_non_intra_quantiser_matrix: i32, + intra_quantiser_matrix: [u8; 64usize], + non_intra_quantiser_matrix: [u8; 64usize], + chroma_intra_quantiser_matrix: [u8; 64usize], + chroma_non_intra_quantiser_matrix: [u8; 64usize], + ) -> Self { + Self(Box::new(bindings::VAIQMatrixBufferMPEG2 { + load_intra_quantiser_matrix, + load_non_intra_quantiser_matrix, + load_chroma_intra_quantiser_matrix, + load_chroma_non_intra_quantiser_matrix, + intra_quantiser_matrix, + non_intra_quantiser_matrix, + chroma_intra_quantiser_matrix, + chroma_non_intra_quantiser_matrix, + va_reserved: Default::default(), + })) + } + + pub(crate) fn inner_mut(&mut self) -> &mut bindings::VAIQMatrixBufferMPEG2 { + self.0.as_mut() + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&self) -> &bindings::VAIQMatrixBufferMPEG2 { + self.0.as_ref() + } +} diff --git a/nihed-cros-libva/src/buffer/vp8.rs b/nihed-cros-libva/src/buffer/vp8.rs new file mode 100644 index 0000000..2ab19de --- /dev/null +++ b/nihed-cros-libva/src/buffer/vp8.rs @@ -0,0 +1,215 @@ +// Copyright 2023 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +//! Wrappers around VP8 `VABuffer` types. + +use crate::bindings; + +/// Wrapper over the `pic_fields` bindgen field in `VAPictureParameterBufferVP8`. +pub struct VP8PicFields(bindings::_VAPictureParameterBufferVP8__bindgen_ty_1); + +impl VP8PicFields { + /// Creates the bindgen field + #[allow(clippy::too_many_arguments)] + pub fn new( + key_frame: u32, + version: u32, + segmentation_enabled: u32, + update_mb_segmentation_map: u32, + update_segment_feature_data: u32, + filter_type: u32, + sharpness_level: u32, + loop_filter_adj_enable: u32, + mode_ref_lf_delta_update: u32, + sign_bias_golden: u32, + sign_bias_alternate: u32, + mb_no_coeff_skip: u32, + loop_filter_disable: u32, + ) -> Self { + let _bitfield_1 = + bindings::_VAPictureParameterBufferVP8__bindgen_ty_1__bindgen_ty_1::new_bitfield_1( + key_frame, + version, + segmentation_enabled, + update_mb_segmentation_map, + update_segment_feature_data, + filter_type, + sharpness_level, + loop_filter_adj_enable, + mode_ref_lf_delta_update, + sign_bias_golden, + sign_bias_alternate, + mb_no_coeff_skip, + loop_filter_disable, + ); + + Self(bindings::_VAPictureParameterBufferVP8__bindgen_ty_1 { + bits: bindings::_VAPictureParameterBufferVP8__bindgen_ty_1__bindgen_ty_1 { + _bitfield_align_1: Default::default(), + _bitfield_1, + __bindgen_padding_0: Default::default(), + }, + }) + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&self) -> &bindings::_VAPictureParameterBufferVP8__bindgen_ty_1 { + &self.0 + } +} + +/// Wrapper over the `VABoolCoderContextVPX` FFI type. +pub struct BoolCoderContextVPX(bindings::VABoolCoderContextVPX); + +impl BoolCoderContextVPX { + /// Creates the wrapper + pub fn new(range: u8, value: u8, count: u8) -> Self { + Self(bindings::VABoolCoderContextVPX { + range, + value, + count, + }) + } +} + +/// Wrapper over the `PictureParameterBufferVP8` FFI type. +pub struct PictureParameterBufferVP8(Box); + +impl PictureParameterBufferVP8 { + /// Creates the wrapper + #[allow(clippy::too_many_arguments)] + pub fn new( + frame_width: u32, + frame_height: u32, + last_ref_frame: bindings::VASurfaceID, + golden_ref_frame: bindings::VASurfaceID, + alt_ref_frame: bindings::VASurfaceID, + pic_fields: &VP8PicFields, + mb_segment_tree_probs: [u8; 3usize], + loop_filter_level: [u8; 4usize], + loop_filter_deltas_ref_frame: [i8; 4usize], + loop_filter_deltas_mode: [i8; 4usize], + prob_skip_false: u8, + prob_intra: u8, + prob_last: u8, + prob_gf: u8, + y_mode_probs: [u8; 4usize], + uv_mode_probs: [u8; 3usize], + mv_probs: [[u8; 19usize]; 2usize], + bool_coder_ctx: &BoolCoderContextVPX, + ) -> Self { + let pic_fields = pic_fields.0; + let bool_coder_ctx = bool_coder_ctx.0; + + Self(Box::new(bindings::VAPictureParameterBufferVP8 { + frame_width, + frame_height, + last_ref_frame, + golden_ref_frame, + alt_ref_frame, + out_of_loop_frame: bindings::constants::VA_INVALID_SURFACE, + pic_fields, + mb_segment_tree_probs, + loop_filter_level, + loop_filter_deltas_ref_frame, + loop_filter_deltas_mode, + prob_skip_false, + prob_intra, + prob_last, + prob_gf, + y_mode_probs, + uv_mode_probs, + mv_probs, + bool_coder_ctx, + va_reserved: Default::default(), + })) + } + + pub(crate) fn inner_mut(&mut self) -> &mut bindings::VAPictureParameterBufferVP8 { + self.0.as_mut() + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&self) -> &bindings::VAPictureParameterBufferVP8 { + self.0.as_ref() + } +} + +/// Wrapper over the `VASliceParameterBufferVP8` FFI type. +pub struct SliceParameterBufferVP8(Box); + +impl SliceParameterBufferVP8 { + /// Creates the wrapper. + pub fn new( + slice_data_size: u32, + slice_data_offset: u32, + slice_data_flag: u32, + macroblock_offset: u32, + num_of_partitions: u8, + partition_size: [u32; 9usize], + ) -> Self { + Self(Box::new(bindings::VASliceParameterBufferVP8 { + slice_data_size, + slice_data_offset, + slice_data_flag, + macroblock_offset, + num_of_partitions, + partition_size, + va_reserved: Default::default(), + })) + } + + pub(crate) fn inner_mut(&mut self) -> &mut bindings::VASliceParameterBufferVP8 { + self.0.as_mut() + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&self) -> &bindings::VASliceParameterBufferVP8 { + self.0.as_ref() + } +} + +/// Wrapper over the `VAIQMatrixBufferVP8` FFI type. +pub struct IQMatrixBufferVP8(Box); + +impl IQMatrixBufferVP8 { + /// Creates the wrapper. + pub fn new(quantization_index: [[u16; 6usize]; 4usize]) -> Self { + Self(Box::new(bindings::VAIQMatrixBufferVP8 { + quantization_index, + va_reserved: Default::default(), + })) + } + + pub(crate) fn inner_mut(&mut self) -> &mut bindings::VAIQMatrixBufferVP8 { + self.0.as_mut() + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&self) -> &bindings::VAIQMatrixBufferVP8 { + self.0.as_ref() + } +} + +/// Wrapper over the VAProbabilityDataBufferVP8 FFI type. +pub struct ProbabilityDataBufferVP8(Box); + +impl ProbabilityDataBufferVP8 { + /// Creates the wrapper. + pub fn new(dct_coeff_probs: [[[[u8; 11usize]; 3usize]; 8usize]; 4usize]) -> Self { + Self(Box::new(bindings::VAProbabilityDataBufferVP8 { + dct_coeff_probs, + va_reserved: Default::default(), + })) + } + + pub(crate) fn inner_mut(&mut self) -> &mut bindings::VAProbabilityDataBufferVP8 { + self.0.as_mut() + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&self) -> &bindings::VAProbabilityDataBufferVP8 { + self.0.as_ref() + } +} diff --git a/nihed-cros-libva/src/buffer/vp9.rs b/nihed-cros-libva/src/buffer/vp9.rs new file mode 100644 index 0000000..c100c9b --- /dev/null +++ b/nihed-cros-libva/src/buffer/vp9.rs @@ -0,0 +1,221 @@ +// Copyright 2023 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +//! Wrappers around VP9 `VABuffer` types. + +use crate::bindings; + +/// Wrapper over the `pic_fields` bindgen field in `VAPictureParameterBufferVP9`. +pub struct VP9PicFields(bindings::_VADecPictureParameterBufferVP9__bindgen_ty_1); + +impl VP9PicFields { + /// Creates the bindgen field + #[allow(clippy::too_many_arguments)] + pub fn new( + subsampling_x: u32, + subsampling_y: u32, + frame_type: u32, + show_frame: u32, + error_resilient_mode: u32, + intra_only: u32, + allow_high_precision_mv: u32, + mcomp_filter_type: u32, + frame_parallel_decoding_mode: u32, + reset_frame_context: u32, + refresh_frame_context: u32, + frame_context_idx: u32, + segmentation_enabled: u32, + segmentation_temporal_update: u32, + segmentation_update_map: u32, + last_ref_frame: u32, + last_ref_frame_sign_bias: u32, + golden_ref_frame: u32, + golden_ref_frame_sign_bias: u32, + alt_ref_frame: u32, + alt_ref_frame_sign_bias: u32, + lossless_flag: u32, + ) -> Self { + let _bitfield_1 = + bindings::_VADecPictureParameterBufferVP9__bindgen_ty_1__bindgen_ty_1::new_bitfield_1( + subsampling_x, + subsampling_y, + frame_type, + show_frame, + error_resilient_mode, + intra_only, + allow_high_precision_mv, + mcomp_filter_type, + frame_parallel_decoding_mode, + reset_frame_context, + refresh_frame_context, + frame_context_idx, + segmentation_enabled, + segmentation_temporal_update, + segmentation_update_map, + last_ref_frame, + last_ref_frame_sign_bias, + golden_ref_frame, + golden_ref_frame_sign_bias, + alt_ref_frame, + alt_ref_frame_sign_bias, + lossless_flag, + ); + + Self(bindings::_VADecPictureParameterBufferVP9__bindgen_ty_1 { + bits: bindings::_VADecPictureParameterBufferVP9__bindgen_ty_1__bindgen_ty_1 { + _bitfield_align_1: Default::default(), + _bitfield_1, + }, + }) + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&mut self) -> &bindings::_VADecPictureParameterBufferVP9__bindgen_ty_1 { + &self.0 + } +} + +/// Wrapper over the `PictureParameterBufferVP9` FFI type. +pub struct PictureParameterBufferVP9(Box); + +impl PictureParameterBufferVP9 { + /// Creates the wrapper + #[allow(clippy::too_many_arguments)] + pub fn new( + frame_width: u16, + frame_height: u16, + reference_frames: [bindings::VASurfaceID; 8], + pic_fields: &VP9PicFields, + filter_level: u8, + sharpness_level: u8, + log2_tile_rows: u8, + log2_tile_columns: u8, + frame_header_length_in_bytes: u8, + first_partition_size: u16, + mb_segment_tree_probs: [u8; 7usize], + segment_pred_probs: [u8; 3usize], + profile: u8, + bit_depth: u8, + ) -> Self { + let pic_fields = pic_fields.0; + + Self(Box::new(bindings::VADecPictureParameterBufferVP9 { + frame_width, + frame_height, + reference_frames, + pic_fields, + filter_level, + sharpness_level, + log2_tile_rows, + log2_tile_columns, + frame_header_length_in_bytes, + first_partition_size, + mb_segment_tree_probs, + segment_pred_probs, + profile, + bit_depth, + va_reserved: Default::default(), + })) + } + + pub(crate) fn inner_mut(&mut self) -> &mut bindings::VADecPictureParameterBufferVP9 { + self.0.as_mut() + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&self) -> &bindings::VADecPictureParameterBufferVP9 { + self.0.as_ref() + } +} + +/// Wrapper over the `segment_flags` bindgen field in `VASegmentParameterVP9`. +pub struct VP9SegmentFlags(bindings::_VASegmentParameterVP9__bindgen_ty_1); + +impl VP9SegmentFlags { + /// Creates the wrapper. + pub fn new( + segment_reference_enabled: u16, + segment_reference: u16, + segment_reference_skipped: u16, + ) -> Self { + let _bitfield_1 = + bindings::_VASegmentParameterVP9__bindgen_ty_1__bindgen_ty_1::new_bitfield_1( + segment_reference_enabled, + segment_reference, + segment_reference_skipped, + ); + + Self(bindings::_VASegmentParameterVP9__bindgen_ty_1 { + fields: bindings::_VASegmentParameterVP9__bindgen_ty_1__bindgen_ty_1 { + _bitfield_align_1: Default::default(), + _bitfield_1, + __bindgen_padding_0: Default::default(), + }, + }) + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&mut self) -> &bindings::_VASegmentParameterVP9__bindgen_ty_1 { + &self.0 + } +} + +/// Wrapper over the `VASegmentParameterVP9` FFI type. +pub struct SegmentParameterVP9(bindings::VASegmentParameterVP9); + +impl SegmentParameterVP9 { + /// Creates the wrapper. + pub fn new( + segment_flags: &VP9SegmentFlags, + filter_level: [[u8; 2usize]; 4usize], + luma_ac_quant_scale: i16, + luma_dc_quant_scale: i16, + chroma_ac_quant_scale: i16, + chroma_dc_quant_scale: i16, + ) -> Self { + let segment_flags = segment_flags.0; + + Self(bindings::VASegmentParameterVP9 { + segment_flags, + filter_level, + luma_ac_quant_scale, + luma_dc_quant_scale, + chroma_ac_quant_scale, + chroma_dc_quant_scale, + va_reserved: Default::default(), + }) + } +} + +/// Wrapper over the `VASliceParameterBufferVP9` FFI type. +pub struct SliceParameterBufferVP9(Box); + +impl SliceParameterBufferVP9 { + /// Creates the wrapper. + pub fn new( + slice_data_size: u32, + slice_data_offset: u32, + slice_data_flag: u32, + seg_param: [SegmentParameterVP9; 8usize], + ) -> Self { + let seg_param = seg_param.map(|param| param.0); + + Self(Box::new(bindings::VASliceParameterBufferVP9 { + slice_data_size, + slice_data_offset, + slice_data_flag, + seg_param, + va_reserved: Default::default(), + })) + } + + pub(crate) fn inner_mut(&mut self) -> &mut bindings::VASliceParameterBufferVP9 { + self.0.as_mut() + } + + /// Returns the inner FFI type. Useful for testing purposes. + pub fn inner(&self) -> &bindings::VASliceParameterBufferVP9 { + self.0.as_ref() + } +} diff --git a/nihed-cros-libva/src/config.rs b/nihed-cros-libva/src/config.rs new file mode 100644 index 0000000..f073150 --- /dev/null +++ b/nihed-cros-libva/src/config.rs @@ -0,0 +1,127 @@ +// Copyright 2022 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +use std::rc::Rc; + +use anyhow::Result; +use log::error; + +use crate::bindings; +use crate::display::Display; +use crate::generic_value::GenericValue; +use crate::status::Status; + +/// A configuration for a given [`Display`]. +pub struct Config { + display: Rc, + id: bindings::VAConfigID, +} + +impl Config { + /// Creates a Config by wrapping around the `vaCreateConfig` call. This is just a helper for + /// [`Display::create_config`]. + pub(crate) fn new( + display: Rc, + mut attrs: Vec, + profile: bindings::VAProfile::Type, + entrypoint: bindings::VAEntrypoint::Type, + ) -> Result { + let mut config_id = 0u32; + + // Safe because `self` represents a valid `VADisplay`. + // + // The `attrs` vector is also properly initialized and its actual size is passed to + // `vaCreateConfig`, so it is impossible to write past the end of its storage by mistake. + Status(unsafe { + bindings::vaCreateConfig( + display.handle(), + profile, + entrypoint, + attrs.as_mut_ptr(), + attrs.len() as i32, + &mut config_id, + ) + }) + .check()?; + + Ok(Self { + display, + id: config_id, + }) + } + + /// Returns the ID of this config. + pub(crate) fn id(&self) -> bindings::VAConfigID { + self.id + } + + // Queries surface attributes for this config. + // + // This function queries for all supported attributes for this configuration. In particular, if + // the underlying hardware supports the creation of VA surfaces in various formats, then this + // function will enumerate all pixel formats that are supported. + fn query_surface_attributes(&mut self) -> Result> { + // Safe because `self` represents a valid VAConfig. We first query how + // much space is needed by the C API by passing in NULL in the first + // call to `vaQuerySurfaceAttributes`. + let attrs_len: std::os::raw::c_uint = 0; + Status(unsafe { + bindings::vaQuerySurfaceAttributes( + self.display.handle(), + self.id, + std::ptr::null_mut(), + &attrs_len as *const _ as *mut std::os::raw::c_uint, + ) + }) + .check()?; + + let mut attrs = Vec::with_capacity(attrs_len as usize); + // Safe because we allocate a vector with the required capacity as + // returned by the initial call to vaQuerySurfaceAttributes. We then + // pass a valid pointer to it. + Status(unsafe { + bindings::vaQuerySurfaceAttributes( + self.display.handle(), + self.id, + attrs.as_mut_ptr(), + &attrs_len as *const _ as *mut std::os::raw::c_uint, + ) + }) + .check()?; + + // Safe because vaQuerySurfaceAttributes will have written to + // exactly attrs_len entries in the vector. + unsafe { + attrs.set_len(attrs_len as usize); + } + + Ok(attrs) + } + + /// Query the surface attributes of type `attr_type`. The attribute may or may not be defined by + /// the driver. + pub fn query_surface_attributes_by_type( + &mut self, + attr_type: bindings::VASurfaceAttribType::Type, + ) -> Result> { + let surface_attributes = self.query_surface_attributes()?; + + surface_attributes + .into_iter() + .filter(|attr| attr.type_ == attr_type) + .map(|attrib| GenericValue::try_from(attrib.value)) + .collect() + } +} + +impl Drop for Config { + fn drop(&mut self) { + // Safe because `self` represents a valid Config. + let status = + Status(unsafe { bindings::vaDestroyConfig(self.display.handle(), self.id) }).check(); + if status.is_err() { + error!("vaDestroyConfig failed: {}", status.unwrap_err()); + } + } +} diff --git a/nihed-cros-libva/src/context.rs b/nihed-cros-libva/src/context.rs new file mode 100644 index 0000000..45a5c45 --- /dev/null +++ b/nihed-cros-libva/src/context.rs @@ -0,0 +1,95 @@ +// Copyright 2022 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +use std::rc::Rc; + +use anyhow::Result; +use log::error; + +use crate::bindings; +use crate::buffer::Buffer; +use crate::buffer::BufferType; +use crate::display::Display; +use crate::status::Status; +use crate::Config; +use crate::Surface; + +/// A VA context for a particular [`Display`]. +pub struct Context { + display: Rc, + id: bindings::VAContextID, +} + +impl Context { + /// Creates a Context by wrapping around a `vaCreateContext` call. This is just a helper for + /// [`Display::create_context`]. + pub(crate) fn new( + display: Rc, + config: &Config, + coded_width: i32, + coded_height: i32, + surfaces: Option<&Vec>, + progressive: bool, + ) -> Result> { + let mut context_id = 0; + let flags = if progressive { + bindings::constants::VA_PROGRESSIVE as i32 + } else { + 0 + }; + + let mut render_targets = match surfaces { + Some(surfaces) => Surface::as_id_vec(surfaces), + None => Default::default(), + }; + + // Safe because `self` represents a valid VADisplay and render_targets + // and ntargets are properly initialized. Note that render_targets==NULL + // is valid so long as ntargets==0. + Status(unsafe { + bindings::vaCreateContext( + display.handle(), + config.id(), + coded_width, + coded_height, + flags, + render_targets.as_mut_ptr(), + render_targets.len() as i32, + &mut context_id, + ) + }) + .check()?; + + Ok(Rc::new(Self { + display, + id: context_id, + })) + } + + /// Returns a shared reference to the [`Display`] used by this context. + pub fn display(&self) -> &Rc { + &self.display + } + + /// Returns the ID of this context. + pub(crate) fn id(&self) -> bindings::VAContextID { + self.id + } + + /// Create a new buffer of type `type_`. + pub fn create_buffer(self: &Rc, type_: BufferType) -> Result { + Buffer::new(Rc::clone(self), type_) + } +} + +impl Drop for Context { + fn drop(&mut self) { + // Safe because `self` represents a valid VAContext. + let status = + Status(unsafe { bindings::vaDestroyContext(self.display.handle(), self.id) }).check(); + if status.is_err() { + error!("vaDestroyContext failed: {}", status.unwrap_err()); + } + } +} diff --git a/nihed-cros-libva/src/display.rs b/nihed-cros-libva/src/display.rs new file mode 100644 index 0000000..462bc3e --- /dev/null +++ b/nihed-cros-libva/src/display.rs @@ -0,0 +1,344 @@ +// Copyright 2022 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +use std::ffi::CStr; +use std::fs::File; +use std::os::unix::io::AsRawFd; +use std::path::Path; +use std::path::PathBuf; +use std::rc::Rc; + +use anyhow::anyhow; +use anyhow::Context as AnyhowContext; +use anyhow::Result; + +use crate::bindings; +use crate::config::Config; +use crate::context::Context; +use crate::status::Status; +use crate::surface::Surface; +use crate::UsageHint; + +/// Iterates over existing DRM devices. +/// +/// DRM devices can be passed to [`Display::open_drm_display`] in order to create a `Display` on +/// that device. +pub struct DrmDeviceIterator { + cur_idx: usize, +} + +const DRM_NODE_DEFAULT_PREFIX: &str = "/dev/dri/renderD"; +const DRM_NUM_NODES: usize = 64; +const DRM_RENDER_NODE_START: usize = 128; + +impl Default for DrmDeviceIterator { + fn default() -> Self { + Self { + cur_idx: DRM_RENDER_NODE_START, + } + } +} + +impl Iterator for DrmDeviceIterator { + type Item = PathBuf; + + fn next(&mut self) -> Option { + match self.cur_idx { + idx if idx >= DRM_RENDER_NODE_START + DRM_NUM_NODES => None, + idx => { + let path = PathBuf::from(format!("{}{}", DRM_NODE_DEFAULT_PREFIX, idx)); + if !path.exists() { + None + } else { + self.cur_idx += 1; + Some(path) + } + } + } + } +} + +/// A VADisplay opened over DRM. +/// +/// A Display is the starting point to using libva. This struct is essentially a safe wrapper over +/// `VADisplay`, from which [`Surface`]s and [`Context`]s can be allocated in order to perform +/// actual work using [`Display::create_surfaces`] and [`Display::create_context`], respectively. +/// +/// Although libva offers several ways to create a display, this struct currently only supports +/// opening through DRM. It may be extended to support other display types (X11, Wayland) in the +/// future. +pub struct Display { + /// Handle to interact with the underlying `VADisplay`. + handle: bindings::VADisplay, + /// DRM file that must be kept open while the display is in use. + #[allow(dead_code)] + drm_file: File, +} + +impl Display { + /// Opens and initializes a specific DRM `Display`. + /// + /// `path` is the path to a DRM device that supports VAAPI, e.g. `/dev/dri/renderD128`. + pub fn open_drm_display>(path: P) -> Result> { + let file = std::fs::File::options() + .read(true) + .write(true) + .open(path.as_ref()) + .context(format!("failed to open {}", path.as_ref().display()))?; + + // Safe because fd represents a valid file descriptor and the pointer is checked for + // NULL afterwards. + let display = unsafe { bindings::vaGetDisplayDRM(file.as_raw_fd()) }; + if display.is_null() { + // The File will close the DRM fd on drop. + return Err(anyhow!( + "failed to obtain VA display from DRM device {}", + path.as_ref().display() + )); + } + + let mut major = 0i32; + let mut minor = 0i32; + // Safe because we ensure that the display is valid (i.e not NULL) before calling + // vaInitialize. The File will close the DRM fd on drop. + Status(unsafe { bindings::vaInitialize(display, &mut major, &mut minor) }).check()?; + + Ok(Rc::new(Self { + handle: display, + drm_file: file, + })) + } + + /// Opens the first device that succeeds and returns its `Display`. + /// + /// If an error occurs on a given device, it is ignored and the next one is tried until one + /// succeeds or we reach the end of the iterator. + pub fn open() -> Option> { + let devices = DrmDeviceIterator::default(); + + // Try all the DRM devices until one succeeds. + for device in devices { + if let Ok(display) = Self::open_drm_display(device) { + return Some(display); + } + } + + None + } + + /// Returns the handle of this display. + pub(crate) fn handle(&self) -> bindings::VADisplay { + self.handle + } + + /// Queries supported profiles by this display. + pub fn query_config_profiles(&self) -> Result> { + // Safe because `self` represents a valid VADisplay. + let mut max_num_profiles = unsafe { bindings::vaMaxNumProfiles(self.handle) }; + let mut profiles = Vec::with_capacity(max_num_profiles as usize); + + // Safe because `self` represents a valid `VADisplay` and the vector has `max_num_profiles` + // as capacity. + Status(unsafe { + bindings::vaQueryConfigProfiles( + self.handle, + profiles.as_mut_ptr(), + &mut max_num_profiles, + ) + }) + .check()?; + + // Safe because `profiles` is allocated with a `max_num_profiles` capacity and + // `vaQueryConfigProfiles` wrote the actual number of profiles to `max_num_entrypoints`. + unsafe { + profiles.set_len(max_num_profiles as usize); + }; + + Ok(profiles) + } + + /// Returns a string describing some aspects of the VA implemenation on the specific hardware + /// accelerator used by this display. + /// + /// The format of the returned string is vendor specific and at the discretion of the + /// implementer. e.g. for the Intel GMA500 implementation, an example would be: `Intel GMA500 - + /// 2.0.0.32L.0005`. + pub fn query_vendor_string(&self) -> std::result::Result { + // Safe because `self` represents a valid VADisplay. + let vendor_string = unsafe { bindings::vaQueryVendorString(self.handle) }; + + if vendor_string.is_null() { + return Err("vaQueryVendorString() returned NULL"); + } + + // Safe because we check the whether the vendor_String pointer is NULL + Ok(unsafe { CStr::from_ptr(vendor_string) } + .to_string_lossy() + .to_string()) + } + + /// Query supported entrypoints for a given profile. + pub fn query_config_entrypoints( + &self, + profile: bindings::VAProfile::Type, + ) -> Result> { + // Safe because `self` represents a valid VADisplay. + let mut max_num_entrypoints = unsafe { bindings::vaMaxNumEntrypoints(self.handle) }; + let mut entrypoints = Vec::with_capacity(max_num_entrypoints as usize); + + // Safe because `self` represents a valid VADisplay and the vector has `max_num_entrypoints` + // as capacity. + Status(unsafe { + bindings::vaQueryConfigEntrypoints( + self.handle, + profile, + entrypoints.as_mut_ptr(), + &mut max_num_entrypoints, + ) + }) + .check()?; + + // Safe because `entrypoints` is allocated with a `max_num_entrypoints` capacity, and + // `vaQueryConfigEntrypoints` wrote the actual number of entrypoints to + // `max_num_entrypoints` + unsafe { + entrypoints.set_len(max_num_entrypoints as usize); + } + + Ok(entrypoints) + } + + /// Writes attributes for a given `profile`/`entrypoint` pair into `attributes`. + /// + /// Entries of `attributes` must have their `type_` member initialized to the desired attribute + /// to retrieve. + pub fn get_config_attributes( + &self, + profile: bindings::VAProfile::Type, + entrypoint: bindings::VAEntrypoint::Type, + attributes: &mut [bindings::VAConfigAttrib], + ) -> Result<()> { + // Safe because `self` represents a valid VADisplay. The slice length is passed to the C + // function, so it is impossible to write past the end of the slice's storage by mistake. + Status(unsafe { + bindings::vaGetConfigAttributes( + self.handle, + profile, + entrypoint, + attributes.as_mut_ptr(), + attributes.len() as i32, + ) + }) + .check() + } + + /// Creates `Surface`s by wrapping around a `vaCreateSurfaces` call. + /// + /// # Arguments + /// + /// * `rt_format` - The desired surface format. See `VA_RT_FORMAT_*` + /// * `va_fourcc` - The desired pixel format (optional). See `VA_FOURCC_*` + /// * `width` - Width for the create surfaces + /// * `height` - Height for the created surfaces + /// * `usage_hint` - Optional hint of intended usage to optimize allocation (e.g. tiling) + /// * `num_surfaces` - Number of surfaces to create + pub fn create_surfaces( + self: &Rc, + rt_format: u32, + va_fourcc: Option, + width: u32, + height: u32, + usage_hint: Option, + num_surfaces: u32, + ) -> Result> { + Surface::new( + Rc::clone(self), + rt_format, + va_fourcc, + width, + height, + usage_hint, + num_surfaces, + ) + } + + /// Creates a `Context` by wrapping around a `vaCreateContext` call. + /// + /// # Arguments + /// + /// * `config` - The configuration for the context + /// * `coded_width` - The coded picture width + /// * `coded_height` - The coded picture height + /// * `surfaces` - Optional hint for the amount of surfaces tied to the context + /// * `progressive` - Whether only progressive frame pictures are present in the sequence + pub fn create_context( + self: &Rc, + config: &Config, + coded_width: i32, + coded_height: i32, + surfaces: Option<&Vec>, + progressive: bool, + ) -> Result> { + Context::new( + Rc::clone(self), + config, + coded_width, + coded_height, + surfaces, + progressive, + ) + } + + /// Creates a `Config` by wrapping around the `vaCreateConfig` call. + /// + /// `attrs` describe the attributes to set for this config. A list of the supported attributes + /// for a given profile/entrypoint pair can be retrieved using + /// [`Display::get_config_attributes`]. Other attributes will take their default values, and + /// `attrs` can be empty in order to obtain a default configuration. + pub fn create_config( + self: &Rc, + attrs: Vec, + profile: bindings::VAProfile::Type, + entrypoint: bindings::VAEntrypoint::Type, + ) -> Result { + Config::new(Rc::clone(self), attrs, profile, entrypoint) + } + + /// Returns available image formats for this display by wrapping around `vaQueryImageFormats`. + pub fn query_image_formats(&self) -> Result> { + // Safe because `self` represents a valid VADisplay. + let mut num_image_formats = unsafe { bindings::vaMaxNumImageFormats(self.handle) }; + let mut image_formats = Vec::with_capacity(num_image_formats as usize); + + // Safe because `self` represents a valid VADisplay. The `image_formats` vector is properly + // initialized and a valid size is passed to the C function, so it is impossible to write + // past the end of their storage by mistake. + Status(unsafe { + bindings::vaQueryImageFormats( + self.handle, + image_formats.as_mut_ptr(), + &mut num_image_formats, + ) + }) + .check()?; + + // Safe because the C function will have written exactly `num_image_format` entries, which + // is known to be within the vector's capacity. + unsafe { + image_formats.set_len(num_image_formats as usize); + } + + Ok(image_formats) + } +} + +impl Drop for Display { + fn drop(&mut self) { + // Safe because `self` represents a valid VADisplay. + unsafe { + bindings::vaTerminate(self.handle); + // The File will close the DRM fd on drop. + } + } +} diff --git a/nihed-cros-libva/src/generic_value.rs b/nihed-cros-libva/src/generic_value.rs new file mode 100644 index 0000000..3900edc --- /dev/null +++ b/nihed-cros-libva/src/generic_value.rs @@ -0,0 +1,48 @@ +// Copyright 2022 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +use anyhow::anyhow; +use anyhow::Result; + +use crate::bindings; + +/// A wrapper over `VAGenericValue` giving us safe access to the underlying union members. +#[derive(Debug)] +pub enum GenericValue { + /// A wrapper over VAGenericValueTypeInteger + Integer(i32), + /// A wrapper over VAGenericValueTypeFloat + Float(f32), + /// A wrapper over VAGenericValueTypePointer + Pointer(*mut std::os::raw::c_void), + /// A wrapper over VAGenericValueTypeFunc + Func(bindings::VAGenericFunc), +} + +impl TryFrom for GenericValue { + type Error = anyhow::Error; + + fn try_from(value: bindings::VAGenericValue) -> Result { + // Safe because we check the type before accessing the union. + match value.type_ { + // Safe because we check the type before accessing the union. + bindings::VAGenericValueType::VAGenericValueTypeInteger => { + Ok(Self::Integer(unsafe { value.value.i })) + } + bindings::VAGenericValueType::VAGenericValueTypeFloat => { + Ok(Self::Float(unsafe { value.value.f })) + } + bindings::VAGenericValueType::VAGenericValueTypePointer => { + Ok(Self::Pointer(unsafe { value.value.p })) + } + bindings::VAGenericValueType::VAGenericValueTypeFunc => { + Ok(Self::Func(unsafe { value.value.fn_ })) + } + other => Err(anyhow!( + "Conversion failed for unexpected VAGenericValueType: {}", + other + )), + } + } +} diff --git a/nihed-cros-libva/src/image.rs b/nihed-cros-libva/src/image.rs new file mode 100644 index 0000000..8044145 --- /dev/null +++ b/nihed-cros-libva/src/image.rs @@ -0,0 +1,212 @@ +// Copyright 2022 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +use anyhow::Result; + +use crate::bindings; +use crate::picture::Picture; +use crate::picture::PictureSync; +use crate::status::Status; + +/// Wrapper around `VAImage` that is tied to the lifetime of a given `Picture`. +/// +/// An image is used to either get the surface data to client memory, or to copy image data in +/// client memory to a surface. +pub struct Image<'a> { + /// The picture whose `Surface` we use as the source of pixel data. + picture: &'a Picture, + /// The `VAImage` returned by libva. + image: bindings::VAImage, + /// The mapped surface data. + data: &'a mut [u8], + /// Whether the image was derived using the `vaDeriveImage` API or created using the + /// `vaCreateImage` API. + derived: bool, + /// Tracks whether the underlying data has possibly been written to, i.e. an encoder will create + /// an image and map its buffer in order to write to it, so we must writeback later. + dirty: bool, +} + +impl<'a> Image<'a> { + /// Creates a new `Image` either by calling `vaCreateImage` or + /// `vaDeriveImage`. Creating an Image depends on acquiring a ready Surface + /// from an underlying Picture. Note that Image has a borrowed Picture, so + /// it will be dropped before the underlying Surface is dropped, as mandated + /// by VAAPI. + /// + /// # Arguments + /// + /// * `picture` - The [`Picture`] that owns the Surface this image will be created from. + /// * `format` - A `VAImageFormat` returned by [`crate::Display::query_image_formats`]. + /// * `width` - The image's desired width. + /// * `height` - The image's desired height. + /// * `derive` - Whether to try deriving the image from `picture`, which allows zero-copy access + /// to the surface data. Deriving may fail, in which case vaCreateImage will be used instead, + /// incurring an extra data copy. + pub fn new( + picture: &'a Picture, + mut format: bindings::VAImageFormat, + width: u32, + height: u32, + derive: bool, + ) -> Result { + // An all-zero byte-pattern is a valid initial value for `VAImage`. + let mut image: bindings::VAImage = Default::default(); + let mut addr = std::ptr::null_mut(); + let mut derived = false; + + if derive { + derived = Image::derive_image(picture, &mut image)?; + } + + if !derived { + Image::create_image(picture, &mut image, &mut format, width, height)?; + } + + // Safe since `picture.inner.context` represents a valid `VAContext` and `image` has been + // successfully created at this point. + match Status(unsafe { + bindings::vaMapBuffer(picture.display().handle(), image.buf, &mut addr) + }) + .check() + { + Ok(_) => { + // Safe since `addr` points to data mapped onto our address space since we called + // `vaMapBuffer` above, which also guarantees that the data is valid for + // `image.data_size`. + let data = + unsafe { std::slice::from_raw_parts_mut(addr as _, image.data_size as usize) }; + Ok(Self { + picture, + image, + data, + derived, + dirty: false, + }) + } + Err(e) => { + // Safe because `picture.inner.context` represents a valid `VAContext` and `image` + // represents a valid `VAImage`. + unsafe { + bindings::vaDestroyImage(picture.display().handle(), image.image_id); + } + Err(e) + } + } + } + + /// Creates `image` from `picture` using `vaCreateImage` and `vaGetImage` in order to copy the + /// surface data into the image buffer. + fn create_image( + picture: &'a Picture, + image: &mut bindings::VAImage, + format: &mut bindings::VAImageFormat, + width: u32, + height: u32, + ) -> Result<()> { + let dpy = picture.display().handle(); + + // Safe because `picture.inner.context` represents a valid + // VAContext. + Status(unsafe { bindings::vaCreateImage(dpy, format, width as i32, height as i32, image) }) + .check()?; + + // Safe because `picture.inner.context` represents a valid VAContext, + // `picture.surface` represents a valid VASurface and `image` represents + // a valid `VAImage`. + if let Err(e) = Status(unsafe { + bindings::vaGetImage( + dpy, + picture.surface().id(), + 0, + 0, + width, + height, + image.image_id, + ) + }) + .check() + { + // Safe since `image` represents a valid `VAImage`. + unsafe { + bindings::vaDestroyImage(dpy, image.image_id); + } + return Err(e); + } + + Ok(()) + } + + /// Tries to derive `image` from `picture` to access the raw surface data without copy. + /// + /// Returns `Ok(true)` if the image has been successfully derived, `Ok(false)` if deriving is + /// not possible and `create_image` should be used as a fallback, or an error if an error + /// occurred. + fn derive_image( + picture: &'a Picture, + image: &mut bindings::VAImage, + ) -> Result { + let status = Status(unsafe { + bindings::vaDeriveImage(picture.display().handle(), picture.surface().id(), image) + }); + + if status.0 == bindings::constants::VA_STATUS_ERROR_OPERATION_FAILED as i32 { + // The implementation can't derive, try the create API instead. + Ok(false) + } else { + status.check()?; + Ok(true) + } + } + + /// Get a reference to the underlying `VAImage` that describes this image. + pub fn image(&self) -> &bindings::VAImage { + &self.image + } +} + +impl<'a> AsRef<[u8]> for Image<'a> { + fn as_ref(&self) -> &[u8] { + self.data + } +} + +impl<'a> AsMut<[u8]> for Image<'a> { + fn as_mut(&mut self) -> &mut [u8] { + self.dirty = true; + self.data + } +} + +impl<'a> Drop for Image<'a> { + fn drop(&mut self) { + if !self.derived && self.dirty { + // Safe because `picture.inner.context` represents a valid `VAContext`, + // `picture.surface` represents a valid `VASurface` and `image` represents a valid + // `VAImage`. + unsafe { + bindings::vaPutImage( + self.picture.display().handle(), + self.picture.surface().id(), + self.image.image_id, + 0, + 0, + self.image.width as u32, + self.image.height as u32, + 0, + 0, + self.image.width as u32, + self.image.height as u32, + ); + } + } + unsafe { + // Safe since the buffer is mapped in `Image::new`, so `self.image.buf` points to a + // valid `VABufferID`. + bindings::vaUnmapBuffer(self.picture.display().handle(), self.image.buf); + // Safe since `self.image` represents a valid `VAImage`. + bindings::vaDestroyImage(self.picture.display().handle(), self.image.image_id); + } + } +} diff --git a/nihed-cros-libva/src/lib.rs b/nihed-cros-libva/src/lib.rs new file mode 100644 index 0000000..8747b2b --- /dev/null +++ b/nihed-cros-libva/src/lib.rs @@ -0,0 +1,233 @@ +// Copyright 2022 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +//! Implements a lightweight and safe interface over `libva`. +//! +//! The starting point to using this crate is to open a [`Display`], from which a [`Context`] and +//! [`Surface`]s can be allocated and used for doing actual work. + +#![deny(missing_docs)] + +mod bindings; +pub mod buffer; +mod config; +mod context; +mod display; +mod generic_value; +mod image; +mod picture; +mod status; +mod surface; +mod usage_hint; + +pub use bindings::constants; +pub use bindings::VAConfigAttrib; +pub use bindings::VAConfigAttribType; +pub use bindings::VAEntrypoint; +pub use bindings::VAImageFormat; +pub use bindings::VAProfile; +pub use bindings::VASurfaceAttribType; +pub use bindings::VASurfaceID; +pub use bindings::VASurfaceStatus; +pub use buffer::*; +pub use config::*; +pub use context::*; +pub use display::*; +pub use generic_value::*; +pub use image::*; +pub use picture::*; +pub use surface::*; +pub use usage_hint::*; + +#[cfg(test)] +mod tests { + use std::rc::Rc; + + use super::*; + + /// Returns a 32-bit CRC for the visible part of `image`, which must be in NV12 format. + fn crc_nv12_image(image: &Image) -> u32 { + let data = image.as_ref(); + let va_image = image.image(); + let offsets = &va_image.offsets; + let pitches = &va_image.pitches; + let width = va_image.width as usize; + let height = va_image.height as usize; + + // We only support NV12 images + assert_eq!(va_image.format.fourcc, u32::from_ne_bytes(*b"NV12")); + // Consistency check + assert_eq!(va_image.num_planes, 2); + + let mut hasher = crc32fast::Hasher::new(); + + let offset = offsets[0] as usize; + let pitch = pitches[0] as usize; + let y_plane = data[offset..(offset + pitch * height)] + .chunks(pitch) + .map(|line| &line[0..width]); + + let offset = offsets[1] as usize; + let pitch = pitches[1] as usize; + let uv_plane = data[offset..(offset + pitch * ((height + 1) / 2))] + .chunks(pitch) + .map(|line| &line[0..width]); + + for line in y_plane.chain(uv_plane) { + hasher.update(line); + } + + hasher.finalize() + } + + #[test] + // Ignore this test by default as it requires libva-compatible hardware. + #[ignore] + fn libva_utils_mpeg2vldemo() { + // Adapted from + let display = Display::open().unwrap(); + + assert!(!display.query_vendor_string().unwrap().is_empty()); + let profiles = display.query_config_profiles().unwrap(); + assert!(!profiles.is_empty()); + + let profile = bindings::VAProfile::VAProfileMPEG2Main; + let entrypoints = display.query_config_entrypoints(profile).unwrap(); + assert!(!entrypoints.is_empty()); + assert!(entrypoints + .iter() + .any(|e| *e == bindings::VAEntrypoint::VAEntrypointVLD)); + + let format = bindings::constants::VA_RT_FORMAT_YUV420; + let width = 16; + let height = 16; + + let mut attrs = vec![bindings::VAConfigAttrib { + type_: bindings::VAConfigAttribType::VAConfigAttribRTFormat, + value: 0, + }]; + + let entrypoint = bindings::VAEntrypoint::VAEntrypointVLD; + display + .get_config_attributes(profile, entrypoint, &mut attrs) + .unwrap(); + assert!(attrs[0].value != bindings::constants::VA_ATTRIB_NOT_SUPPORTED); + assert!(attrs[0].value & bindings::constants::VA_RT_FORMAT_YUV420 != 0); + + let config = display.create_config(attrs, profile, entrypoint).unwrap(); + + let mut surfaces = display + .create_surfaces( + format, + None, + width, + height, + Some(UsageHint::USAGE_HINT_DECODER), + 1, + ) + .unwrap(); + let context = display + .create_context( + &config, + width as i32, + (((height + 15) / 16) * 16) as i32, + Some(&surfaces), + true, + ) + .unwrap(); + + // The picture data is adapted from libva-utils at decode/mpeg2vldemo.cpp + // Data dump of a 16x16 MPEG2 video clip,it has one I frame + let mut mpeg2_clip: Vec = vec![ + 0x00, 0x00, 0x01, 0xb3, 0x01, 0x00, 0x10, 0x13, 0xff, 0xff, 0xe0, 0x18, 0x00, 0x00, + 0x01, 0xb5, 0x14, 0x8a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0xb8, 0x00, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0f, 0xff, 0xf8, 0x00, 0x00, 0x01, 0xb5, + 0x8f, 0xff, 0xf3, 0x41, 0x80, 0x00, 0x00, 0x01, 0x01, 0x13, 0xe1, 0x00, 0x15, 0x81, + 0x54, 0xe0, 0x2a, 0x05, 0x43, 0x00, 0x2d, 0x60, 0x18, 0x01, 0x4e, 0x82, 0xb9, 0x58, + 0xb1, 0x83, 0x49, 0xa4, 0xa0, 0x2e, 0x05, 0x80, 0x4b, 0x7a, 0x00, 0x01, 0x38, 0x20, + 0x80, 0xe8, 0x05, 0xff, 0x60, 0x18, 0xe0, 0x1d, 0x80, 0x98, 0x01, 0xf8, 0x06, 0x00, + 0x54, 0x02, 0xc0, 0x18, 0x14, 0x03, 0xb2, 0x92, 0x80, 0xc0, 0x18, 0x94, 0x42, 0x2c, + 0xb2, 0x11, 0x64, 0xa0, 0x12, 0x5e, 0x78, 0x03, 0x3c, 0x01, 0x80, 0x0e, 0x80, 0x18, + 0x80, 0x6b, 0xca, 0x4e, 0x01, 0x0f, 0xe4, 0x32, 0xc9, 0xbf, 0x01, 0x42, 0x69, 0x43, + 0x50, 0x4b, 0x01, 0xc9, 0x45, 0x80, 0x50, 0x01, 0x38, 0x65, 0xe8, 0x01, 0x03, 0xf3, + 0xc0, 0x76, 0x00, 0xe0, 0x03, 0x20, 0x28, 0x18, 0x01, 0xa9, 0x34, 0x04, 0xc5, 0xe0, + 0x0b, 0x0b, 0x04, 0x20, 0x06, 0xc0, 0x89, 0xff, 0x60, 0x12, 0x12, 0x8a, 0x2c, 0x34, + 0x11, 0xff, 0xf6, 0xe2, 0x40, 0xc0, 0x30, 0x1b, 0x7a, 0x01, 0xa9, 0x0d, 0x00, 0xac, + 0x64, + ]; + + let picture_coding_extension = + MPEG2PictureCodingExtension::new(0, 3, 0, 1, 0, 0, 0, 0, 0, 1, 1); + let pic_param = PictureParameterBufferMPEG2::new( + 16, + 16, + 0xffffffff, + 0xffffffff, + 1, + 0xffff, + &picture_coding_extension, + ); + + let pic_param = BufferType::PictureParameter(PictureParameter::MPEG2(pic_param)); + + let iq_matrix = IQMatrixBufferMPEG2::new( + 1, + 1, + 0, + 0, + [ + 8, 16, 16, 19, 16, 19, 22, 22, 22, 22, 22, 22, 26, 24, 26, 27, 27, 27, 26, 26, 26, + 26, 27, 27, 27, 29, 29, 29, 34, 34, 34, 29, 29, 29, 27, 27, 29, 29, 32, 32, 34, 34, + 37, 38, 37, 35, 35, 34, 35, 38, 38, 40, 40, 40, 48, 48, 46, 46, 56, 56, 58, 69, 69, + 83, + ], + [ + 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, + ], + [0; 64], + [0; 64], + ); + + let iq_matrix = BufferType::IQMatrix(IQMatrix::MPEG2(iq_matrix)); + + let slice_param = SliceParameterBufferMPEG2::new(150, 0, 0, 38, 0, 0, 2, 0); + + let slice_param = BufferType::SliceParameter(SliceParameter::MPEG2(slice_param)); + + let test_data_offset = 47; + let slice_data = BufferType::SliceData(mpeg2_clip.drain(test_data_offset..).collect()); + + let buffers = vec![ + context.create_buffer(pic_param).unwrap(), + context.create_buffer(slice_param).unwrap(), + context.create_buffer(iq_matrix).unwrap(), + context.create_buffer(slice_data).unwrap(), + ]; + + let mut picture = Picture::new(0, Rc::clone(&context), surfaces.remove(0)); + for buffer in buffers { + picture.add_buffer(buffer); + } + + // Actual client code can just chain the calls. + let picture = picture.begin().unwrap(); + let picture = picture.render().unwrap(); + let picture = picture.end().unwrap(); + let picture = picture.sync().map_err(|(e, _)| e).unwrap(); + + // Test whether we can map the resulting surface to obtain the raw yuv + // data + let image_fmts = display.query_image_formats().unwrap(); + let image_fmt = image_fmts + .into_iter() + .find(|f| f.fourcc == bindings::constants::VA_FOURCC_NV12) + .expect("No valid VAImageFormat found for NV12"); + + let image = Image::new(&picture, image_fmt, width, height, false).unwrap(); + + assert_eq!(crc_nv12_image(&image), 0xa5713e52); + } +} diff --git a/nihed-cros-libva/src/picture.rs b/nihed-cros-libva/src/picture.rs new file mode 100644 index 0000000..acb41b8 --- /dev/null +++ b/nihed-cros-libva/src/picture.rs @@ -0,0 +1,271 @@ +// Copyright 2022 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +use std::cell::Ref; +use std::cell::RefCell; +use std::cell::RefMut; +use std::marker::PhantomData; +use std::rc::Rc; + +use anyhow::anyhow; +use anyhow::Result; + +use crate::bindings; +use crate::buffer::Buffer; +use crate::context::Context; +use crate::display::Display; +use crate::status::Status; +use crate::surface::Surface; + +// Use the sealed trait pattern to make sure that new states are not created in caller code. More +// information about the sealed trait pattern can be found at +// +mod private { + pub trait Sealed {} +} + +/// A `Picture` will only have valid YUV data after a sequence of operations are performed in a +/// particular order. This order correspond to the following VA-API calls: `vaBeginPicture`, +/// `vaRenderPicture`, `vaEndPicture` and `vaSyncSurface`. This trait enforces this ordering by +/// implementing the Typestate pattern to constrain what operations are available in what particular +/// states. +/// +/// The states for the state machine are: +/// +/// * PictureNew -> PictureBegin +/// * PictureBegin -> PictureRender +/// * PictureRender ->PictureEnd +/// * PictureEnd -> PictureSync +/// +/// Where the surface can be reclaimed in both `PictureNew` and `PictureSync`, as either no +/// operation took place (as in `PictureNew`), or it is guaranteed that the operation has already +/// completed (as in `PictureSync`). +/// +/// More information about the Typestate pattern can be found at +/// +pub trait PictureState: private::Sealed {} + +/// Represents a `Picture` that has just been created. +pub enum PictureNew {} +impl PictureState for PictureNew {} +impl private::Sealed for PictureNew {} + +/// Represents a `Picture` after `vaBeginPicture` has been called. +pub enum PictureBegin {} +impl PictureState for PictureBegin {} +impl private::Sealed for PictureBegin {} + +/// Represents a `Picture` after `vaRenderPicture` has been called. +pub enum PictureRender {} +impl PictureState for PictureRender {} +impl private::Sealed for PictureRender {} + +/// Represents a `Picture` after `vaEndPicture` has been called. +pub enum PictureEnd {} +impl PictureState for PictureEnd {} +impl private::Sealed for PictureEnd {} + +/// Represents a `Picture` after `vaSyncSurface` has been called on the underlying surface. +pub enum PictureSync {} +impl PictureState for PictureSync {} +impl private::Sealed for PictureSync {} + +/// Represents a state where one can reclaim the underlying `Surface` for this `Picture`. This is +/// true when either no decoding has been initiated or, alternatively, when the decoding operation +/// has completed for the underlying `vaSurface` +pub trait PictureReclaimableSurface: PictureState + private::Sealed {} +impl PictureReclaimableSurface for PictureNew {} +impl PictureReclaimableSurface for PictureSync {} + +struct PictureInner { + /// Timestamp of the picture. + timestamp: u64, + /// A context associated with this picture. + context: Rc, + /// Contains the buffers used to decode the data. + buffers: Vec, + /// Contains the actual decoded data. Note that the surface may be shared in + /// interlaced decoding. + surface: Rc>, +} + +/// A `Surface` that is being rendered into. +/// +/// This struct abstracts the decoding flow using `vaBeginPicture`, `vaRenderPicture`, +/// `vaEndPicture` and `vaSyncSurface` in a type-safe way. +/// +/// The surface will have valid picture data after all the stages of decoding are called. +pub struct Picture { + inner: Box, + phantom: std::marker::PhantomData, +} + +impl Picture { + /// Creates a new Picture with a given `timestamp`. `surface` is the underlying surface that + /// libva will render to. + pub fn new(timestamp: u64, context: Rc, surface: Surface) -> Self { + Self { + inner: Box::new(PictureInner { + timestamp, + context, + buffers: Default::default(), + surface: Rc::new(RefCell::new(surface)), + }), + + phantom: PhantomData, + } + } + + /// Creates a new Picture with a given `frame_number` to identify it, + /// reusing the Surface from `picture`. This is useful for interlaced + /// decoding as one can render both fields to the same underlying surface. + pub fn new_from_same_surface( + timestamp: u64, + picture: &Picture, + ) -> Picture { + let context = Rc::clone(&picture.inner.context); + Picture { + inner: Box::new(PictureInner { + timestamp, + context, + buffers: Default::default(), + surface: Rc::clone(&picture.inner.surface), + }), + + phantom: PhantomData, + } + } + + /// Add `buffer` to the picture. + pub fn add_buffer(&mut self, buffer: Buffer) { + self.inner.buffers.push(buffer); + } + + /// Wrapper around `vaBeginPicture`. + pub fn begin(self) -> Result> { + // Safe because `self.inner.context` represents a valid VAContext and + // `self.inner.surface` represents a valid VASurface. + Status(unsafe { + bindings::vaBeginPicture( + self.inner.context.display().handle(), + self.inner.context.id(), + self.inner.surface.borrow().id(), + ) + }) + .check()?; + + Ok(Picture { + inner: self.inner, + phantom: PhantomData, + }) + } +} + +impl Picture { + /// Wrapper around `vaRenderPicture`. + pub fn render(self) -> Result> { + // Safe because `self.inner.context` represents a valid `VAContext` and `self.inner.surface` + // represents a valid `VASurface`. `buffers` point to a Rust struct and the vector length is + // passed to the C function, so it is impossible to write past the end of the vector's + // storage by mistake. + Status(unsafe { + bindings::vaRenderPicture( + self.inner.context.display().handle(), + self.inner.context.id(), + Buffer::as_id_vec(&self.inner.buffers).as_mut_ptr(), + self.inner.buffers.len() as i32, + ) + }) + .check()?; + + Ok(Picture { + inner: self.inner, + phantom: PhantomData, + }) + } +} + +impl Picture { + /// Wrapper around `vaEndPicture`. + pub fn end(self) -> Result> { + // Safe because `self.inner.context` represents a valid `VAContext`. + Status(unsafe { + bindings::vaEndPicture( + self.inner.context.display().handle(), + self.inner.context.id(), + ) + }) + .check()?; + Ok(Picture { + inner: self.inner, + phantom: PhantomData, + }) + } +} + +impl Picture { + /// Syncs the picture, ensuring that all pending operations are complete when this call returns. + pub fn sync(self) -> std::result::Result, (anyhow::Error, Self)> { + let res = self.inner.surface.borrow().sync(); + + match res { + Ok(()) => Ok(Picture { + inner: self.inner, + phantom: PhantomData, + }), + Err(e) => Err((e, self)), + } + } + + /// Queries the status of the underlying surface. + /// + /// This call can be used to implement a non-blocking path, wherein a decoder queries the status + /// of the surface after each decode operation instead of blocking on it. + pub fn query_status(&self) -> Result { + self.inner.surface.borrow_mut().query_status() + } +} + +impl Picture { + /// Returns the timestamp of this picture. + pub fn timestamp(&self) -> u64 { + self.inner.timestamp + } + + /// Returns the ID of the underlying surface. + pub fn surface_id(&self) -> bindings::VASurfaceID { + self.inner.surface.borrow().id() + } + + /// Returns a reference to the display owning this `Picture`. + pub(crate) fn display(&self) -> &Rc { + self.inner.context.display() + } + + /// Returns the size of the surface being rendered to by this `Picture`. + pub fn surface_size(&self) -> (u32, u32) { + self.inner.surface.borrow().size() + } +} + +impl Picture { + /// Reclaim ownership of the Surface this picture has been created from, consuming the picture + /// in the process. Useful if the Surface is part of a pool. + pub fn take_surface(self) -> Result { + match Rc::try_unwrap(self.inner.surface) { + Ok(surface) => Ok(surface.into_inner()), + Err(_) => Err(anyhow!("Surface still in use")), + } + } + + /// Returns a reference to the underlying `Surface` for this `Picture` + pub fn surface(&self) -> Ref { + self.inner.surface.borrow() + } + + /// Returns a mutable reference to the underlying `Surface` for this `Picture` + pub fn surface_mut(&mut self) -> RefMut { + self.inner.surface.borrow_mut() + } +} diff --git a/nihed-cros-libva/src/status.rs b/nihed-cros-libva/src/status.rs new file mode 100644 index 0000000..51781ab --- /dev/null +++ b/nihed-cros-libva/src/status.rs @@ -0,0 +1,30 @@ +// Copyright 2022 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +use std::ffi::CStr; + +use anyhow::anyhow; +use anyhow::Result; + +use crate::bindings; + +/// Wrapper over `VAStatus`, calling check() returns a Error if the status is not VA_STATUS_SUCCESS. +#[must_use = "VAStatus might not be VA_STATUS_SUCCESS."] +pub(crate) struct Status(pub bindings::VAStatus); + +impl Status { + /// Returns `Ok(())` if this status is successful, and an error otherwise. + pub(crate) fn check(&self) -> Result<()> { + if self.0 == bindings::constants::VA_STATUS_SUCCESS as i32 { + Ok(()) + } else { + // Safe because `vaErrorStr` will return a pointer to a statically allocated, null + // terminated C string. The pointer is guaranteed to never be null. + let err_str = unsafe { CStr::from_ptr(bindings::vaErrorStr(self.0)) } + .to_str() + .unwrap(); + Err(anyhow!("VA-API error: {}: {}", self.0, err_str)) + } + } +} diff --git a/nihed-cros-libva/src/surface.rs b/nihed-cros-libva/src/surface.rs new file mode 100644 index 0000000..8c626ce --- /dev/null +++ b/nihed-cros-libva/src/surface.rs @@ -0,0 +1,142 @@ +// Copyright 2022 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +use std::rc::Rc; + +use anyhow::Result; + +use crate::bindings; +use crate::display::Display; +use crate::status::Status; +use crate::UsageHint; + +/// An owned VA surface that is tied to the lifetime of a particular VADisplay +pub struct Surface { + display: Rc, + id: bindings::VASurfaceID, + width: u32, + height: u32, +} + +impl Surface { + /// Create `Surfaces` by wrapping around a `vaCreateSurfaces` call. This is just a helper for + /// [`Display::create_surfaces`]. + pub(crate) fn new( + display: Rc, + rt_format: u32, + va_fourcc: Option, + width: u32, + height: u32, + usage_hint: Option, + num_surfaces: u32, + ) -> Result> { + let mut attrs = vec![]; + + if let Some(usage_hint) = usage_hint { + let attr = bindings::VASurfaceAttrib { + type_: bindings::VASurfaceAttribType::VASurfaceAttribUsageHint, + flags: bindings::constants::VA_SURFACE_ATTRIB_SETTABLE, + value: bindings::VAGenericValue { + type_: bindings::VAGenericValueType::VAGenericValueTypeInteger, + value: bindings::_VAGenericValue__bindgen_ty_1 { + i: usage_hint.bits() as i32, + }, + }, + }; + + attrs.push(attr); + } + + if let Some(fourcc) = va_fourcc { + let attr = bindings::VASurfaceAttrib { + type_: bindings::VASurfaceAttribType::VASurfaceAttribPixelFormat, + flags: bindings::constants::VA_DISPLAY_ATTRIB_SETTABLE, + value: bindings::VAGenericValue { + type_: bindings::VAGenericValueType::VAGenericValueTypeInteger, + value: bindings::_VAGenericValue__bindgen_ty_1 { i: fourcc as i32 }, + }, + }; + + attrs.push(attr); + } + + let mut surfaces = Vec::with_capacity(num_surfaces as usize); + + // Safe because `self` represents a valid VADisplay. The `surface` and `attrs` vectors are + // properly initialized and valid sizes are passed to the C function, so it is impossible to + // write past the end of their storage by mistake. + Status(unsafe { + bindings::vaCreateSurfaces( + display.handle(), + rt_format, + width, + height, + surfaces.as_mut_ptr(), + num_surfaces, + attrs.as_mut_ptr(), + attrs.len() as u32, + ) + }) + .check()?; + + // Safe because the C function will have written to exactly `num_surfaces` entries, which is + // known to be within the vector's capacity. + unsafe { + surfaces.set_len(num_surfaces as usize); + } + + let va_surfaces = surfaces + .iter() + .map(|&id| Self { + display: Rc::clone(&display), + id, + width, + height, + }) + .collect(); + + Ok(va_surfaces) + } + + /// Blocks until all pending operations on the render target have been completed. Upon return it + /// is safe to use the render target for a different picture. + pub fn sync(&self) -> Result<()> { + // Safe because `self` represents a valid VASurface. + Status(unsafe { bindings::vaSyncSurface(self.display.handle(), self.id) }).check() + } + + /// Convenience function to return a VASurfaceID vector. Useful to interface with the C API + /// where a surface array might be needed. + pub fn as_id_vec(surfaces: &[Self]) -> Vec { + surfaces.iter().map(|surface| surface.id).collect() + } + + /// Wrapper over `vaQuerySurfaceStatus` to find out any pending ops on the render target. + pub fn query_status(&self) -> Result { + let mut status: bindings::VASurfaceStatus::Type = 0; + // Safe because `self` represents a valid VASurface. + Status(unsafe { + bindings::vaQuerySurfaceStatus(self.display.handle(), self.id, &mut status) + }) + .check()?; + Ok(status) + } + + /// Returns the ID of this surface. + pub fn id(&self) -> bindings::VASurfaceID { + self.id + } + + /// Returns the dimensions of this surface. + pub fn size(&self) -> (u32, u32) { + (self.width, self.height) + } +} + +impl Drop for Surface { + fn drop(&mut self) { + // Safe because `self` represents a valid VASurface. + unsafe { bindings::vaDestroySurfaces(self.display.handle(), &mut self.id, 1) }; + } +} diff --git a/nihed-cros-libva/src/usage_hint.rs b/nihed-cros-libva/src/usage_hint.rs new file mode 100644 index 0000000..1e15968 --- /dev/null +++ b/nihed-cros-libva/src/usage_hint.rs @@ -0,0 +1,27 @@ +// Copyright 2022 The ChromiumOS Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +use bitflags::bitflags; + +use crate::constants; + +bitflags! { + /// Gives the driver a hint of intended usage to optimize allocation (e.g. tiling). + pub struct UsageHint: u32 { + /// Surface usage not indicated. + const USAGE_HINT_GENERIC = constants::VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC; + /// Surface used by video decoder. + const USAGE_HINT_DECODER = constants::VA_SURFACE_ATTRIB_USAGE_HINT_DECODER; + /// Surface used by video encoder. + const USAGE_HINT_ENCODER = constants::VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER; + /// Surface read by video post-processing. + const USAGE_HINT_VPP_READ = constants::VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ; + /// Surface written by video post-processing. + const USAGE_HINT_VPP_WRITE = constants::VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE; + /// Surface used for display. + const USAGE_HINT_DISPLAY = constants::VA_SURFACE_ATTRIB_USAGE_HINT_DISPLAY; + /// Surface used for export to third-party APIs, e.g. via `vaExportSurfaceHandle()`. + const USAGE_HINT_EXPORT = constants::VA_SURFACE_ATTRIB_USAGE_HINT_EXPORT; + } +} -- 2.30.2