Skip to content

Commit 7344dae

Browse files
authored
Move bounds check out of loop in fwd_txfm2d_daala (#1851)
Provides a very minor performance improvement. In order to auto-vectorize, more bounds checks will need to be elided, which are more difficult to remove without unsafe code.
1 parent 8647508 commit 7344dae

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/transform/forward.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -1799,22 +1799,19 @@ trait FwdTxfm2D: Dim {
17991799
col_flip[r] = (input[r * stride + c]).into();
18001800
}
18011801
}
1802+
1803+
let output = &mut output[txfm_size_row..][..txfm_size_row];
18021804
av1_round_shift_array(col_flip, txfm_size_row, -cfg.shift[0]);
1803-
txfm_func_col(&col_flip, &mut output[txfm_size_row..]);
1804-
av1_round_shift_array(
1805-
&mut output[txfm_size_row..],
1806-
txfm_size_row,
1807-
-cfg.shift[1],
1808-
);
1805+
txfm_func_col(&col_flip, output);
1806+
av1_round_shift_array(output, txfm_size_row, -cfg.shift[1]);
18091807
if cfg.lr_flip {
18101808
for r in 0..txfm_size_row {
18111809
// flip from left to right
1812-
buf[r * txfm_size_col + (txfm_size_col - c - 1)] =
1813-
output[txfm_size_row + r];
1810+
buf[r * txfm_size_col + (txfm_size_col - c - 1)] = output[r];
18141811
}
18151812
} else {
18161813
for r in 0..txfm_size_row {
1817-
buf[r * txfm_size_col + c] = output[txfm_size_row + r];
1814+
buf[r * txfm_size_col + c] = output[r];
18181815
}
18191816
}
18201817
}

0 commit comments

Comments
 (0)