diff --git a/crates/ec-hw/examples/hw_decode.rs b/crates/ec-hw/examples/hw_decode.rs new file mode 100644 index 00000000..0aad97de --- /dev/null +++ b/crates/ec-hw/examples/hw_decode.rs @@ -0,0 +1,105 @@ +//! Decodes ffmpeg libx264 streams with B-frames and three references through HwDecoder and compares luma with ffmpeg's decode. +//! +//! ```text +//! cargo run -p ec-hw --example hw_decode -- +//! ``` + +use std::fs; +use std::path::{Path, PathBuf}; +use std::process::Command; + +use ec_hw::{Codec, HwDecoder, I420}; + +fn main() { + let dir = PathBuf::from(std::env::args().nth(1).expect("scratch dir argument")); + run(&dir, "bf640", "640x360", 60); + run(&dir, "bf1280", "1280x720", 30); +} + +fn ffmpeg(args: &[&str]) { + let status = Command::new("ffmpeg") + .args(["-y", "-loglevel", "error"]) + .args(args) + .status() + .expect("run ffmpeg"); + assert!(status.success(), "ffmpeg {args:?}"); +} + +fn run(dir: &Path, name: &str, size: &str, frames: usize) { + let stream = dir.join(format!("{name}.h264")); + let reference = dir.join(format!("{name}.yuv")); + let source = format!("testsrc2=size={size}:rate=30"); + let frames = frames.to_string(); + let stream_arg = stream.to_str().expect("utf-8 path"); + let reference_arg = reference.to_str().expect("utf-8 path"); + ffmpeg(&[ + "-f", + "lavfi", + "-i", + &source, + "-frames:v", + &frames, + "-c:v", + "libx264", + "-profile:v", + "high", + "-bf", + "2", + "-refs", + "3", + "-bsf:v", + "h264_mp4toannexb", + "-f", + "h264", + stream_arg, + ]); + ffmpeg(&[ + "-i", + stream_arg, + "-f", + "rawvideo", + "-pix_fmt", + "yuv420p", + reference_arg, + ]); + + let data = fs::read(&stream).expect("read stream"); + let mut decoder = HwDecoder::open(Codec::H264).expect("open H.264 decoder"); + let backend = decoder.backend(); + decoder.decode(&data, 0).expect("decode"); + decoder.flush().expect("flush"); + let mut decoded: Vec = Vec::new(); + while let Some((_, frame)) = decoder.next_frame().expect("next frame") { + decoded.push(frame); + } + + let raw = fs::read(&reference).expect("read reference"); + let (w, h) = size + .split_once('x') + .map(|(w, h)| { + ( + w.parse::().expect("width"), + h.parse::().expect("height"), + ) + }) + .expect("size"); + let frame_len = w * h * 3 / 2; + let worst = decoded + .iter() + .zip(raw.chunks_exact(frame_len)) + .map(|(ours, theirs)| { + let sum: f64 = ours + .y + .iter() + .zip(&theirs[..w * h]) + .map(|(&a, &b)| (a as f64 - b as f64).abs()) + .sum(); + sum / (w * h) as f64 + }) + .fold(0.0f64, f64::max); + println!( + "{name} {backend:?} {size}: decoded {} frames, ffmpeg {} frames, max mean |diff| Y {worst:.6}", + decoded.len(), + raw.len() / frame_len + ); +} diff --git a/crates/ec-hw/src/hw.rs b/crates/ec-hw/src/hw.rs index cddbd50d..6dc1fa42 100644 --- a/crates/ec-hw/src/hw.rs +++ b/crates/ec-hw/src/hw.rs @@ -3,6 +3,7 @@ use crate::error::{Error, Result}; use crate::picture::I420; use crate::types::{Codec, CodedFrame, EncCodec, EncoderConfig, FrameMetadata, RateControlMode}; +use crate::vkdec264::VkH264Decoder; #[cfg(target_os = "linux")] use crate::dec::Decoder as VaDecoder; @@ -46,7 +47,7 @@ thread_local! { static GPU: Option = ec_vk::Gpu::open().ok(); } -fn vk_gpu() -> Option { +pub(crate) fn vk_gpu() -> Option { GPU.with(|gpu| gpu.clone()) } @@ -54,11 +55,10 @@ fn vk_gpu() -> Option { pub fn capabilities() -> Vec { let mut out = Vec::new(); if let Some(gpu) = vk_gpu() { - for caps in gpu - .caps() - .into_iter() - .filter(|c| c.direction == ec_vk::Direction::Encode) - { + for caps in gpu.caps().into_iter().filter(|c| { + c.direction == ec_vk::Direction::Encode + || (c.direction == ec_vk::Direction::Decode && c.codec == ec_vk::Codec::H264) + }) { let codec = match caps.codec { ec_vk::Codec::H264 => Codec::H264, ec_vk::Codec::H265 => Codec::H265, @@ -417,76 +417,88 @@ fn open_va(config: EncoderConfig) -> Result { )) } -/// A hardware decoder. Only VA-API decodes for now. -pub struct HwDecoder { +enum DecInner { + Vk(VkH264Decoder), #[cfg(target_os = "linux")] - inner: VaDecoder, + Va(VaDecoder), +} + +/// A hardware decoder on whichever backend opened. +pub struct HwDecoder { + inner: DecInner, } impl HwDecoder { - /// Open a decoder for `codec`. Non-Linux: always `Unsupported`. + /// Open a decoder for `codec`. H.264 tries Vulkan Video first, then VA-API (Linux). pub fn open(codec: Codec) -> Result { - #[cfg(target_os = "linux")] - { - let display = ec_va::open()?; - Ok(HwDecoder { - inner: VaDecoder::new(&display, codec)?, - }) + let mut reasons = Vec::new(); + if matches!(codec, Codec::H264) { + match VkH264Decoder::new() { + Ok(inner) => { + return Ok(HwDecoder { + inner: DecInner::Vk(inner), + }); + } + Err(e) => reasons.push(format!("Vk: {e}")), + } } - #[cfg(not(target_os = "linux"))] + #[cfg(target_os = "linux")] { - Err(Error::unsupported( - format!("{codec:?} hardware decode"), - "VA-API is Linux only", - )) + let va = (|| -> Result { + let display = ec_va::open()?; + VaDecoder::new(&display, codec) + })(); + match va { + Ok(inner) => { + return Ok(HwDecoder { + inner: DecInner::Va(inner), + }); + } + Err(e) => reasons.push(format!("Va: {e}")), + } } + Err(Error::unsupported( + format!("{codec:?} hardware decode"), + reasons.join("; "), + )) } /// The backend this decoder runs on. pub fn backend(&self) -> Backend { - Backend::Va + match self.inner { + DecInner::Vk(_) => Backend::Vk, + #[cfg(target_os = "linux")] + DecInner::Va(_) => Backend::Va, + } } /// Feed one access unit. pub fn decode(&mut self, data: &[u8], timestamp: i64) -> Result<()> { - #[cfg(target_os = "linux")] - { - self.inner.decode(data, timestamp) - } - #[cfg(not(target_os = "linux"))] - { - let _ = (data, timestamp); - Err(Error::unsupported( - "hardware decode", - "VA-API is Linux only", - )) + match &mut self.inner { + DecInner::Vk(d) => d.decode(data, timestamp), + #[cfg(target_os = "linux")] + DecInner::Va(d) => d.decode(data, timestamp), } } /// The next picture in display order, as 8-bit I420 with its timestamp. pub fn next_frame(&mut self) -> Result> { - #[cfg(target_os = "linux")] - { - match self.inner.next_frame() { + match &mut self.inner { + DecInner::Vk(d) => Ok(d.next_frame()), + #[cfg(target_os = "linux")] + DecInner::Va(d) => match d.next_frame() { Some(frame) => Ok(Some((frame.timestamp, frame.to_i420()?))), None => Ok(None), - } - } - #[cfg(not(target_os = "linux"))] - { - Ok(None) + }, } } /// Emit every picture still held for reordering. pub fn flush(&mut self) -> Result<()> { - #[cfg(target_os = "linux")] - { - self.inner.flush() - } - #[cfg(not(target_os = "linux"))] - { - Ok(()) + match &mut self.inner { + DecInner::Vk(d) => d.flush(), + #[cfg(target_os = "linux")] + DecInner::Va(d) => d.flush(), } } } diff --git a/crates/ec-hw/src/lib.rs b/crates/ec-hw/src/lib.rs index b6e163e9..342e0a11 100644 --- a/crates/ec-hw/src/lib.rs +++ b/crates/ec-hw/src/lib.rs @@ -73,6 +73,7 @@ pub mod params; pub mod pool; pub mod reset; pub mod types; +pub(crate) mod vkdec264; #[cfg(target_os = "linux")] pub use dec::{Decoder, StreamInfo}; diff --git a/crates/ec-hw/src/vkdec264.rs b/crates/ec-hw/src/vkdec264.rs new file mode 100644 index 00000000..7b35bea4 --- /dev/null +++ b/crates/ec-hw/src/vkdec264.rs @@ -0,0 +1,449 @@ +//! H.264 decoding over Vulkan Video: the shared DPB over DPB slot indices. + +use std::collections::{HashMap, VecDeque}; + +use ec_h264_syntax::sps::{ZIGZAG_4X4, ZIGZAG_8X8}; +use ec_h264_syntax::{ + AnnexBIter, DecRefPicMarking, NalHeader, NalUnitType, Pps, SliceHeader, Sps, unescape_rbsp, +}; +use ec_vk::{ + H264DecodeConfig, H264DecodePicture, H264DecodeSession, H264Pps, H264RefSlot, H264Sps, + ScalingLists, +}; + +use crate::dpb264::{self, Mark, PicInfo, Poc}; +use crate::error::{Error, Result}; +use crate::h264_common::peek_pps_id; +use crate::picture::{I420, nv12_to_i420}; + +const MAX_SLOTS: u32 = 17; + +type Dpb = dpb264::Dpb; +type Picture = dpb264::Picture; + +struct Session { + h264: H264DecodeSession, + max_width: u32, + max_height: u32, + slots: u32, +} + +struct Current { + slot: u32, + id: i32, + sps_id: u8, + pps_id: u8, + info: PicInfo, + poc: Poc, + idr_pic_id: u16, + timestamp: i64, + marking: Option, + slices: Vec>, +} + +struct Side { + fields: [i32; 2], + output: Option<(i64, I420)>, +} + +/// H.264 Vulkan Video decoder: DPB bookkeeping in Rust, pictures decoded into slots. +pub(crate) struct VkH264Decoder { + gpu: ec_vk::Gpu, + session: Option, + params_dirty: bool, + sps_map: [Option; 32], + pps_map: Vec>, + dpb: Dpb, + pics: HashMap, + current: Option, + ready: VecDeque<(i64, I420)>, + rbsp: Vec, +} + +impl VkH264Decoder { + pub(crate) fn new() -> Result { + let gpu = crate::hw::vk_gpu() + .ok_or_else(|| Error::unsupported("Vulkan Video H.264 decode", "no Vulkan device"))?; + Ok(VkH264Decoder { + gpu, + session: None, + params_dirty: false, + sps_map: [const { None }; 32], + pps_map: (0..256).map(|_| None).collect(), + dpb: Dpb::default(), + pics: HashMap::new(), + current: None, + ready: VecDeque::new(), + rbsp: Vec::new(), + }) + } + + pub(crate) fn decode(&mut self, data: &[u8], timestamp: i64) -> Result<()> { + for nal in AnnexBIter::new(data) { + let Some((&first, payload)) = nal.split_first() else { + continue; + }; + let header = NalHeader::parse(first)?; + match header.unit_type { + NalUnitType::Sps => { + let mut rbsp = std::mem::take(&mut self.rbsp); + unescape_rbsp(payload, &mut rbsp); + let sps = Sps::parse(&rbsp); + self.rbsp = rbsp; + let sps = sps?; + self.dpb.configure(&sps); + let id = usize::from(sps.id); + self.sps_map[id] = Some(sps); + self.params_dirty = true; + } + NalUnitType::Pps => { + let mut rbsp = std::mem::take(&mut self.rbsp); + unescape_rbsp(payload, &mut rbsp); + let pps = Pps::parse(&rbsp, |id| self.sps_map[usize::from(id)].as_ref()); + self.rbsp = rbsp; + let pps = pps?; + let id = pps.id as usize; + if id < self.pps_map.len() { + self.pps_map[id] = Some(pps); + self.params_dirty = true; + } + } + NalUnitType::Slice | NalUnitType::SliceIdr => { + self.slice(header, nal, payload, timestamp)?; + } + _ => {} + } + } + self.finish_picture() + } + + pub(crate) fn next_frame(&mut self) -> Option<(i64, I420)> { + self.ready.pop_front() + } + + pub(crate) fn flush(&mut self) -> Result<()> { + self.finish_picture()?; + self.bump(true); + Ok(()) + } + + fn slice( + &mut self, + header: NalHeader, + nal: &[u8], + payload: &[u8], + timestamp: i64, + ) -> Result<()> { + let mut rbsp = std::mem::take(&mut self.rbsp); + unescape_rbsp(payload, &mut rbsp); + let result = self.slice_rbsp(header, nal, &rbsp, timestamp); + self.rbsp = rbsp; + result + } + + fn slice_rbsp( + &mut self, + header: NalHeader, + nal: &[u8], + rbsp: &[u8], + timestamp: i64, + ) -> Result<()> { + let pps_id = peek_pps_id(rbsp)?; + let Some(pps) = self.pps_map.get(pps_id as usize).and_then(|p| p.clone()) else { + return Ok(()); + }; + let Some(sps) = self.sps_map[usize::from(pps.sps_id)].clone() else { + return Ok(()); + }; + let sh = SliceHeader::parse(rbsp, header, &sps, &pps)?; + if sh.first_mb_in_slice == 0 { + self.finish_picture()?; + self.start_picture(&sps, &sh, header, timestamp)?; + } + if let Some(current) = self.current.as_mut() { + current.slices.push(nal.to_vec()); + } + Ok(()) + } + + fn start_picture( + &mut self, + sps: &Sps, + sh: &SliceHeader, + header: NalHeader, + timestamp: i64, + ) -> Result<()> { + self.ensure_session(sps)?; + if self.params_dirty { + self.set_parameters()?; + } + let info = PicInfo { + is_idr: header.is_idr(), + is_reference: header.ref_idc != 0, + frame_num: sh.frame_num, + pic_order_cnt_lsb: sh.pic_order_cnt_lsb, + delta_pic_order_cnt_bottom: sh.delta_pic_order_cnt_bottom, + delta_pic_order_cnt: sh.delta_pic_order_cnt, + }; + if !info.is_idr && self.dpb.frame_num_gap(sps, sh.frame_num) { + self.fill_gap(sps, sh.frame_num)?; + } + let poc = self.dpb.picture_order_count(sps, &info)?; + let slot = self.free_slot()?; + let id = self.dpb.next_id(); + self.current = Some(Current { + slot, + id, + sps_id: sps.id, + pps_id: sh.pps_id as u8, + info, + poc, + idr_pic_id: sh.idr_pic_id.unwrap_or(0) as u16, + timestamp, + marking: sh.dec_ref_pic_marking.clone(), + slices: Vec::new(), + }); + Ok(()) + } + + fn ensure_session(&mut self, sps: &Sps) -> Result<()> { + if sps.chroma_format_idc != 1 || sps.bit_depth_luma != 8 || sps.bit_depth_chroma != 8 { + return Err(Error::unsupported( + "Vulkan H.264 decode", + "only 8-bit 4:2:0", + )); + } + let slots = (self.dpb.capacity() as u32 + 1).min(MAX_SLOTS); + let (w, h) = (sps.coded_width, sps.coded_height); + let (max_width, max_height, slots) = match &self.session { + Some(s) if w <= s.max_width && h <= s.max_height && slots <= s.slots => return Ok(()), + Some(s) => (w.max(s.max_width), h.max(s.max_height), slots.max(s.slots)), + None => (w, h, slots), + }; + self.current = None; + self.dpb.clear(); + self.pics.clear(); + self.session = None; + let h264 = H264DecodeSession::new( + &self.gpu, + &H264DecodeConfig { + max_width, + max_height, + max_dpb_slots: slots, + profile_idc: sps.profile_idc, + }, + )?; + self.session = Some(Session { + h264, + max_width, + max_height, + slots, + }); + self.params_dirty = true; + Ok(()) + } + + fn set_parameters(&mut self) -> Result<()> { + let sps: Vec = self.sps_map.iter().flatten().map(vk_sps).collect(); + let pps: Vec = self.pps_map.iter().flatten().map(vk_pps).collect(); + let session = self + .session + .as_mut() + .ok_or_else(|| Error::config("H.264 parameters before any SPS"))?; + session.h264.set_parameters(&sps, &pps)?; + self.params_dirty = false; + Ok(()) + } + + fn free_slot(&self) -> Result { + let session = self + .session + .as_ref() + .ok_or_else(|| Error::config("H.264 picture before any SPS"))?; + (0..session.slots) + .find(|slot| self.dpb.frames.iter().all(|p| p.surface != *slot)) + .ok_or_else(|| Error::config("H.264 Vulkan decode: every DPB slot is in use")) + } + + fn fill_gap(&mut self, sps: &Sps, frame_num: u32) -> Result<()> { + let before = self.dpb.frames.len(); + self.dpb.fill_frame_num_gap(sps, frame_num)?; + for i in before..self.dpb.frames.len() { + self.dpb.frames[i].surface = self.free_slot()?; + } + Ok(()) + } + + fn finish_picture(&mut self) -> Result<()> { + let Some(current) = self.current.take() else { + return Ok(()); + }; + let Some(sps) = self.sps_map[usize::from(current.sps_id)].clone() else { + return Ok(()); + }; + let fields = field_pocs(current.poc.value, current.info.delta_pic_order_cnt_bottom); + let refs: Vec = if current.info.is_idr { + Vec::new() + } else { + self.dpb + .frames + .iter() + .filter(|p| p.mark != Mark::Unused) + .map(|p| H264RefSlot { + slot: p.surface, + frame_num: p.frame_num as u16, + poc: self.pics.get(&p.id).map_or([p.poc, p.poc], |s| s.fields), + long_term: p.mark == Mark::Long, + non_existing: p.non_existing, + }) + .collect() + }; + let slices: Vec<&[u8]> = current.slices.iter().map(Vec::as_slice).collect(); + let session = self + .session + .as_mut() + .ok_or_else(|| Error::config("H.264 picture before any SPS"))?; + session.h264.decode(&H264DecodePicture { + sps_id: current.sps_id, + pps_id: current.pps_id, + idr: current.info.is_idr, + reference: current.info.is_reference, + frame_num: current.info.frame_num as u16, + idr_pic_id: current.idr_pic_id, + poc: fields, + setup_slot: current.slot, + refs: &refs, + slices: &slices, + })?; + let (y, uv) = session + .h264 + .read_output(sps.coded_width, sps.coded_height)?; + let out = crop(&sps, &y, &uv); + + let picture = Picture { + id: current.id, + surface: current.slot, + timestamp: current.timestamp, + frame_num: current.info.frame_num, + frame_num_wrap: current.info.frame_num as i32, + pic_num: current.info.frame_num as i32, + long_term_frame_idx: 0, + poc: current.poc.value, + poc_msb: current.poc.msb, + poc_lsb: current.poc.lsb, + frame_num_offset: current.poc.frame_num_offset, + mark: Mark::Unused, + non_existing: false, + output: true, + }; + self.pics.insert( + current.id, + Side { + fields, + output: Some((current.timestamp, out)), + }, + ); + self.dpb + .store(picture, &sps, ¤t.info, current.marking.as_ref(), true)?; + self.bump(false); + Ok(()) + } + + fn bump(&mut self, flush: bool) { + while let Some(idx) = self.dpb.next_output(flush) { + let id = self.dpb.frames[idx].id; + if let Some((ts, frame)) = self.pics.get_mut(&id).and_then(|s| s.output.take()) { + self.ready.push_back((ts, frame)); + } + self.dpb.released(idx); + } + let frames = &self.dpb.frames; + self.pics.retain(|id, _| frames.iter().any(|p| p.id == *id)); + } +} + +fn field_pocs(poc: i32, delta_bottom: i32) -> [i32; 2] { + [poc - delta_bottom.min(0), poc + delta_bottom.max(0)] +} + +fn crop(sps: &Sps, y: &[u8], uv: &[u8]) -> I420 { + let (left, _, top, _) = sps.crop; + let (left, top) = (left as usize, top as usize); + let pitch = sps.coded_width as usize; + nv12_to_i420( + &y[top * pitch + left..], + pitch, + &uv[(top / 2) * pitch + left..], + pitch, + sps.width as usize, + sps.height as usize, + ) +} + +fn lists(l: &ec_h264_syntax::ScalingLists) -> ScalingLists { + let mut out = ScalingLists { + l4x4: [[0; 16]; 6], + l8x8: [[0; 64]; 6], + }; + for i in 0..6 { + out.l4x4[i] = ZIGZAG_4X4.map(|r| l.list_4x4[i][usize::from(r)]); + out.l8x8[i] = ZIGZAG_8X8.map(|r| l.list_8x8[i][usize::from(r)]); + } + out +} + +fn vk_sps(sps: &Sps) -> H264Sps { + let unit_y = if sps.frame_mbs_only { 2 } else { 4 }; + let (left, right, top, bottom) = sps.crop; + H264Sps { + id: sps.id, + profile_idc: sps.profile_idc, + level_idc: sps.level_idc, + chroma_format_idc: sps.chroma_format_idc, + bit_depth_luma_minus8: sps.bit_depth_luma.saturating_sub(8), + bit_depth_chroma_minus8: sps.bit_depth_chroma.saturating_sub(8), + log2_max_frame_num_minus4: sps.log2_max_frame_num.saturating_sub(4), + pic_order_cnt_type: sps.pic_order_cnt_type, + log2_max_pic_order_cnt_lsb_minus4: sps.log2_max_pic_order_cnt_lsb.saturating_sub(4), + offset_for_non_ref_pic: sps.offset_for_non_ref_pic, + offset_for_top_to_bottom_field: sps.offset_for_top_to_bottom_field, + offset_for_ref_frame: sps.offsets_for_ref_frame.clone(), + max_num_ref_frames: sps.max_num_ref_frames as u8, + pic_width_in_mbs_minus1: sps.mb_width.saturating_sub(1), + pic_height_in_map_units_minus1: (if sps.frame_mbs_only { + sps.mb_height + } else { + sps.mb_height / 2 + }) + .saturating_sub(1), + frame_mbs_only: sps.frame_mbs_only, + mb_adaptive_frame_field: sps.mb_adaptive_frame_field, + direct_8x8_inference: sps.direct_8x8_inference, + delta_pic_order_always_zero: sps.delta_pic_order_always_zero, + frame_crop_offsets: [left / 2, right / 2, top / unit_y, bottom / unit_y], + qpprime_y_zero_transform_bypass: sps.transform_bypass, + seq_scaling_matrix: sps.scaling_lists.as_ref().map(lists), + } +} + +fn vk_pps(pps: &Pps) -> H264Pps { + H264Pps { + id: pps.id as u8, + sps_id: pps.sps_id, + entropy_coding_mode: pps.entropy_coding_mode, + bottom_field_pic_order_in_frame_present: pps.bottom_field_pic_order_in_frame_present, + num_ref_idx_l0_default_active_minus1: (pps.num_ref_idx_l0_default_active - 1) as u8, + num_ref_idx_l1_default_active_minus1: (pps.num_ref_idx_l1_default_active - 1) as u8, + weighted_pred: pps.weighted_pred, + weighted_bipred_idc: pps.weighted_bipred_idc, + pic_init_qp_minus26: (pps.pic_init_qp - 26) as i8, + pic_init_qs_minus26: (pps.pic_init_qs - 26) as i8, + chroma_qp_index_offset: pps.chroma_qp_index_offset as i8, + second_chroma_qp_index_offset: pps.second_chroma_qp_index_offset as i8, + deblocking_filter_control_present: pps.deblocking_filter_control_present, + constrained_intra_pred: pps.constrained_intra_pred, + redundant_pic_cnt_present: pps.redundant_pic_cnt_present, + transform_8x8_mode: pps.transform_8x8_mode, + pic_scaling_matrix: pps.scaling_lists.as_ref().map(lists), + } +} diff --git a/crates/ec-vk/src/lib.rs b/crates/ec-vk/src/lib.rs index 627a629b..cfd2d23d 100644 --- a/crates/ec-vk/src/lib.rs +++ b/crates/ec-vk/src/lib.rs @@ -9,7 +9,10 @@ mod h265; pub use av1::{Av1Encoder, Av1EncoderConfig}; pub use h265::{H265Encoder, H265EncoderConfig}; -pub use vk_video_ffi::{Codec, Direction, Error, Gpu, RateControl}; +pub use vk_video_ffi::{ + Codec, Direction, Error, Gpu, H264DecodeConfig, H264DecodePicture, H264DecodeSession, H264Pps, + H264RefSlot, H264Sps, RateControl, ScalingLists, +}; /// Encoder settings. #[derive(Debug, Clone, Copy, PartialEq, Eq)]