Skip to content

Commit

Permalink
const TILE_ERROR: Deduplicate.
Browse files Browse the repository at this point in the history
  • Loading branch information
kkysen committed Sep 6, 2023
1 parent 9866c66 commit 90cb4bf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
7 changes: 2 additions & 5 deletions src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::src::cdf::CdfMvContext;
use crate::src::ctx::CaseSet;
use crate::src::looprestoration::dav1d_loop_restoration_dsp_init;
use crate::src::thread_task::FRAME_ERROR;
use crate::src::thread_task::TILE_ERROR;

use libc;

Expand Down Expand Up @@ -5828,11 +5829,7 @@ pub unsafe extern "C" fn dav1d_decode_frame_exit(f: *mut Dav1dFrameContext, retv
if !f.out_cdf.progress.is_null() {
::core::intrinsics::atomic_store_seqcst(
f.out_cdf.progress,
if retval == 0 {
1
} else {
i32::MAX as libc::c_uint - 1
},
if retval == 0 { 1 } else { TILE_ERROR as u32 },
);
}
dav1d_cdf_thread_unref(&mut f.out_cdf);
Expand Down
26 changes: 13 additions & 13 deletions src/thread_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ use crate::include::common::attributes::ctz;
use crate::src::internal::ScalableMotionParams;

pub const FRAME_ERROR: u32 = u32::MAX - 1;
pub const TILE_ERROR: i32 = i32::MAX - 1;

#[inline]
unsafe extern "C" fn dav1d_set_thread_name(name: *const libc::c_char) {
Expand Down Expand Up @@ -1131,7 +1132,7 @@ unsafe extern "C" fn check_tile(
if p1 < (*t).sby {
return 1 as libc::c_int;
}
let mut error = (p1 == i32::MAX - 1) as libc::c_int;
let mut error = (p1 == TILE_ERROR) as libc::c_int;
error |= ::core::intrinsics::atomic_or_seqcst(&mut (*f).task_thread.error, error);
if error == 0 && frame_mt != 0 && tp == 0 {
let p2 = ::core::intrinsics::atomic_load_seqcst(
Expand All @@ -1140,7 +1141,7 @@ unsafe extern "C" fn check_tile(
if p2 <= (*t).sby {
return 1 as libc::c_int;
}
error = (p2 == i32::MAX - 1) as libc::c_int;
error = (p2 == TILE_ERROR) as libc::c_int;
error |= ::core::intrinsics::atomic_or_seqcst(&mut (*f).task_thread.error, error);
}
if error == 0
Expand Down Expand Up @@ -1509,7 +1510,7 @@ pub unsafe extern "C" fn dav1d_worker_task(data: *mut libc::c_void) -> *mut libc
if p1 != 0 {
::core::intrinsics::atomic_or_seqcst(
&mut (*f).task_thread.error,
(p1 == i32::MAX - 1) as libc::c_int,
(p1 == TILE_ERROR) as libc::c_int,
);
current_block = 7012560550443761033;
break;
Expand Down Expand Up @@ -1590,7 +1591,7 @@ pub unsafe extern "C" fn dav1d_worker_task(data: *mut libc::c_void) -> *mut libc
} else {
::core::intrinsics::atomic_or_seqcst(
&mut (*f).task_thread.error,
(p1_0 == i32::MAX - 1) as libc::c_int,
(p1_0 == TILE_ERROR) as libc::c_int,
);
current_block = 14832935472441733737;
}
Expand Down Expand Up @@ -1623,7 +1624,7 @@ pub unsafe extern "C" fn dav1d_worker_task(data: *mut libc::c_void) -> *mut libc
}
::core::intrinsics::atomic_or_seqcst(
&mut (*f).task_thread.error,
(p2 == i32::MAX - 1) as libc::c_int,
(p2 == TILE_ERROR) as libc::c_int,
);
tc_0 += 1;
}
Expand Down Expand Up @@ -1691,7 +1692,7 @@ pub unsafe extern "C" fn dav1d_worker_task(data: *mut libc::c_void) -> *mut libc
if p1_2 >= (*t).deblock_progress {
::core::intrinsics::atomic_or_seqcst(
&mut (*f).task_thread.error,
(p1_2 == i32::MAX - 1) as libc::c_int,
(p1_2 == TILE_ERROR) as libc::c_int,
);
current_block = 7012560550443761033;
continue 's_107;
Expand Down Expand Up @@ -1766,7 +1767,7 @@ pub unsafe extern "C" fn dav1d_worker_task(data: *mut libc::c_void) -> *mut libc
1 as libc::c_int as libc::c_uint
})
as libc::c_int;
if res != 0 || p1_3 == i32::MAX - 1 {
if res != 0 || p1_3 == TILE_ERROR {
pthread_mutex_lock(&mut (*ttd).lock);
abort_frame(
f,
Expand Down Expand Up @@ -1801,7 +1802,7 @@ pub unsafe extern "C" fn dav1d_worker_task(data: *mut libc::c_void) -> *mut libc
::core::intrinsics::atomic_store_seqcst(
(*f).out_cdf.progress,
(if res_0 < 0 {
i32::MAX - 1
TILE_ERROR
} else {
1 as libc::c_int
})
Expand Down Expand Up @@ -1911,8 +1912,7 @@ pub unsafe extern "C" fn dav1d_worker_task(data: *mut libc::c_void) -> *mut libc
if error_0 == 0 {
error_0 = dav1d_decode_tile_sbrow(tc);
}
let progress =
if error_0 != 0 { i32::MAX - 1 } else { 1 + sby };
let progress = if error_0 != 0 { TILE_ERROR } else { 1 + sby };
::core::intrinsics::atomic_or_seqcst(
&mut (*f).task_thread.error,
error_0,
Expand Down Expand Up @@ -1980,7 +1980,7 @@ pub unsafe extern "C" fn dav1d_worker_task(data: *mut libc::c_void) -> *mut libc
::core::intrinsics::atomic_store_seqcst(
(*f).out_cdf.progress,
(if error_0 != 0 {
i32::MAX - 1
TILE_ERROR
} else {
1 as libc::c_int
})
Expand Down Expand Up @@ -2107,7 +2107,7 @@ pub unsafe extern "C" fn dav1d_worker_task(data: *mut libc::c_void) -> *mut libc
);
::core::intrinsics::atomic_store_seqcst(
&mut (*f).frame_thread.deblock_progress,
if error_0 != 0 { i32::MAX - 1 } else { sby + 1 },
if error_0 != 0 { TILE_ERROR } else { sby + 1 },
);
reset_task_cur_async(ttd, (*t).frame_idx, (*c).n_fc);
if ::core::intrinsics::atomic_or_seqcst(
Expand Down Expand Up @@ -2234,7 +2234,7 @@ pub unsafe extern "C" fn dav1d_worker_task(data: *mut libc::c_void) -> *mut libc
}
::core::intrinsics::atomic_store_seqcst(
&mut (*f).frame_thread.entropy_progress,
if error_0 != 0 { i32::MAX - 1 } else { sby + 1 },
if error_0 != 0 { TILE_ERROR } else { sby + 1 },
);
if sby + 1 == sbh {
::core::intrinsics::atomic_store_seqcst(
Expand Down

0 comments on commit 90cb4bf

Please sign in to comment.