Skip to main content

encode_cpu_from

Function encode_cpu_from 

Source
pub fn encode_cpu_from(
    stripes: &mut Vec<StripeState>,
    raw_pixels: &[u8],
    planes: Option<&Nv12Planes>,
    width: i32,
    height: i32,
    damage_rects: &[Rectangle<i32, Physical>],
    current: bool,
    settings: &CaptureSettings,
    frame_counter: u16,
    use_gpu: bool,
    hash_damage: bool,
    requested_idr: bool,
) -> Vec<EncodedStripe>
Expand description

encode_cpu with the frame’s picture already converted (planes): an 8-bit 4:2:0 x264 session encodes it in place and leaves raw_pixels unread, which a capture converting straight from the screen’s memory never wrote. x264 reads the picture through the next encode (held_input).

current says whether damage_rects holds every change of this frame against the one before, as a compositor’s damage or this frame’s own hash does. Only then does x264 code the blocks they leave out as skips without analysis (H264EncoderWrapper::constant_blocks): rectangles read from the frame before’s hash (a Turbo frame’s) leave out a block that held still there and changes in this frame, which a skip would show as it was.