+
    œ°³jÝ  ã                   óÀ   € R t ^ RIt^ RIHu Hu Ht ^RIHt ^RI	H
t
HtHtHt ^RIHtHt ^RIHt ^RIHt ^RIHtHtHt  ! R R	]R
R7      t ! R R]4      tR.tR# )z(Fast Video processor class for InternVL.N)ÚBatchFeature)ÚOPENAI_CLIP_MEANÚOPENAI_CLIP_STDÚPILImageResamplingÚSizeDict)ÚUnpackÚVideosKwargs)Ú
TensorType)ÚBaseVideoProcessor)ÚVideoMetadataÚgroup_videos_by_shapeÚreorder_videosc                   ó,   a € ] tR t^t o V 3R ltRtV tR# )Ú InternVLVideoProcessorInitKwargsc                óF   <€ V ^8„  d   Qh/ S[ S[,          S[,          ;R&   # )é   Úinitial_shift)ÚboolÚfloatÚint)ÚformatÚ__classdict__s   "€Úw/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/internvl/video_processing_internvl.pyÚ__annotate__Ú-InternVLVideoProcessorInitKwargs.__annotate__   s   ø‡ ‚ Ù™%•<¡#Õ%Ñ%ò ó    © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__)r   s   @r   r   r      s   ø‡ ‡ „ r   r   F)Útotalc                   ó²   a a€ ] tR t^t o]P
                  t]t]	t
RRRR/tRtRtRtRtRtRt]tV3R lV 3R lltRV3R lR	 lltRV3R
 lR lltRtVtV ;t# )ÚInternVLVideoProcessorÚheighti€  ÚwidthTFc                ó0   <€ V ^8„  d   QhRS[ S[,          /# )r   Úkwargs)r   r   )r   r   s   "€r   r   Ú#InternVLVideoProcessor.__annotate__,   s   ø€ ÷ #ñ #¡Ñ(HÕ!Iñ #r   c                ó(   <€ \         SV `  ! R/ VB  R # )Nr   )ÚsuperÚ__init__)Úselfr*   Ú	__class__s   &,€r   r.   ÚInternVLVideoProcessor.__init__,   s   ø€ Ü‰ÒÑ"˜6Ô"r   c          	      óŒ   <€ V ^8„  d   QhRS[ RS[R,          RS[S[,          R,          RS[S[,          S[,          R,          /# )r   ÚmetadataÚ
num_framesNÚfpsr   )r   r   r   r   )r   r   s   "€r   r   r+   /   sN   ø€ ÷ 1ñ 1áð1ñ ˜$•Jð1ñ ‘5�[˜4Õð	1ñ
 ™e•|¡cÕ)¨DÕ0ñ1r   c                ó¤  € Ve   TMV P                   pVe   TMV P                  pVP                  pVfD   Ve@   Ve   VP                  f   \	        R4      h\        WaP                  ,          V,          4      pVRJ d   Wb,          ^,          pW&8”  d   \	        RV RV R24      h\        P                  ! WFWb,          4      P                  4       pV# )a“  
Default sampling function which uniformly samples the desired number of frames between 0 and total number of frames.
If `fps` is passed along with metadata, `fps` frames per second are sampled uniformly. Arguments `num_frames`
and `fps` are mutually exclusive.

Args:
    metadata (`VideoMetadata`):
        Metadata of the video containing information about total duration, fps and total number of frames.
    num_frames (`int`, *optional*):
        Maximum number of frames to sample. Defaults to `self.num_frames`.
    fps (`int` or `float`, *optional*):
        Target frames to sample per second. Defaults to `self.fps`.
    initial_shift (`bool`, `float` or `int`, defaults to `self.initial_shift`):
        The initial shift to apply when sampling frames. If `True`, the shift is set so that frames are sampled from the middle of the video.

Returns:
    np.ndarray:
        Indices to sample video frames.
