pub struct H265Encoder { /* private fields */ }Expand description
H.265 registry encoder behind the oxideav_core::Encoder
contract. Every input frame becomes one Annex B access unit — a
self-contained IDR (VPS + SPS + PPS + IDR_N_LP) in the two intra
modes and at inter-mode GOP starts, or a TRAIL_R P slice inside
an inter-mode GOP. Three coding modes, selected by the mode
codec option:
"pcm"(default) — the PCM-only bootstrap: every coding unit a §7.3.8.7 PCM block, bit-exact lossless."intra"— real CABAC intra coding (§8.4 prediction + forward transform/quant + §7.3.8 syntax) at theqpoption’sSliceQpY(0..=51, default 26)."inter"— low-delayIDR, P, P, …coding (§8.5 inter prediction with per-CTU skip / merge / AMVP / intra decisions) at theqpoption’sSliceQpY; thegopoption sets the IDR period in frames (default 0 = a single leading IDR); thebslicesoption ("1"/"true") codes the non-IDR frames as low-delay B slices; theampoption switches to the AMP stream configuration (MinCbSizeY == 8,amp_enabled_flag == 1, the four asymmetric PART_2NxnU/2NxnD/nLx2N/nRx2N shapes competing in the inter CU ladder); thepyramidoption (a power of two in 2..=16) switches to hierarchical-B coding — dyadic mini-GOPs coded out of display order with per-layer QP offsets — thepyramidstepoption (0..=6, default 1) sets the per-layer step of that hierarchical allocation (SliceQpY = base + layer * step, composing withaq’s per-CTB deltas on top); packets then arrive in bursts per mini-GOP (dts trails pts bylog2(pyramid)frames) andflush()emits the tail.pyramidexcludes thegop/bslicesoptions.
The "intra" and "inter" modes accept the §8.7 in-loop filter
options deblock and sao ("1" / "true" to enable): the
encoder then signals the filters, elects them per slice / CTB
against distortion, and reconstructs through them (the reference
path a conforming decoder holds).
The bitrate option (bits per second, optional k / M suffix)
switches the "intra" / "inter" modes from constant QP to
average-bitrate coding: rate::RateControlCfg semantics, with
the fps option ("25" or "30000/1001", default 25) fixing the
frame rate the budget is spread over and an explicit qp option
seeding the starting QP. fps also sets the packet time base.
bufsize (bits; requires bitrate) adds a VBV constraint: no
access unit may exceed the modelled decoder buffer (frames are
re-encoded at a higher QP when needed) — on the low-delay, intra
AND pyramid paths, the last with per-access-unit accounting at
each decode instant across the mini-GOP burst.
The aq option (1..=3, "intra" / "inter" modes) enables
spatial adaptive quantization: per-CTB QP offsets from luma
activity, signalled through §7.3.8.10 cu_qp_delta.
The hrd option ("1" / "true"; requires bitrate, bufsize
AND an explicit fps) declares and enforces HRD conformance: the
SPS VUI gains a §E.2.2 hrd_parameters( ) delivery schedule (NAL
HRD, one CPB at the target rate and VBV size, VBR, fixed picture
rate), every IRAP access unit carries a §D.2.2 buffering-period
SEI, every access unit a §D.2.3 pic-timing SEI (the pyramid’s
pic_dpb_output_delay carries its reorder schedule), and coded
sizes are additionally capped by an exact Annex C CPB replay so
the emitted stream satisfies the §C.4 conformance conditions.
The cbr option (requires hrd) switches the schedule to
constant-bit-rate delivery (cbr_flag == 1): back-to-back
eq. C-3 arrivals, mid-stream initial delays held to the
two-sided eq. C-19 bound, and §7.3.4 filler-data NAL units
padding underruns so the CPB cannot overflow (needs a bufsize
of at least two frame intervals of the bitrate).
4:2:0 8-bit, dimensions multiples of 16.
Trait Implementations§
Source§impl Debug for H265Encoder
impl Debug for H265Encoder
Source§impl Encoder for H265Encoder
impl Encoder for H265Encoder
Source§fn output_params(&self) -> &CodecParameters
fn output_params(&self) -> &CodecParameters
Source§fn send_frame(&mut self, frame: &Frame) -> Result<()>
fn send_frame(&mut self, frame: &Frame) -> Result<()>
receive_packet in a loop afterwards.Source§fn receive_packet(&mut self) -> Result<Packet>
fn receive_packet(&mut self) -> Result<Packet>
Error::NeedMore
when the encoder needs another frame (or a flush).Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
receive_packet.Source§fn set_execution_context(&mut self, _ctx: &ExecutionContext)
fn set_execution_context(&mut self, _ctx: &ExecutionContext)
Decoder::set_execution_context.