Skip to content
Open
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: 2 additions & 2 deletions include/dav1d/picture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use crate::include::dav1d::headers::Rav1dPixelLayout;
use crate::include::dav1d::headers::Rav1dSequenceHeader;
use crate::src::assume::assume;
use crate::src::c_arc::RawArc;
use crate::src::cursor::Cursor;
use crate::src::disjoint_mut::AsMutPtr;
use crate::src::disjoint_mut::DisjointImmutGuard;
use crate::src::disjoint_mut::DisjointMut;
Expand All @@ -29,7 +30,6 @@ use crate::src::error::Rav1dResult;
use crate::src::pixels::Pixels;
use crate::src::send_sync_non_null::SendSyncNonNull;
use crate::src::strided::Strided;
use crate::src::with_offset::WithOffset;
use libc::ptrdiff_t;
use libc::uintptr_t;
use std::array;
Expand Down Expand Up @@ -351,7 +351,7 @@ impl Rav1dPictureDataComponent {
}
}

pub type Rav1dPictureDataComponentOffset<'a> = WithOffset<&'a Rav1dPictureDataComponent>;
pub type Rav1dPictureDataComponentOffset<'a> = Cursor<&'a Rav1dPictureDataComponent>;

impl<'a> Rav1dPictureDataComponentOffset<'a> {
#[inline] // Inline to see bounds checks in order to potentially elide them.
Expand Down
3 changes: 1 addition & 2 deletions lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub mod src {
mod const_fn;
pub mod cpu;
mod ctx;
mod cursor;
pub(crate) mod cursor;
mod data;
mod decode;
mod dequant_tables;
Expand All @@ -56,7 +56,6 @@ pub mod src {
pub(crate) mod relaxed_atomic;
pub mod send_sync_non_null;
pub(crate) mod strided;
pub(crate) mod with_offset;
pub(crate) mod wrap_fn_ptr;
// TODO(kkysen) Temporarily `pub(crate)` due to a `pub use` until TAIT.
mod extensions;
Expand Down
6 changes: 3 additions & 3 deletions src/cdef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ use crate::include::common::intops::iclip;
use crate::include::dav1d::picture::Rav1dPictureDataComponentOffset;
use crate::src::align::AlignedVec64;
use crate::src::cpu::CpuFlags;
use crate::src::cursor::Cursor;
use crate::src::disjoint_mut::DisjointMut;
use crate::src::ffi_safe::FFISafe;
use crate::src::pic_or_buf::PicOrBuf;
use crate::src::strided::Strided as _;
use crate::src::tables::dav1d_cdef_directions;
use crate::src::with_offset::WithOffset;
use crate::src::wrap_fn_ptr::wrap_fn_ptr;
use bitflags::bitflags;
use libc::ptrdiff_t;
Expand Down Expand Up @@ -60,8 +60,8 @@ wrap_fn_ptr!(pub unsafe extern "C" fn cdef(
_bottom: *const FFISafe<CdefBottom>,
) -> ());

pub type CdefTop<'a> = WithOffset<&'a DisjointMut<AlignedVec64<u8>>>;
pub type CdefBottom<'a> = WithOffset<PicOrBuf<'a, AlignedVec64<u8>>>;
pub type CdefTop<'a> = Cursor<&'a DisjointMut<AlignedVec64<u8>>>;
pub type CdefBottom<'a> = Cursor<PicOrBuf<'a, AlignedVec64<u8>>>;

impl cdef::Fn {
/// CDEF operates entirely on pre-filter data.
Expand Down
38 changes: 19 additions & 19 deletions src/cdef_apply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ use crate::include::dav1d::picture::Rav1dPictureDataComponentOffset;
use crate::src::align::Align16;
use crate::src::align::AlignedVec64;
use crate::src::cdef::CdefEdgeFlags;
use crate::src::cursor::Cursor;
use crate::src::disjoint_mut::DisjointMut;
use crate::src::internal::Rav1dContext;
use crate::src::internal::Rav1dFrameData;
use crate::src::internal::Rav1dTaskContext;
use crate::src::pic_or_buf::PicOrBuf;
use crate::src::strided::Strided as _;
use crate::src::strided::WithStride;
use crate::src::with_offset::WithOffset;
use bitflags::bitflags;
use libc::ptrdiff_t;
use std::cmp;
Expand Down Expand Up @@ -271,43 +271,43 @@ pub(crate) fn rav1d_cdef_brow<BD: BitDepth>(
None
} else if sbrow_start && by == by_start {
let top = if resize {
WithOffset {
Cursor {
data: &f.lf.cdef_line_buf,
offset: f.lf.cdef_lpf_line[0],
} + ((sby - 1) * 4) as isize * y_stride
+ (bx * 4) as isize
} else {
WithOffset {
Cursor {
data: &f.lf.lr_line_buf,
offset: f.lf.lr_lpf_line[0],
} + (sby * (4 << sb128) - 4) as isize * y_stride
+ (bx * 4) as isize
};
let bottom = bptrs[0] + (8 * y_stride);
Some((top, WithOffset::pic(bottom)))
Some((top, Cursor::pic(bottom)))
} else if !sbrow_start && by + 2 >= by_end {
let top = WithOffset {
let top = Cursor {
data: &f.lf.cdef_line_buf,
offset: f.lf.cdef_line[tf as usize][0],
} + (sby * 4) as isize * y_stride
+ (bx * 4) as isize;
let buf = if resize {
WithOffset {
Cursor {
data: &f.lf.cdef_line_buf,
offset: f.lf.cdef_lpf_line[0],
} + (sby * 4 + 2) as isize * y_stride
+ (bx * 4) as isize
} else {
let line = sby * (4 << sb128) + 4 * sb128 as c_int + 2;
WithOffset {
Cursor {
data: &f.lf.lr_line_buf,
offset: f.lf.lr_lpf_line[0],
} + line as isize * y_stride
+ (bx * 4) as isize
};
Some((
top,
WithOffset {
Cursor {
data: PicOrBuf::Buf(WithStride {
buf: buf.data,
stride: y_stride,
Expand All @@ -320,13 +320,13 @@ pub(crate) fn rav1d_cdef_brow<BD: BitDepth>(
};

let (top, bot) = top_bot.unwrap_or_else(|| {
let top = WithOffset {
let top = Cursor {
data: &f.lf.cdef_line_buf,
offset: f.lf.cdef_line[tf as usize][0],
} + have_tt as isize * (sby * 4) as isize * y_stride
+ (bx * 4) as isize;
let bottom = bptrs[0] + (8 * y_stride);
(top, WithOffset::pic(bottom))
(top, Cursor::pic(bottom))
});

if y_pri_lvl != 0 {
Expand Down Expand Up @@ -373,44 +373,44 @@ pub(crate) fn rav1d_cdef_brow<BD: BitDepth>(
None
} else if sbrow_start && by == by_start {
let top = if resize {
WithOffset {
Cursor {
data: &f.lf.cdef_line_buf,
offset: f.lf.cdef_lpf_line[pl],
} + ((sby - 1) * 4) as isize * uv_stride
+ (bx * 4 >> ss_hor) as isize
} else {
let line = sby * (4 << sb128) - 4;
WithOffset {
Cursor {
data: &f.lf.lr_line_buf,
offset: f.lf.lr_lpf_line[pl],
} + line as isize * uv_stride
+ (bx * 4 >> ss_hor) as isize
};
let bottom = bptrs[pl] + ((8 >> ss_ver) * uv_stride);
Some((top, WithOffset::pic(bottom)))
Some((top, Cursor::pic(bottom)))
} else if !sbrow_start && by + 2 >= by_end {
let top = WithOffset {
let top = Cursor {
data: &f.lf.cdef_line_buf,
offset: f.lf.cdef_line[tf as usize][pl],
} + (sby * 8) as isize * uv_stride
+ (bx * 4 >> ss_hor) as isize;
let buf = if resize {
WithOffset {
Cursor {
data: &f.lf.cdef_line_buf,
offset: f.lf.cdef_lpf_line[pl],
} + (sby * 4 + 2) as isize * uv_stride
+ (bx * 4 >> ss_hor) as isize
} else {
let line = sby * (4 << sb128) + 4 * sb128 as c_int + 2;
WithOffset {
Cursor {
data: &f.lf.lr_line_buf,
offset: f.lf.lr_lpf_line[pl],
} + line as isize * uv_stride
+ (bx * 4 >> ss_hor) as isize
};
Some((
top,
WithOffset {
Cursor {
data: PicOrBuf::Buf(WithStride {
buf: buf.data,
stride: uv_stride,
Expand All @@ -423,13 +423,13 @@ pub(crate) fn rav1d_cdef_brow<BD: BitDepth>(
};

let (top, bot) = top_bot.unwrap_or_else(|| {
let top = WithOffset {
let top = Cursor {
data: &f.lf.cdef_line_buf,
offset: f.lf.cdef_line[tf as usize][pl],
} + have_tt as isize * (sby * 8) as isize * uv_stride
+ (bx * 4 >> ss_hor) as isize;
let bottom = bptrs[pl] + ((8 >> ss_ver) * uv_stride);
(top, WithOffset::pic(bottom))
(top, Cursor::pic(bottom))
});

f.dsp.cdef.fb[uv_idx as usize].call::<BD>(
Expand Down
Loading