"""Utility functions for track module."""from__future__importannotations
[docs]defsplit_key_ref_indices(keyframes:list[list[bool]],)->tuple[int,list[int]]:"""Get key frame from list of sample attributes."""key_ind=Noneref_inds=[]fori,is_keysinenumerate(keyframes):assertall(is_keys[0]==is_keyforis_keyinis_keys),"Same batch should have the same view."ifis_keys[0]:key_ind=ielse:ref_inds.append(i)assertkey_indisnotNone,"Key frame not found."assertlen(ref_inds)>0,"No reference frames found."returnkey_ind,ref_inds