
    3j                        S SK r S SKJr  S SKJr  S SKJr  \ R                  " \	\	" 5       5      r
\ R                  \ R                   " S S\5      5       5       r\ R                  \ R                   " S S5      5       5       rg)	    N)libav)SideData)	uintptr_tc                   t    \ rS rSrS\S\R                  4S jrS rS r	S\R                  4S jrS rS	 rS
rg)MotionVectors	   frameindexc                     [         R                  " XX#5        0 U l        U R                  R                  [
        R                  " [        R                  5      -  U l	        g N)
r   __init___vectorsptrsizecythonsizeoflibAVMotionVector_len)selfsentinelr	   r
   s       S/home/wildlama/miniconda3/lib/python3.13/site-packages/av/sidedata/motionvectors.pyr   MotionVectors.__init__   s<    $%7HHMMV]]33E3E%FF	    c           	          SU R                   R                   S[        U 5       S[        R                  " [
        U R                   R                  5      S S3$ )Nz<av.sidedata.MotionVectors z
 bytes of z vectors at 0x0x>)r   r   lenr   castr   datar   s    r   __repr__MotionVectors.__repr__   sJ    )$((-- 9d)N6;;y$((--+PQS*TTUW	
r   c                     U R                   $ r   )r   r!   s    r   __len__MotionVectors.__len__   s    yyr   c                      U R                   U   $ ! [         a     Of = fXR                  :  a  [        U5      e[	        [
        X5      =o R                   U'   U$ r   )r   KeyErrorr   
IndexErrorMotionVector_cinit_bypass_sentinel)r   r
   vectors      r   __getitem__MotionVectors.__getitem__   sc    	=='' 		 IIU##(4"D)
 	
u% s    
c              #   P   #    [        U R                  5       H	  nX   v   M     g7f)z Iterate over all motion vectors.N)ranger   )r   is     r   __iter__MotionVectors.__iter__(   s     tyy!A'M "s   $&c                 J    SSK nUR                  U UR                  / SQSS9S9$ )z
Convert motion vectors to a NumPy structured array.

Returns a NumPy array with fields corresponding to the AVMotionVector structure.
r   N))sourceint32)wuint8)hr8   )src_xint16)src_yr;   )dst_xr;   )dst_yr;   )flagsuint64)motion_xr6   )motion_yr6   )motion_scaleuint16T)align)dtype)numpy
frombufferrF   )r   nps     r   
to_ndarrayMotionVectors.to_ndarray-   s;     	}}((     
 	
r   )r   r   N)__name__
__module____qualname____firstlineno__Framer   intr   r"   r%   
Py_ssize_tr-   r2   rJ   __static_attributes__ r   r   r   r   	   sB    G Gfjj G

!2!2 

r   r   c                       \ rS rSrSrS\S\R                  4S jrS r	\
S 5       r\
S 5       r\
S	 5       r\
S
 5       r\
S 5       r\
S 5       r\
S 5       r\
S 5       r\
S 5       r\
S 5       rSrg)r*   J   z
Represents a single motion vector from video frame data.

Motion vectors describe the motion of a block of pixels between frames.
parentr
   c                     U[         La  [        S5      eX l        [        R                  " [        R
                  [        R                     UR                  R                  5      nXC-   U l        g )Nz(cannot manually instantiate MotionVector)
r+   RuntimeErrorrW   r   r   pointerr   r   r   r    )r   r   rW   r
   bases        r   r   MotionVector.__init__S   sQ    11IJJ39;;NN3--.

4
 <r   c                     SU R                    SU R                   SU R                   SU R                   SU R                   SU R
                   S3$ )Nz<av.sidedata.MotionVector xz from (,z) to (z)>)r7   r9   r:   r<   r=   r>   r!   s    r   r"   MotionVector.__repr__\   sP    ($&& :ZZL$**VDJJ<qBP	
r   c                 .    U R                   R                  $ r   )r   r5   r!   s    r   r5   MotionVector.sourceb   s    xxr   c                 .    U R                   R                  $ r   )r   r7   r!   s    r   r7   MotionVector.wf       xxzzr   c                 .    U R                   R                  $ r   )r   r9   r!   s    r   r9   MotionVector.hj   re   r   c                 .    U R                   R                  $ r   )r   r:   r!   s    r   r:   MotionVector.src_xn       xx~~r   c                 .    U R                   R                  $ r   )r   r<   r!   s    r   r<   MotionVector.src_yr   rj   r   c                 .    U R                   R                  $ r   )r   r=   r!   s    r   r=   MotionVector.dst_xv   rj   r   c                 .    U R                   R                  $ r   )r   r>   r!   s    r   r>   MotionVector.dst_yz   rj   r   c                 .    U R                   R                  $ r   )r   rA   r!   s    r   rA   MotionVector.motion_x~       xx   r   c                 .    U R                   R                  $ r   )r   rB   r!   s    r   rB   MotionVector.motion_y   rs   r   c                 .    U R                   R                  $ r   )r   rC   r!   s    r   rC   MotionVector.motion_scale   s    xx$$$r   )rW   r   N)rL   rM   rN   rO   __doc__r   r   rQ   r   r"   propertyr5   r7   r9   r:   r<   r=   r>   rA   rB   rC   rS   rT   r   r   r*   r*   J   s       vzz  
               ! ! ! ! % %r   r*   )r   cython.cimportsr   r   $cython.cimports.av.sidedata.sidedatar   cython.cimports.libc.stdintr   declareobjectr+   finalcclassr   r*   rT   r   r   <module>r      sy     ( 9 19  <
H <
  <
~ <% <%  <%r   