diff --git a/crates/ec-h265/src/dec/mod.rs b/crates/ec-h265/src/dec/mod.rs index 89cfe3c9..f086ac39 100644 --- a/crates/ec-h265/src/dec/mod.rs +++ b/crates/ec-h265/src/dec/mod.rs @@ -125,7 +125,9 @@ fn picture_limit(threads: usize) -> usize { /// The worker-thread budget: the machine's available parallelism, capped at [`MAX_THREADS`]. pub fn configured_threads() -> usize { - std::thread::available_parallelism().map_or(1, |n| n.get()).min(MAX_THREADS) + std::thread::available_parallelism() + .map_or(1, |n| n.get()) + .min(MAX_THREADS) } /// Streaming HEVC decoder with the same surface as the H.264 one: feed NAL diff --git a/crates/ec-h265/src/dec/runner.rs b/crates/ec-h265/src/dec/runner.rs index f3566f30..db79af6d 100644 --- a/crates/ec-h265/src/dec/runner.rs +++ b/crates/ec-h265/src/dec/runner.rs @@ -134,9 +134,7 @@ impl Runner { /// Start the decoding of the picture of `job`. `threaded` gives it a worker thread. pub fn start(job: PicJob, threaded: bool) -> Runner { if !threaded { - return Runner::Inline { - job: Box::new(job), - }; + return Runner::Inline { job: Box::new(job) }; } let (tx, rx) = mpsc::channel(); let handle = std::thread::spawn(move || run_worker(rx, job)); diff --git a/crates/ec-h265/src/decode.rs b/crates/ec-h265/src/decode.rs index 07b50c72..068b8bd8 100644 --- a/crates/ec-h265/src/decode.rs +++ b/crates/ec-h265/src/decode.rs @@ -52,7 +52,6 @@ impl DecodedPicture { (self.width.div_ceil(1 << sx), self.height.div_ceil(1 << sy)) } - /// A picture of mid-grey samples, each plane at its own bit depth. pub fn grey_planes( width: usize, diff --git a/crates/ec-h265/src/encoder.rs b/crates/ec-h265/src/encoder.rs index a2fb1cf2..56261806 100644 --- a/crates/ec-h265/src/encoder.rs +++ b/crates/ec-h265/src/encoder.rs @@ -1033,7 +1033,12 @@ impl Encoder { (&bcb, w / 2 * bps, w / 2 * bps, h / 2), (&bcr, w / 2 * bps, w / 2 * bps, h / 2), ]); - write_annex_b(&mut au, NalHeader::new(NalUnitType::SuffixSei), &rbsp, false); + write_annex_b( + &mut au, + NalHeader::new(NalUnitType::SuffixSei), + &rbsp, + false, + ); } au } diff --git a/crates/ec-h265/tests/it/common.rs b/crates/ec-h265/tests/it/common.rs index e4e33c84..4b593beb 100644 --- a/crates/ec-h265/tests/it/common.rs +++ b/crates/ec-h265/tests/it/common.rs @@ -194,7 +194,11 @@ pub const PLANE_NAMES: [&str; 3] = ["Y", "Cb", "Cr"]; /// The bit depth of component `c` (0 luma, 1 and 2 chroma). pub fn bit_depth_of(pic: &DecodedPicture, c: usize) -> u32 { - if c == 0 { pic.bit_depth } else { pic.bit_depth_c } + if c == 0 { + pic.bit_depth + } else { + pic.bit_depth_c + } } /// Bytes per sample of component `c`: 1 for 8-bit, 2 (little endian) above 8 bits. diff --git a/crates/ec-h265/tests/it/encode_threads.rs b/crates/ec-h265/tests/it/encode_threads.rs index 8624d39b..d2a5bf24 100644 --- a/crates/ec-h265/tests/it/encode_threads.rs +++ b/crates/ec-h265/tests/it/encode_threads.rs @@ -183,7 +183,8 @@ fn end_picture_outputs_each_access_unit_cropped() { cfg.keyint = 4; cfg.keep_recon = true; cfg.threads = 1; - let mut seq = ec_h265::SequenceEncoder::new(Encoder::new(cfg).expect("encoder")).expect("sequence"); + let mut seq = + ec_h265::SequenceEncoder::new(Encoder::new(cfg).expect("encoder")).expect("sequence"); let mut dec = Decoder::new(); for f in &frames { let pic = seq.encode(f, false).expect("encode"); @@ -193,6 +194,9 @@ fn end_picture_outputs_each_access_unit_cropped() { assert_eq!((out.width, out.height), (200, 120)); let recon = pic.recon.expect("recon"); let y: Vec = out.y.iter().map(|&v| v as u8).collect(); - assert!(*y == *recon.planes[0].data, "cropped luma differs from the reconstruction"); + assert!( + *y == *recon.planes[0].data, + "cropped luma differs from the reconstruction" + ); } }