@@ -317,17 +317,15 @@ unsafe fn create_filter_sbrow(
317
317
tasks. grow_tasks ( num_tasks) ;
318
318
let task_idx = Rav1dTaskIndex :: Task ( ( f. sbh * ( pass & 1 ) ) as usize ) ;
319
319
if pass & 1 != 0 {
320
- f. frame_thread_progress . entropy = AtomicI32 :: new ( 0 ) ;
320
+ f. frame_thread_progress . entropy . store ( 0 , Ordering :: Relaxed ) ;
321
321
} else {
322
322
let prog_sz = ( ( f. sbh + 31 & !( 31 as c_int ) ) >> 5 ) as usize ;
323
- f. frame_thread_progress . frame . clear ( ) ;
324
- f. frame_thread_progress
325
- . frame
326
- . resize_with ( prog_sz, || AtomicU32 :: new ( 0 ) ) ;
327
- f. frame_thread_progress . copy_lpf . clear ( ) ;
328
- f. frame_thread_progress
329
- . copy_lpf
330
- . resize_with ( prog_sz, || AtomicU32 :: new ( 0 ) ) ;
323
+ let mut frame = f. frame_thread_progress . frame . try_write ( ) . unwrap ( ) ;
324
+ frame. clear ( ) ;
325
+ frame. resize_with ( prog_sz, || AtomicU32 :: new ( 0 ) ) ;
326
+ let mut copy_lpf = f. frame_thread_progress . copy_lpf . try_write ( ) . unwrap ( ) ;
327
+ copy_lpf. clear ( ) ;
328
+ copy_lpf. resize_with ( prog_sz, || AtomicU32 :: new ( 0 ) ) ;
331
329
f. frame_thread_progress . deblock . store ( 0 , Ordering :: SeqCst ) ;
332
330
}
333
331
f. frame_thread . next_tile_row [ ( pass & 1 ) as usize ] . store ( 0 , Ordering :: Relaxed ) ;
@@ -559,15 +557,16 @@ unsafe fn get_frame_progress(f: &Rav1dFrameData) -> c_int {
559
557
}
560
558
let mut idx = ( frame_prog >> f. sb_shift + 7 ) as c_int ;
561
559
let mut prog;
560
+ let frame = f. frame_thread_progress . frame . try_read ( ) . unwrap ( ) ;
562
561
loop {
563
- let val: c_uint = !( f . frame_thread_progress . frame ) [ idx as usize ] . load ( Ordering :: SeqCst ) ;
562
+ let val: c_uint = !frame[ idx as usize ] . load ( Ordering :: SeqCst ) ;
564
563
prog = if val != 0 { ctz ( val) } else { 32 as c_int } ;
565
564
if prog != 32 as c_int {
566
565
break ;
567
566
}
568
567
prog = 0 as c_int ;
569
568
idx += 1 ;
570
- if !( ( idx as usize ) < f . frame_thread_progress . frame . len ( ) ) {
569
+ if !( ( idx as usize ) < frame. len ( ) ) {
571
570
break ;
572
571
}
573
572
}
@@ -871,7 +870,8 @@ pub unsafe fn rav1d_worker_task(c: &Rav1dContext, task_thread: Arc<Rav1dTaskCont
871
870
}
872
871
break ' found ( f, t_idx, prev_t) ;
873
872
} else if t. type_0 == TaskType :: Cdef {
874
- let p1_1 = f. frame_thread_progress . copy_lpf [ ( t. sby - 1 >> 5 ) as usize ]
873
+ let p1_1 = f. frame_thread_progress . copy_lpf . try_read ( ) . unwrap ( )
874
+ [ ( t. sby - 1 >> 5 ) as usize ]
875
875
. load ( Ordering :: SeqCst ) ;
876
876
if p1_1 as c_uint & ( 1 as c_uint ) << ( t. sby - 1 & 31 ) != 0 {
877
877
break ' found ( f, t_idx, prev_t) ;
@@ -1174,14 +1174,14 @@ pub unsafe fn rav1d_worker_task(c: &Rav1dContext, task_thread: Arc<Rav1dTaskCont
1174
1174
ttd. cond . notify_one ( ) ;
1175
1175
}
1176
1176
} else if seq_hdr. cdef != 0 || f. lf . restore_planes != 0 {
1177
- f. frame_thread_progress . copy_lpf [ ( sby >> 5 ) as usize ]
1177
+ let copy_lpf = f. frame_thread_progress . copy_lpf . try_read ( ) . unwrap ( ) ;
1178
+ copy_lpf[ ( sby >> 5 ) as usize ]
1178
1179
. fetch_or ( ( 1 as c_uint ) << ( sby & 31 ) , Ordering :: SeqCst ) ;
1179
1180
// CDEF needs the top buffer to be saved by lr_copy_lpf of the
1180
1181
// previous sbrow
1181
1182
if sby != 0 {
1182
- let prog_1 = f. frame_thread_progress . copy_lpf
1183
- [ ( sby - 1 >> 5 ) as usize ]
1184
- . load ( Ordering :: SeqCst ) ;
1183
+ let prog_1 =
1184
+ copy_lpf[ ( sby - 1 >> 5 ) as usize ] . load ( Ordering :: SeqCst ) ;
1185
1185
if !prog_1 as c_uint & ( 1 as c_uint ) << ( sby - 1 & 31 ) != 0 {
1186
1186
t. type_0 = TaskType :: Cdef ;
1187
1187
t. deblock_progress = 0 as c_int ;
@@ -1296,7 +1296,7 @@ pub unsafe fn rav1d_worker_task(c: &Rav1dContext, task_thread: Arc<Rav1dTaskCont
1296
1296
continue ' outer;
1297
1297
}
1298
1298
// t->type != DAV1D_TASK_TYPE_ENTROPY_PROGRESS
1299
- f. frame_thread_progress . frame [ ( sby >> 5 ) as usize ]
1299
+ f. frame_thread_progress . frame . try_read ( ) . unwrap ( ) [ ( sby >> 5 ) as usize ]
1300
1300
. fetch_or ( ( 1 as c_uint ) << ( sby & 31 ) , Ordering :: SeqCst ) ;
1301
1301
{
1302
1302
let _task_thread_lock = f. task_thread . lock . lock ( ) . unwrap ( ) ;
0 commit comments