feat: 增加 Amlogic 硬件编码的并行解码支持

This commit is contained in:
mofeng-git
2026-08-25 14:58:09 +08:00
parent b8ea38b5f3
commit 827d24fde4
2 changed files with 10 additions and 5 deletions

View File

@@ -231,9 +231,9 @@ fn create_mjpeg_decoder(resolution: Resolution) -> Result<(MjpegDecoderKind, Pix
Ok((libyuv_mjpeg_decoder(resolution), PixelFormat::Nv12))
}
/// AMLENC and libjpeg-turbo use independent CPU/hardware resources. Decode
/// MJPEG in the capture worker so encoding the previous NV12 frame can overlap
/// with decoding the next frame.
/// Amlogic hardware encoders and libjpeg-turbo use independent CPU/hardware
/// resources. Decode MJPEG in the capture worker so encoding the previous NV12
/// frame can overlap with decoding the next frame.
pub(super) fn should_parallel_decode_mjpeg(config: &SharedVideoPipelineConfig) -> bool {
if !config.input_format.is_compressed()
|| !matches!(
@@ -248,7 +248,12 @@ pub(super) fn should_parallel_decode_mjpeg(config: &SharedVideoPipelineConfig) -
Some(backend) => registry.encoder_with_backend(config.output_codec, backend),
None => registry.best_available_encoder(config.output_codec),
};
selected.is_some_and(|encoder| encoder.backend == EncoderBackend::Amlogic)
selected.is_some_and(|encoder| {
matches!(
encoder.backend,
EncoderBackend::Amlogic | EncoderBackend::V4l2m2m
)
})
}
pub(super) fn build_encoder_state(

View File

@@ -636,7 +636,7 @@ impl SharedVideoPipeline {
let mut encoder_config = config.clone();
if parallel_mjpeg_decode {
encoder_config.input_format = PixelFormat::Nv12;
info!("Using capture-thread libyuv MJPEG decode with parallel AMLENC encoding");
info!("Using capture-thread libyuv MJPEG decode with parallel hardware encoding");
}
let mut encoder_state = build_encoder_state(&encoder_config)?;
let _ = self.running.send(true);