update for shared state and improved performance

This commit is contained in:
Henry Schimke
2023-01-02 16:38:05 -06:00
parent 72f69dd6a0
commit 65f7c4d01b
46 changed files with 505 additions and 359 deletions

View File

@@ -248,7 +248,7 @@ impl PlanarYUVLuminanceSource {
}
impl LuminanceSource for PlanarYUVLuminanceSource {
fn getRow(&self, y: usize, row: &Vec<u8>) -> Vec<u8> {
fn getRow(&self, y: usize) -> Vec<u8> {
if y >= self.getHeight() {
//throw new IllegalArgumentException("Requested row is outside the image: " + y);
panic!("Requested row is outside the image: {}", y);
@@ -257,11 +257,7 @@ impl LuminanceSource for PlanarYUVLuminanceSource {
let offset = (y + self.top) * self.data_width + self.left;
let mut row = if row.len() >= width {
row.to_vec()
} else {
vec![0; width]
};
let mut row = vec![0; width];
row[..width].clone_from_slice(&self.yuv_data[offset..width + offset]);
//System.arraycopy(yuvData, offset, row, 0, width);