@@ -3922,7 +3922,7 @@ unsafe fn setup_tile(
39223922 ts. lr_ref [ p] = * lr_ref;
39233923 }
39243924
3925- if c. n_tc > 1 {
3925+ if c. tc . len ( ) > 1 {
39263926 ts. progress . fill_with ( || AtomicI32 :: new ( row_sb_start) ) ;
39273927 }
39283928}
@@ -4071,7 +4071,7 @@ pub(crate) unsafe fn rav1d_decode_tile_sbrow(
40714071 t. frame_thread . pass ,
40724072 ) ;
40734073 if t. frame_thread . pass == 2 {
4074- let off_2pass = if c. n_tc > 1 {
4074+ let off_2pass = if c. tc . len ( ) > 1 {
40754075 f. sb128w * frame_hdr. tiling . rows
40764076 } else {
40774077 0
@@ -4097,7 +4097,7 @@ pub(crate) unsafe fn rav1d_decode_tile_sbrow(
40974097 return Err ( ( ) ) ;
40984098 }
40994099
4100- if c. n_tc > 1 && frame_hdr. use_ref_frame_mvs != 0 {
4100+ if c. tc . len ( ) > 1 && frame_hdr. use_ref_frame_mvs != 0 {
41014101 c. refmvs_dsp . load_tmvs . expect ( "non-null function pointer" ) (
41024102 & f. rf ,
41034103 ts. tiling . row ,
@@ -4197,7 +4197,7 @@ pub(crate) unsafe fn rav1d_decode_tile_sbrow(
41974197 }
41984198 }
41994199
4200- if seq_hdr. ref_frame_mvs != 0 && c. n_tc > 1 && frame_hdr. frame_type . is_inter_or_switch ( ) {
4200+ if seq_hdr. ref_frame_mvs != 0 && c. tc . len ( ) > 1 && frame_hdr. frame_type . is_inter_or_switch ( ) {
42014201 rav1d_refmvs_save_tmvs (
42024202 & c. refmvs_dsp ,
42034203 & mut t. rt ,
@@ -4282,7 +4282,7 @@ pub(crate) unsafe fn rav1d_decode_frame_init(
42824282 f. n_ts = n_ts;
42834283 }
42844284
4285- let a_sz = f. sb128w * frame_hdr. tiling . rows * ( 1 + ( c. n_fc > 1 && c. n_tc > 1 ) as c_int ) ;
4285+ let a_sz = f. sb128w * frame_hdr. tiling . rows * ( 1 + ( c. n_fc > 1 && c. tc . len ( ) > 1 ) as c_int ) ;
42864286 if a_sz != f. a_sz {
42874287 freep ( & mut f. a as * mut * mut BlockContext as * mut c_void ) ;
42884288 f. a = malloc ( :: core:: mem:: size_of :: < BlockContext > ( ) * a_sz as usize ) as * mut BlockContext ;
@@ -4401,7 +4401,7 @@ pub(crate) unsafe fn rav1d_decode_frame_init(
44014401 let mut y_stride = f. cur . stride [ 0 ] ;
44024402 let mut uv_stride = f. cur . stride [ 1 ] ;
44034403 let has_resize = ( frame_hdr. size . width [ 0 ] != frame_hdr. size . width [ 1 ] ) as c_int ;
4404- let need_cdef_lpf_copy = ( c. n_tc > 1 && has_resize != 0 ) as c_int ;
4404+ let need_cdef_lpf_copy = ( c. tc . len ( ) > 1 && has_resize != 0 ) as c_int ;
44054405 if y_stride * f. sbh as isize * 4 != f. lf . cdef_buf_plane_sz [ 0 ] as isize
44064406 || uv_stride * f. sbh as isize * 8 != f. lf . cdef_buf_plane_sz [ 1 ] as isize
44074407 || need_cdef_lpf_copy != f. lf . need_cdef_lpf_copy
@@ -4473,7 +4473,11 @@ pub(crate) unsafe fn rav1d_decode_frame_init(
44734473 }
44744474
44754475 let sb128 = seq_hdr. sb128 ;
4476- let num_lines = if c. n_tc > 1 { ( f. sbh * 4 ) << sb128 } else { 12 } ;
4476+ let num_lines = if c. tc . len ( ) > 1 {
4477+ ( f. sbh * 4 ) << sb128
4478+ } else {
4479+ 12
4480+ } ;
44774481 y_stride = f. sr_cur . p . stride [ 0 ] ;
44784482 uv_stride = f. sr_cur . p . stride [ 1 ] ;
44794483 if y_stride * num_lines as isize != f. lf . lr_buf_plane_sz [ 0 ] as isize
@@ -4607,7 +4611,7 @@ pub(crate) unsafe fn rav1d_decode_frame_init(
46074611 f. mvs ,
46084612 f. refrefpoc . as_ptr ( ) ,
46094613 f. ref_mvs . as_ptr ( ) ,
4610- c. n_tc as c_int ,
4614+ c. tc . len ( ) as c_int ,
46114615 c. n_fc as c_int ,
46124616 ) ;
46134617 if ret. is_err ( ) {
@@ -4756,7 +4760,7 @@ pub(crate) unsafe fn rav1d_decode_frame_init_cdf(
47564760 }
47574761 }
47584762
4759- if c. n_tc > 1 {
4763+ if c. tc . len ( ) > 1 {
47604764 for ( n, ctx) in slice:: from_raw_parts_mut ( f. a , sb128w * rows * ( 1 + uses_2pass as usize ) )
47614765 . iter_mut ( )
47624766 . enumerate ( )
@@ -4777,7 +4781,7 @@ pub(crate) unsafe fn rav1d_decode_frame_init_cdf(
47774781}
47784782
47794783unsafe fn rav1d_decode_frame_main ( c : & Rav1dContext , f : & mut Rav1dFrameContext ) -> Rav1dResult {
4780- assert ! ( c. n_tc == 1 ) ;
4784+ assert ! ( c. tc . len ( ) == 1 ) ;
47814785
47824786 let Rav1dContextTaskType :: Single ( t) = & c. tc [ 0 ] . task else {
47834787 panic ! ( "Expected a single-threaded context" ) ;
@@ -4891,15 +4895,15 @@ pub(crate) unsafe fn rav1d_decode_frame(
48914895 f : & mut Rav1dFrameContext ,
48924896) -> Rav1dResult {
48934897 assert ! ( c. n_fc == 1 ) ;
4894- // if n_tc > 1 (but n_fc == 1), we could run init/exit in the task
4898+ // if.tc.len() > 1 (but n_fc == 1), we could run init/exit in the task
48954899 // threads also. Not sure it makes a measurable difference.
48964900 let mut res = rav1d_decode_frame_init ( c, f) ;
48974901 if res. is_ok ( ) {
48984902 res = rav1d_decode_frame_init_cdf ( c, f) ;
48994903 }
49004904 // wait until all threads have completed
49014905 if res. is_ok ( ) {
4902- if c. n_tc > 1 {
4906+ if c. tc . len ( ) > 1 {
49034907 res = rav1d_task_create_tile_sbrow ( c, f, 0 , 1 ) ;
49044908 let mut task_thread_lock = ( * f. task_thread . ttd ) . delayed_fg . lock ( ) . unwrap ( ) ;
49054909 ( * f. task_thread . ttd ) . cond . notify_one ( ) ;
0 commit comments