Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions crates/coreav-kernels-hevc/src/inter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,7 @@ fn interpolate(
rows: [[0; 64]; 8],
};
let source_width = output.width + x_filter.len().saturating_sub(1);
let consecutive = config.depth.bits() == 8
&& x_start >= 0
&& x_start + source_width as i64 <= reference.width as i64;
let consecutive = x_start >= 0 && x_start + source_width as i64 <= reference.width as i64;
if !consecutive {
for (x, column) in scratch.columns.iter_mut().take(source_width).enumerate() {
*column = (x_start + x as i64).clamp(0, reference.width as i64 - 1) as usize;
Expand Down
8 changes: 5 additions & 3 deletions docs/design/hevc-reference-row-borrows.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# HEVC eight-bit reference-row borrows
# HEVC reference-row borrows

The interpolator checks its entire clipped reference support before writing output. It then gathers each source row through a clamped column map into a temporary buffer, even when the horizontal support lies entirely inside the coded picture.

For eight-bit input with an interior horizontal support, borrow the consecutive source samples directly. Construct the column map and gather only for the existing boundary-replication path. Ten-bit reconstruction keeps that path unchanged. The AVX2 kernels, scalar filter arithmetic, horizontal and vertical shifts, intermediate row ring, output writes and scratch accounting do not change.
For either supported sample depth with an interior horizontal support, borrow the consecutive source samples directly. Construct the column map and gather only for the existing boundary-replication path. The AVX2 kernels, scalar filter arithmetic, horizontal and vertical shifts, intermediate row ring, output writes and scratch accounting do not change.

H.265 clause 8.5.3.3.3 and Tables 8-8 and 8-9 define consecutive taps within a row. If `x_start >= 0` and `x_start + source_width <= reference.width`, every previously gathered index is exactly `x_start + x`. A checked source slice therefore supplies the identical samples in the identical order. The existing full-support depth check still precedes both paths. Taps with zero coefficients remain part of the checked support.

The support calculation remains shared with scheduling. This change only consumes the resulting start coordinate and filter extent inside the kernel. Picture-edge replication, extreme signed motion vectors, invalid samples and output padding preserve their existing behavior. No new unsafe site or scratch allocation is needed.

The preceding diagnostic compares only removal of the interior column-map and gather copies, without deleting filter arithmetic. It checks both exact decoder arms against the qualified oracle before whole-process instruction counts. Those counts motivate this bounded change but are not a wall-time speed claim. Main10 remains a separate follow-up.
Main10 samples still enter the identical `u16` filter input, and the existing horizontal shift by two and vertical shift by six remain unchanged. Borrowing rather than copying cannot change their values, intermediate range or operation order. The full clipped support is checked against the depth's maximum before either path starts.

The preceding diagnostics compare only removal of the interior column-map and gather copies, without deleting filter arithmetic. They check both exact decoder arms against the qualified oracle before whole-process instruction counts. A Main10-only comparison keeps eight-bit input on its original path. Those counts motivate this bounded change but are not a wall-time speed claim.
Loading