From ac458c4b0721521929cb79c3c6db56d7ef89c16f Mon Sep 17 00:00:00 2001 From: bunnie Date: Wed, 20 Aug 2025 03:07:12 +0800 Subject: [PATCH] reduce pixel math (do mirroring in camera module) also add some more analytics output --- services/bao-video/Cargo.toml | 2 +- services/bao-video/src/main.rs | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/services/bao-video/Cargo.toml b/services/bao-video/Cargo.toml index 0514ac3b5..10e6ae1f7 100644 --- a/services/bao-video/Cargo.toml +++ b/services/bao-video/Cargo.toml @@ -59,7 +59,7 @@ cramium-soc = ["utralib/cramium-soc", "blitstr2/cramium-soc"] decongest-udma = [] b64-export = ["base64"] default = [ - # "b64-export", + "b64-export", # "decongest-udma", # "autotest", # "gfx-testing", diff --git a/services/bao-video/src/main.rs b/services/bao-video/src/main.rs index 85e8aac5c..fd2bf1a5b 100644 --- a/services/bao-video/src/main.rs +++ b/services/bao-video/src/main.rs @@ -346,10 +346,8 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! { // vertically. for (y_src, line) in fb.chunks(IMAGE_WIDTH / 2).enumerate() { for (x_src, &u32src) in line.iter().enumerate() { - frame[(IMAGE_HEIGHT - y_src - 1) * IMAGE_WIDTH + 2 * x_src] = - ((u32src >> 8) & 0xff) as u8; - frame[(IMAGE_HEIGHT - y_src - 1) * IMAGE_WIDTH + 2 * x_src + 1] = - ((u32src >> 24) & 0xff) as u8; + frame[y_src * IMAGE_WIDTH + 2 * x_src] = ((u32src >> 8) & 0xff) as u8; + frame[y_src * IMAGE_WIDTH + 2 * x_src + 1] = ((u32src >> 24) & 0xff) as u8; } } frames += 1; @@ -578,6 +576,22 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! { } } else { log::info!("Transformed image did not survive sanity check!"); + #[cfg(feature = "b64-export")] + { + println!("begin orig base 64"); + for block in original.chunks(16384) { + let encoded = encode_base64(block); + println!("{}", encoded); + } + println!("end orig base 64"); + println!("begin base 64"); + for block in frame.chunks(16384) { + let encoded = encode_base64(block); + println!("{}", encoded); + } + println!("end base 64"); + } + gfx::msg( &mut display, "Hold device steady...", @@ -630,9 +644,9 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! { // to allow capture to process concurrently with the code. However, there is a bug // in the SPIM block that prevents proper usage with high bus contention that should // be fixed in NTO. - const TIMEOUT_MS: u64 = 100; #[cfg(feature = "decongest-udma")] { + const TIMEOUT_MS: u64 = 100; let start = tt.elapsed_ms(); let mut now = tt.elapsed_ms(); // this is required because if we initiate the capture in the middle