Skip to content

Commit

Permalink
struct Rav1dTaskContext: Remove Rav1dFrameData pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
rinon committed Feb 16, 2024
1 parent f54ef66 commit 2cbf114
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
7 changes: 1 addition & 6 deletions src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,6 @@ impl Rav1dTaskContext_task_thread {

#[repr(C)]
pub(crate) struct Rav1dTaskContext {
pub f: *mut Rav1dFrameData,
pub ts: *mut Rav1dTileState,
pub bx: c_int,
pub by: c_int,
Expand Down Expand Up @@ -762,12 +761,8 @@ pub(crate) struct Rav1dTaskContext {
}

impl Rav1dTaskContext {
pub(crate) unsafe fn new(
f: *mut Rav1dFrameData,
task_thread: Arc<Rav1dTaskContext_task_thread>,
) -> Self {
pub(crate) unsafe fn new(task_thread: Arc<Rav1dTaskContext_task_thread>) -> Self {
Self {
f,
ts: ptr::null_mut(),
bx: 0,
by: 0,
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ pub(crate) unsafe fn rav1d_open(c_out: &mut *mut Rav1dContext, s: &Rav1dSettings
} else {
Rav1dContextTaskThread {
task: Rav1dContextTaskType::Single(Mutex::new(Box::new(
Rav1dTaskContext::new(&mut *((*c).fc).offset(0), Arc::clone(&thread_data)),
Rav1dTaskContext::new(Arc::clone(&thread_data)),
))),
thread_data,
}
Expand Down
6 changes: 1 addition & 5 deletions src/thread_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -790,10 +790,7 @@ unsafe fn delayed_fg_task<'l, 'ttd: 'l>(
}

pub unsafe fn rav1d_worker_task(c: &Rav1dContext, task_thread: Arc<Rav1dTaskContext_task_thread>) {
let mut tc = Rav1dTaskContext::new(
&mut *((*c).fc).offset(0) as *mut Rav1dFrameData,
task_thread,
);
let mut tc = Rav1dTaskContext::new(task_thread);

// We clone the Arc here for the lifetime of this function to avoid an
// immutable borrow of tc across the call to park
Expand Down Expand Up @@ -1016,7 +1013,6 @@ pub unsafe fn rav1d_worker_task(c: &Rav1dContext, task_thread: Arc<Rav1dTaskCont
let mut error_0 = f.task_thread.error.fetch_or(flush, Ordering::SeqCst) | flush;

// run it
tc.f = f;
let mut sby = t.sby;
let mut task_type = t.type_0 as c_uint;
'fallthrough: loop {
Expand Down

0 comments on commit 2cbf114

Please sign in to comment.