Skip to content

Commit

Permalink
looprestoration.rs: Cleanup in aarch64 functions (#1204)
Browse files Browse the repository at this point in the history
  • Loading branch information
randomPoison authored Jun 14, 2024
1 parent cb1bd86 commit 0022862
Showing 1 changed file with 64 additions and 64 deletions.
128 changes: 64 additions & 64 deletions src/looprestoration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2080,8 +2080,8 @@ unsafe fn sgr_finish_mix_neon<BD: BitDepth>(
) {
const FILTER_OUT_STRIDE: usize = 384;

let mut tmp5: Align16<[i16; 2 * FILTER_OUT_STRIDE]> = Align16([0; 2 * FILTER_OUT_STRIDE]);
let mut tmp3: Align16<[i16; 2 * FILTER_OUT_STRIDE]> = Align16([0; 2 * FILTER_OUT_STRIDE]);
let mut tmp5 = Align16([0; 2 * FILTER_OUT_STRIDE]);
let mut tmp3 = Align16([0; 2 * FILTER_OUT_STRIDE]);

rav1d_sgr_finish_filter2_2rows_neon(tmp5.0.as_mut_ptr(), *dst, A5_ptrs, B5_ptrs, w, h, bd);
rav1d_sgr_finish_filter1_2rows_neon(tmp3.0.as_mut_ptr(), *dst, A3_ptrs, B3_ptrs, w, h, bd);
Expand Down Expand Up @@ -2142,30 +2142,30 @@ unsafe fn sgr_filter_3x3_neon<BD: BitDepth>(

const BUF_STRIDE: usize = 384 + 16;

let mut sumsq_buf: Align16<[i32; BUF_STRIDE * 3 + 16]> = Align16([0; BUF_STRIDE * 3 + 16]);
let mut sum_buf: Align16<[i16; BUF_STRIDE * 3 + 16]> = Align16([0; BUF_STRIDE * 3 + 16]);
let mut sumsq_buf = Align16([0; BUF_STRIDE * 3 + 16]);
let mut sum_buf = Align16([0; BUF_STRIDE * 3 + 16]);

let mut sumsq_ptrs: [*mut i32; 3];
let mut sum_ptrs: [*mut i16; 3];
let mut sumsq_rows: [*mut i32; 3] = [0 as *mut i32; 3];
let mut sum_rows: [*mut i16; 3] = [0 as *mut i16; 3];
let mut sumsq_ptrs;
let mut sum_ptrs;
let mut sumsq_rows = [ptr::null_mut(); 3];
let mut sum_rows = [ptr::null_mut(); 3];
for i in 0..3 {
sumsq_rows[i] = (sumsq_buf.0[i * BUF_STRIDE..i * BUF_STRIDE + BUF_STRIDE]).as_mut_ptr();
sum_rows[i] = (sum_buf.0[i * BUF_STRIDE..i * BUF_STRIDE + BUF_STRIDE]).as_mut_ptr();
sumsq_rows[i] = sumsq_buf.0[i * BUF_STRIDE..][..BUF_STRIDE].as_mut_ptr();
sum_rows[i] = sum_buf.0[i * BUF_STRIDE..][..BUF_STRIDE].as_mut_ptr();
}

let mut A_buf: Align16<[i32; BUF_STRIDE * 3 + 16]> = Align16([0; BUF_STRIDE * 3 + 16]);
let mut B_buf: Align16<[i16; BUF_STRIDE * 3 + 16]> = Align16([0; BUF_STRIDE * 3 + 16]);
let mut A_buf = Align16([0; BUF_STRIDE * 3 + 16]);
let mut B_buf = Align16([0; BUF_STRIDE * 3 + 16]);

let mut A_ptrs: [*mut i32; 3] = [0 as *mut i32; 3];
let mut B_ptrs: [*mut i16; 3] = [0 as *mut i16; 3];
let mut A_ptrs = [ptr::null_mut(); 3];
let mut B_ptrs = [ptr::null_mut(); 3];
for i in 0..3 {
A_ptrs[i] = (A_buf.0[i * BUF_STRIDE..i * BUF_STRIDE + BUF_STRIDE]).as_mut_ptr();
B_ptrs[i] = (B_buf.0[i * BUF_STRIDE..i * BUF_STRIDE + BUF_STRIDE]).as_mut_ptr();
A_ptrs[i] = A_buf.0[i * BUF_STRIDE..][..BUF_STRIDE].as_mut_ptr();
B_ptrs[i] = B_buf.0[i * BUF_STRIDE..][..BUF_STRIDE].as_mut_ptr();
}

let mut src = dst;
let mut lpf_bottom: *const BD::Pixel = lpf.offset(6 * stride);
let mut lpf_bottom = lpf.offset(6 * stride);

#[derive(PartialEq)]
enum Track {
Expand Down Expand Up @@ -2412,30 +2412,30 @@ unsafe fn sgr_filter_5x5_neon<BD: BitDepth>(

const BUF_STRIDE: usize = 384 + 16;

let mut sumsq_buf: Align16<[i32; BUF_STRIDE * 5 + 16]> = Align16([0; BUF_STRIDE * 5 + 16]);
let mut sum_buf: Align16<[i16; BUF_STRIDE * 5 + 16]> = Align16([0; BUF_STRIDE * 5 + 16]);
let mut sumsq_buf = Align16([0; BUF_STRIDE * 5 + 16]);
let mut sum_buf = Align16([0; BUF_STRIDE * 5 + 16]);

let mut sumsq_ptrs: [*mut i32; 5] = [0 as *mut i32; 5];
let mut sum_ptrs: [*mut i16; 5] = [0 as *mut i16; 5];
let mut sumsq_rows: [*mut i32; 5] = [0 as *mut i32; 5];
let mut sum_rows: [*mut i16; 5] = [0 as *mut i16; 5];
let mut sumsq_ptrs = [ptr::null_mut(); 5];
let mut sum_ptrs = [ptr::null_mut(); 5];
let mut sumsq_rows = [ptr::null_mut(); 5];
let mut sum_rows = [ptr::null_mut(); 5];
for i in 0..5 {
sumsq_rows[i] = (sumsq_buf.0[i * BUF_STRIDE..i * BUF_STRIDE + BUF_STRIDE]).as_mut_ptr();
sum_rows[i] = (sum_buf.0[i * BUF_STRIDE..i * BUF_STRIDE + BUF_STRIDE]).as_mut_ptr();
sumsq_rows[i] = sumsq_buf.0[i * BUF_STRIDE..][..BUF_STRIDE].as_mut_ptr();
sum_rows[i] = sum_buf.0[i * BUF_STRIDE..][..BUF_STRIDE].as_mut_ptr();
}

let mut A_buf: Align16<[i32; BUF_STRIDE * 2 + 16]> = Align16([0; BUF_STRIDE * 2 + 16]);
let mut B_buf: Align16<[i16; BUF_STRIDE * 2 + 16]> = Align16([0; BUF_STRIDE * 2 + 16]);
let mut A_buf = Align16([0; BUF_STRIDE * 2 + 16]);
let mut B_buf = Align16([0; BUF_STRIDE * 2 + 16]);

let mut A_ptrs: [*mut i32; 2] = [0 as *mut i32; 2];
let mut B_ptrs: [*mut i16; 2] = [0 as *mut i16; 2];
let mut A_ptrs = [ptr::null_mut(); 2];
let mut B_ptrs = [ptr::null_mut(); 2];
for i in 0..2 {
A_ptrs[i] = (A_buf.0[i * BUF_STRIDE..i * BUF_STRIDE + BUF_STRIDE]).as_mut_ptr();
B_ptrs[i] = (B_buf.0[i * BUF_STRIDE..i * BUF_STRIDE + BUF_STRIDE]).as_mut_ptr();
A_ptrs[i] = A_buf.0[i * BUF_STRIDE..][..BUF_STRIDE].as_mut_ptr();
B_ptrs[i] = B_buf.0[i * BUF_STRIDE..][..BUF_STRIDE].as_mut_ptr();
}

let mut src = dst;
let mut lpf_bottom: *const BD::Pixel = lpf.offset(6 * stride);
let mut lpf_bottom = lpf.offset(6 * stride);

#[derive(PartialEq)]
enum Track {
Expand Down Expand Up @@ -2803,48 +2803,48 @@ unsafe fn sgr_filter_mix_neon<BD: BitDepth>(

const BUF_STRIDE: usize = 384 + 16;

let mut sumsq5_buf: Align16<[i32; BUF_STRIDE * 5 + 16]> = Align16([0; BUF_STRIDE * 5 + 16]);
let mut sum5_buf: Align16<[i16; BUF_STRIDE * 5 + 16]> = Align16([0; BUF_STRIDE * 5 + 16]);
let mut sumsq5_buf = Align16([0; BUF_STRIDE * 5 + 16]);
let mut sum5_buf = Align16([0; BUF_STRIDE * 5 + 16]);

let mut sumsq5_rows: [*mut i32; 5] = [0 as *mut i32; 5];
let mut sum5_rows: [*mut i16; 5] = [0 as *mut i16; 5];
let mut sumsq5_rows = [ptr::null_mut(); 5];
let mut sum5_rows = [ptr::null_mut(); 5];
for i in 0..5 {
sumsq5_rows[i] = (sumsq5_buf.0[i * BUF_STRIDE..i * BUF_STRIDE + BUF_STRIDE]).as_mut_ptr();
sum5_rows[i] = (sum5_buf.0[i * BUF_STRIDE..i * BUF_STRIDE + BUF_STRIDE]).as_mut_ptr();
sumsq5_rows[i] = sumsq5_buf.0[i * BUF_STRIDE..][..BUF_STRIDE].as_mut_ptr();
sum5_rows[i] = sum5_buf.0[i * BUF_STRIDE..][..BUF_STRIDE].as_mut_ptr();
}

let mut sumsq3_buf: Align16<[i32; BUF_STRIDE * 3 + 16]> = Align16([0; BUF_STRIDE * 3 + 16]);
let mut sum3_buf: Align16<[i16; BUF_STRIDE * 3 + 16]> = Align16([0; BUF_STRIDE * 3 + 16]);
let mut sumsq3_buf = Align16([0; BUF_STRIDE * 3 + 16]);
let mut sum3_buf = Align16([0; BUF_STRIDE * 3 + 16]);

let mut sumsq3_rows: [*mut i32; 3] = [0 as *mut i32; 3];
let mut sum3_rows: [*mut i16; 3] = [0 as *mut i16; 3];
let mut sumsq3_rows = [ptr::null_mut(); 3];
let mut sum3_rows = [ptr::null_mut(); 3];
for i in 0..3 {
sumsq3_rows[i] = (sumsq3_buf.0[i * BUF_STRIDE..i * BUF_STRIDE + BUF_STRIDE]).as_mut_ptr();
sum3_rows[i] = (sum3_buf.0[i * BUF_STRIDE..i * BUF_STRIDE + BUF_STRIDE]).as_mut_ptr();
sumsq3_rows[i] = sumsq3_buf.0[i * BUF_STRIDE..][..BUF_STRIDE].as_mut_ptr();
sum3_rows[i] = sum3_buf.0[i * BUF_STRIDE..][..BUF_STRIDE].as_mut_ptr();
}

let mut A5_buf: Align16<[i32; BUF_STRIDE * 2 + 16]> = Align16([0; BUF_STRIDE * 2 + 16]);
let mut B5_buf: Align16<[i16; BUF_STRIDE * 2 + 16]> = Align16([0; BUF_STRIDE * 2 + 16]);
let mut A5_buf = Align16([0; BUF_STRIDE * 2 + 16]);
let mut B5_buf = Align16([0; BUF_STRIDE * 2 + 16]);

let mut A5_ptrs: [*mut i32; 2] = [0 as *mut i32; 2];
let mut B5_ptrs: [*mut i16; 2] = [0 as *mut i16; 2];
let mut A5_ptrs = [ptr::null_mut(); 2];
let mut B5_ptrs = [ptr::null_mut(); 2];
for i in 0..2 {
A5_ptrs[i] = (A5_buf.0[i * BUF_STRIDE..i * BUF_STRIDE + BUF_STRIDE]).as_mut_ptr();
B5_ptrs[i] = (B5_buf.0[i * BUF_STRIDE..i * BUF_STRIDE + BUF_STRIDE]).as_mut_ptr();
A5_ptrs[i] = A5_buf.0[i * BUF_STRIDE..][..BUF_STRIDE].as_mut_ptr();
B5_ptrs[i] = B5_buf.0[i * BUF_STRIDE..][..BUF_STRIDE].as_mut_ptr();
}

let mut A3_buf: Align16<[i32; BUF_STRIDE * 4 + 16]> = Align16([0; BUF_STRIDE * 4 + 16]);
let mut B3_buf: Align16<[i16; BUF_STRIDE * 4 + 16]> = Align16([0; BUF_STRIDE * 4 + 16]);
let mut A3_buf = Align16([0; BUF_STRIDE * 4 + 16]);
let mut B3_buf = Align16([0; BUF_STRIDE * 4 + 16]);

let mut A3_ptrs: [*mut i32; 4] = [0 as *mut i32; 4];
let mut B3_ptrs: [*mut i16; 4] = [0 as *mut i16; 4];
let mut A3_ptrs = [ptr::null_mut(); 4];
let mut B3_ptrs = [ptr::null_mut(); 4];
for i in 0..4 {
A3_ptrs[i] = (A3_buf.0[i * BUF_STRIDE..i * BUF_STRIDE + BUF_STRIDE]).as_mut_ptr();
B3_ptrs[i] = (B3_buf.0[i * BUF_STRIDE..i * BUF_STRIDE + BUF_STRIDE]).as_mut_ptr();
A3_ptrs[i] = A3_buf.0[i * BUF_STRIDE..][..BUF_STRIDE].as_mut_ptr();
B3_ptrs[i] = B3_buf.0[i * BUF_STRIDE..][..BUF_STRIDE].as_mut_ptr();
}

let mut src = dst;
let mut lpf_bottom: *const BD::Pixel = lpf.offset(6 * stride);
let mut lpf_bottom = lpf.offset(6 * stride);

#[derive(PartialEq)]
enum Track {
Expand All @@ -2857,15 +2857,15 @@ unsafe fn sgr_filter_mix_neon<BD: BitDepth>(

let lr_have_top = (edges & LR_HAVE_TOP) != 0;

let mut sumsq3_ptrs: [*mut i32; 3] = [0 as *mut i32; 3];
let mut sum3_ptrs: [*mut i16; 3] = [0 as *mut i16; 3];
let mut sumsq3_ptrs = [ptr::null_mut(); 3];
let mut sum3_ptrs = [ptr::null_mut(); 3];
for i in 0..3 {
sumsq3_ptrs[i] = sumsq3_rows[if lr_have_top { i } else { 0 }];
sum3_ptrs[i] = sum3_rows[if lr_have_top { i } else { 0 }];
}

let mut sumsq5_ptrs: [*mut i32; 5] = [0 as *mut i32; 5];
let mut sum5_ptrs: [*mut i16; 5] = [0 as *mut i16; 5];
let mut sumsq5_ptrs = [ptr::null_mut(); 5];
let mut sum5_ptrs = [ptr::null_mut(); 5];
for i in 0..5 {
sumsq5_ptrs[i] = sumsq5_rows[if lr_have_top && i > 0 { i - 1 } else { 0 }];
sum5_ptrs[i] = sum5_rows[if lr_have_top && i > 0 { i - 1 } else { 0 }];
Expand Down Expand Up @@ -3482,12 +3482,12 @@ unsafe fn sgr_filter_mix_neon<BD: BitDepth>(
) {
let w = w as c_int;
let h = h as c_int;
let mut tmp1: Align16<[i16; 24576]> = Align16([0; 24576]);
let mut tmp2: Align16<[i16; 24576]> = Align16([0; 24576]);
let mut tmp1 = Align16([0; 64 * 384]);
let mut tmp2 = Align16([0; 64 * 384]);
let sgr = params.sgr();
rav1d_sgr_filter2_neon(&mut tmp1.0, dst, left, lpf, w, h, sgr.s0, edges, bd);
rav1d_sgr_filter1_neon(&mut tmp2.0, dst, left, lpf, w, h, sgr.s1, edges, bd);
let wt: [i16; 2] = [sgr.w0, sgr.w1];
let wt = [sgr.w0, sgr.w1];
rav1d_sgr_weighted2_neon(dst, dst, &mut tmp1.0, &mut tmp2.0, w, h, &wt, bd);
}

Expand Down

0 comments on commit 0022862

Please sign in to comment.