zÈAsked to sample `fps` frames per second but no video metadata was provided which is required when sampling with `fps`. Please pass in `VideoMetadata` object or use a fixed `num_frames` per input videoTz(Video can't be sampled. The `num_frames=z` exceeds `total_num_frames=z`. )r4   r   Útotal_num_framesr5   Ú
ValueErrorr   ÚtorchÚarange)r/   r3   r4   r5   r   r*   r7   Úindicess   &&&&&,  r   Úsample_framesÚ$InternVLVideoProcessor.sample_frames/   sÛ   € ð6 $.Ò#9‘Z¸t¿¹ˆ
Ø)6Ò)B™È×HZÑHZˆØ#×4Ñ4Ðð Ò #¢/ØÒ 8§<¡<Ò#7Ü ðhóð ô Ð-·±Õ<¸sÕBÓCˆJà˜DÓ Ø,Õ9¸AÕ=ˆMàÔ(ÜØ:¸:¸,ÐFbÐcsÐbtÐtwÐxóð ô —,’,˜}Ð@PÕ@]Ó^×bÑbÓdˆØˆr   c                óô   <€ V ^8„  d   QhRS[ R,          RS[RS[RS[RRRS[R	S[R
S[RS[RS[RS[S[ S[,          ,          R,          RS[S[ S[,          ,          R,          RS[S[,          R,          RS[/# )r   Úvideosztorch.TensorÚdo_convert_rgbÚ	do_resizeÚsizeÚresamplez7PILImageResampling | tvF.InterpolationMode | int | NoneÚdo_center_cropÚ	crop_sizeÚ
do_rescaleÚrescale_factorÚdo_normalizeÚ
image_meanNÚ	image_stdÚreturn_tensorsÚreturn)Úlistr   r   r   Ústrr	   r   )r   r   s   "€r   r   r+   b   sÓ   ø€ ÷ +hñ +há�^Õ$ð+hñ ð+hñ ð	+hñ
 ð+hð Lð+hñ ð+hñ ð+hñ ð+hñ ð+hñ ð+hñ ™D¡�KÕ'¨$Õ.ð+hñ ™4¡�;Õ&¨Õ-ð+hñ ™jÕ(¨4Õ/ð+hñ  
ñ!+hr   c           	     óÐ  € \        V4      w  pp/ pVP                  4        F?  w  ppV'       d   V P                  V4      pV'       d   V P                  VWER 7      pVVV&   KA  	  \	        VV4      p\        V4      w  pp/ pVP                  4        F9  w  ppV'       d   V P                  VV4      pV P                  VW‰W«V4      pVVV&   K;  	  \	        VV4      p\        RV/VR7      # ))rB   rC   Úpixel_values_videos)ÚdataÚtensor_type)r   ÚitemsÚconvert_to_rgbÚresizer   Úcenter_cropÚrescale_and_normalizer   )r/   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   r*   Úgrouped_videosÚgrouped_videos_indexÚresized_videos_groupedÚshapeÚstacked_videosÚresized_videosÚprocessed_videos_groupedÚprocessed_videoss   &&&&&&&&&&&&&&,        r   Ú_preprocessÚ"InternVLVideoProcessor._preprocessb   s	  € ô$ 0EÀVÓ/LÑ,ˆÐ,Ø!#ÐØ%3×%9Ñ%9Ö%;Ñ!ˆE�>ßØ!%×!4Ñ!4°^Ó!D�ßØ!%§¡¨^À$ Ó!Z�Ø,:Ð" 5Ó)ñ &<ô (Ð(>Ð@TÓUˆô 0EÀ^Ó/TÑ,ˆÐ,Ø#%Ð Ø%3×%9Ñ%9Ö%;Ñ!ˆE�>ßØ!%×!1Ñ!1°.À)Ó!L�à!×7Ñ7Ø 
¸LÐV_óˆNð /=Ð$ UÓ+ñ &<ô *Ð*BÐDXÓYÐäÐ"7Ð9IÐ!JÐXfÔgÐgr   r   )NNN)N)r   r   r   r    r   ÚBICUBICrC   r   rI   r   rJ   rB   rA   rF   rH   r@   r   Údo_sample_framesr   Úvalid_kwargsr.   r<   r`   r"   r#   Ú__classcell__)r0   r   s   @@r   r&   r&      ss   ù‡ € Ø!×)Ñ)€HØ!€JØ€IØ�c˜7 CÐ(€DØ€IØ€JØ€LØ€NØ€MØÐØ3€L÷#ó #÷1ò 1÷f+h÷ +hò +hr   r&   )Ú__doc__r9   Ú$torchvision.transforms.v2.functionalÚ
transformsÚv2Ú
functionalÚtvFÚimage_processing_utilsr   Úimage_utilsr   r   r   r   Úprocessing_utilsr   r   Úutilsr	   Úvideo_processing_utilsr
   Úvideo_utilsr   r   r   r   r&   Ú__all__r   r   r   Ú<module>rs      sU   ðñ /ã ß 2Ó 2å 2ß ZÓ Zß 4Ý Ý 8ß OÑ Oô& |¸5õ &ônhÐ/ô nhðb $Ð
$‚r   