
    i
                         U d dl mZ d dlmZ ee   ee   z  ZdededefdZdededefdZ	dededefd	Z
eeegef   Zee	e
d
Zeeef   ed<   d ZdedededefdZdZy)    )Callable)
FrameBatchvaluesdesired_lenreturnc                 6    | | d   g|t        |       z
  z  z  } | S )Nlenr   r   s     p/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/torchcodec/samplers/_common.py_repeat_last_policyr      s'    
 vbzlkCK788FM    c                 0    | |t        |       z  dz   z  d | S )N   r
   r   s     r   _wrap_policyr      s$    
 kS[0145|DDr   frames_indicesc                     t        d      )NzYou set the 'error' policy, and the sampler tried to decode a frame that is beyond the number of frames in the video. Try to leave sampling_range_end to its default value?)
ValueError)r   r   s     r   _error_policyr      s     	@ r   )repeat_lastwraperror_POLICY_FUNCTIONSc                     t        |       dk  rt        dt        |        d      |dk  rt        d| d      |t        j                         vr$t        d| dt        j                          d	      y )
Nr   z,Decoder must have at least one frame, found z frames.r   znum_frames_per_clip (z) must be strictly positivezInvalid policy (z). Supported values are .)r   r   r   keys)decodernum_frames_per_clippolicys      r   _validate_common_paramsr!   ,   s    
7|a:3w<.Q
 	
 a#$7#88ST
 	
 &++--vh&>?P?U?U?W>XXYZ
 	
 .r   frames	num_clipsr   c                     | j                   j                  dd  }t         | j                   j                  ||g| | j                  j                  ||      | j
                  j                  ||            S )N)datapts_secondsduration_seconds)r&   shaper   viewr'   r(   )r"   r#   r   last_3_dimss       r   _reshape_4d_framebatch_into_5dr,   <   sq     ++##BC(KV[[i)<K{K&&++I7JK0055iATU r   a  
    Returns:
        FrameBatch:
            The sampled :term:`clips`, as a 5D :class:`~torchcodec.FrameBatch`.
            The shape of the ``data`` field is (``num_clips``,
            ``num_frames_per_clips``, ...) where ... is (H, W, C) or (C, H, W)
            depending on the ``dimension_order`` parameter of
            :class:`~torchcodec.decoders.VideoDecoder`. The shape of the
            ``pts_seconds`` and ``duration_seconds`` fields is (``num_clips``,
            ``num_frames_per_clips``).
N)collections.abcr   
torchcodecr   listintfloat_LIST_OF_INT_OR_FLOATr   r   r   _POLICY_FUNCTION_TYPEr   dictstr__annotations__r!   r,   _FRAMEBATCH_RETURN_DOCS r   r   <module>r9      s    $ !S	DK/ !03E!E03EE)8; !"7!=?T!TU  '7 4223 
   	
 
 r   