§
    ÜóÉjŸ  ã                   óø   — d dl mZ d dlZd dlmZ d dlmZ d dlm	Z	  G d„ de¦  «        Z
ej        ej         G d„ d	e¦  «        ¦   «         ¦   «         Zej        ej         G d
„ d¦  «        ¦   «         ¦   «         ZdS )é    )ÚIntEnumN)Úlibav)ÚSideData)Úuint8_tc                   óF   — e Zd Zej        Zej        Zej        Z	ej
        ZdS )ÚVideoEncParamsTypeN)Ú__name__Ú
__module__Ú__qualname__ÚlibÚAV_VIDEO_ENC_PARAMS_NONEÚNONEÚAV_VIDEO_ENC_PARAMS_VP9ÚVP9ÚAV_VIDEO_ENC_PARAMS_H264ÚH264ÚAV_VIDEO_ENC_PARAMS_MPEG2ÚMPEG2© ó    úz/home/lighthouse/badge-speaker-benchmark/.benchmark-venv-community/lib64/python3.11/site-packages/av/sidedata/encparams.pyr   r   	   s.   € € € € € ØÔ'€DØ
Ô
%€CØÔ'€DØÔ)€E€E€Er   r   c                   ó¤   — e Zd Zd„ Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Z	ed„ ¦   «         Z
d„ Zd	„ Zd
S )ÚVideoEncParamsc                 ó8   — d| j         › d| j        › d| j        › d�S )Nz'<av.sidedata.VideoEncParams, nb_blocks=z, codec_type=z, qp=ú>)Ú	nb_blocksÚ
codec_typeÚqp©Úselfs    r   Ú__repr__zVideoEncParams.__repr__   s-   € Øv¸¼ÐvÐvÐVZÔVeÐvÐvÐlpÔlsÐvÐvÐvÐvr   c                 ó~   — t          j        t           j        t          j                 | j        j        ¦  «        j        S )zæ
        Number of blocks in the array
        May be 0, in which case no per-block information is present. In this case
        the values of blocks_offset / block_size are unspecified and should not
        be accessed.
        )ÚcythonÚcastÚpointerr   ÚAVVideoEncParamsÚptrÚdatar   r   s    r   r   zVideoEncParams.nb_blocks   s.   € õ Œ{ÝŒN�3Ô/Ô0°$´(´-ñ
ô 
ä
ð	r   c                 ó~   — t          j        t           j        t          j                 | j        j        ¦  «        j        S )zk
        Offset in bytes from the beginning of this structure at which the array of blocks starts.
        )r#   r$   r%   r   r&   r'   r(   Úblocks_offsetr   s    r   r*   zVideoEncParams.blocks_offset"   s.   € õ
 Œ{ÝŒN�3Ô/Ô0°$´(´-ñ
ô 
ä
ð	r   c                 ó~   — t          j        t           j        t          j                 | j        j        ¦  «        j        S )zX
        Size of each block in bytes. May not match sizeof(AVVideoBlockParams).
        )r#   r$   r%   r   r&   r'   r(   Ú
block_sizer   s    r   r,   zVideoEncParams.block_size+   s.   € õ
 Œ{ÝŒN�3Ô/Ô0°$´(´-ñ
ô 
ä
ð	r   c                 óÖ   — t          j        t           j        t          j                 | j        j        ¦  «        j        }t          t          j        t           j	        |¦  «        ¦  «        S )zH
        Type of the parameters (the codec they are used with).
        )
r#   r$   r%   r   r&   r'   r(   Útyper   Úint)r    Úts     r   r   zVideoEncParams.codec_type4   sL   € õ
 '-¤kÝŒN�3Ô/Ô0°$´(´-ñ'
ô '
ä
ð 	
õ "¥&¤+­f¬j¸!Ñ"<Ô"<Ñ=Ô=Ð=r   c                 ó~   — t          j        t           j        t          j                 | j        j        ¦  «        j        S )a  
        Base quantisation parameter for the frame. The final quantiser for a
        given block in a given plane is obtained from this value, possibly
        combined with `delta_qp` and the per-block delta in a manner
        documented for each type.
        )r#   r$   r%   r   r&   r'   r(   r   r   s    r   r   zVideoEncParams.qp>   s'   € õ Œ{�6œ>­#Ô*>Ô?ÀÄÄÑOÔOÔRÐRr   c                 ó¬   ‡— t          j        t           j        t          j                 | j        j        ¦  «        Šˆfd„t          d¦  «        D ¦   «         S )z›
        Quantisation parameter offset from the base (per-frame) qp for a given
        plane (first index) and AC/DC coefficients (second index).
        c                 óJ   •‡— g | ]Šˆˆfd „t          d¦  «        D ¦   «         ‘ŒS )c                 ó6   •— g | ]}‰j         ‰         |         ‘ŒS r   )Údelta_qp)Ú.0ÚjÚiÚps     €€r   ú
<listcomp>z6VideoEncParams.delta_qp.<locals>.<listcomp>.<listcomp>Q   s$   ø€ Ð4Ð4Ð4 a�”˜A”˜qÔ!Ð4Ð4Ð4r   é   )Úrange)r6   r8   r9   s    @€r   r:   z+VideoEncParams.delta_qp.<locals>.<listcomp>Q   s8   øø€ ÐGÐGÐG¸Ð4Ð4Ð4Ð4Ð4­5°©8¬8Ð4Ñ4Ô4ÐGÐGÐGr   é   )r#   r$   r%   r   r&   r'   r(   r<   )r    r9   s    @r   r5   zVideoEncParams.delta_qpH   sL   ø€ õ 39´+ÝŒN�3Ô/Ô0°$´(´-ñ3
ô 3
ˆð HÐGÐGÐG½eÀA¹h¼hÐGÑGÔGÐGr   c                 ób   — |dk     s|| j         k    rt          d¦  «        ‚t          | |¦  «        S )z?
        Get the encoding parameters for a given block
        r   z$Expected idx in range [0, nb_blocks))r   Ú
ValueErrorÚVideoBlockParams)r    Úidxs     r   Úblock_paramszVideoEncParams.block_paramsS   s8   € ð
 �Š7ˆ7�c˜Tœ^Ò+Ð+ÝÐCÑDÔDÐDå  cÑ*Ô*Ð*r   c                 óª  — ddl }| j        j        j        dz   dz  }| j        j        j        dz   dz  }||z  }t          j        t
          j        ¦  «        \  }}}| j        |k    rt          d¦  «        ‚t          j
        t
          j        t          j                 | j        j        ¦  «        j        }|t          j        j        k    r$|t          j        j        k    rt'          d¦  «        ‚|                     ||f|j        ¬¦  «        }	t-          |¦  «        D ]:}t/          | |¦  «        }
|
j        dz  }|
j        dz  }| j        |
j        z   |	||f<   Œ;|	S )zœ
        Convenience method that creates a 2-D map with the quantization parameters per macroblock.
        Only for MPEG2 and H264 encoded videos.
        r   Né   é   z:Expected frame size to match number of blocks in side datazExpected MPEG2 or H264)Údtype)ÚnumpyÚframer'   ÚheightÚwidthr#   Údeclarer/   r   ÚRuntimeErrorr$   r%   r   r&   r(   r.   ÚAVVideoEncParamsTyper   r   r?   ÚemptyÚint32r<   r@   Úsrc_yÚsrc_xr   r5   )r    ÚnpÚmb_hÚmb_wÚnb_mbÚ	block_idxÚxÚyr.   ÚmapÚblocks              r   Úqp_mapzVideoEncParams.qp_map]   sW  € ð
 	ÐÐÐà œJœNÔ1°BÑ6¸2Ñ=ˆØ œJœNÔ0°2Ñ5¸"Ñ<ˆØ  4™KˆÝ œ.­¬Ñ4Ô4‰ˆ	�1�að Œ>˜UÒ"Ð"ÝØLñô ð õ *0¬ÝŒN�3Ô/Ô0°$´(´-ñ*
ô *
ä
ð 	ð •CÔ,ÔFÒFÐFØ�Ô0ÔIÒIÐIåÐ5Ñ6Ô6Ð6ð �hŠh˜˜d�|¨2¬8ˆhÑ4Ô4ˆõ ˜u™œð 	1ð 	1ˆIÝ$ T¨9Ñ5Ô5ˆEØ”˜rÑ!ˆAØ”˜rÑ!ˆAØœ %¤.Ñ0ˆC��1�‰IˆIàˆ
r   N)r	   r
   r   r!   Úpropertyr   r*   r,   r   r   r5   rB   r[   r   r   r   r   r      sì   € € € € € ðwð wð wð ð	ð 	ñ „Xð	ð ðð ñ „Xðð ðð ñ „Xðð ð>ð >ñ „Xð>ð ðSð Sñ „XðSð ðHð Hñ „XðHð+ð +ð +ð%ð %ð %ð %ð %r   r   c                   ó    — e Zd Zdedej        ddfd„Zd„ Zed„ ¦   «         Z	ed„ ¦   «         Z
ed	„ ¦   «         Zed
„ ¦   «         Zed„ ¦   «         ZdS )r@   Úvideo_enc_paramsrA   ÚreturnNc                 ó   — t          j        t           j        t                   |j        j        ¦  «        }|j        ||j        z  z   }t          j        t           j        t          j	                 ||z   ¦  «        | _        d S )N)
r#   r$   r%   r   r'   r(   r*   r,   r   ÚAVVideoBlockParams)r    r^   rA   ÚbaseÚoffsets        r   Ú__init__zVideoBlockParams.__init__ˆ   sh   € Ý(.¬ÝŒN�7Ô#Ð%5Ô%9Ô%>ñ)
ô )
ˆð Ô*¨SÐ3CÔ3NÑ-NÑNð 	õ ”;�vœ~­cÔ.DÔEÀtÈfÁ}ÑUÔUˆŒˆˆr   c                 óX   — d| j         › d| j        › d| j        › d| j        › d| j        › d�S )Nz$<av.sidedata.VideoBlockParams, src=(z, z), size=rW   z, delta_qp=r   )rQ   rP   ÚwÚhr5   r   s    r   r!   zVideoBlockParams.__repr__‘   sn   € ð E°d´jð  Eð  EÀDÄJð  Eð  EÐX\ÔX^ð  Eð  EÐaeÔagð  Eð  EÐtxô  uBð  Eð  Eð  Eð  	Er   c                 ó   — | j         j        S )zÛ
        Horizontal distance in luma pixels from the top-left corner of the visible frame
        to the top-left corner of the block.
        Can be negative if top/right padding is present on the coded frame.
        )r'   rQ   r   s    r   rQ   zVideoBlockParams.src_x”   ó   € ð ŒxŒ~Ðr   c                 ó   — | j         j        S )zÙ
        Vertical distance in luma pixels from the top-left corner of the visible frame
        to the top-left corner of the block.
        Can be negative if top/right padding is present on the coded frame.
        )r'   rP   r   s    r   rP   zVideoBlockParams.src_y�   ri   r   c                 ó   — | j         j        S )z3
        Width of the block in luma pixels
        )r'   rf   r   s    r   rf   zVideoBlockParams.w¦   ó   € ð
 ŒxŒzÐr   c                 ó   — | j         j        S )z4
        Height of the block in luma pixels
        )r'   rg   r   s    r   rg   zVideoBlockParams.h­   rl   r   c                 ó   — | j         j        S )z}
        Difference between this block's final quantization parameter and the
        corresponding per-frame value.
        )r'   r5   r   s    r   r5   zVideoBlockParams.delta_qp´   s   € ð ŒxÔ Ð r   )r	   r
   r   r   r#   r/   rd   r!   r\   rQ   rP   rf   rg   r5   r   r   r   r@   r@   …   sß   € € € € € ðV¨ð V¸f¼jð VÈTð Vð Vð Vð VðEð Eð Eð ðð ñ „Xðð ðð ñ „Xðð ðð ñ „Xðð ðð ñ „Xðð ð!ð !ñ „Xð!ð !ð !r   r@   )Úenumr   r#   Úcython.cimportsr   r   Ú$cython.cimports.av.sidedata.sidedatar   Úcython.cimports.libc.stdintr   r   ÚfinalÚcclassr   r@   r   r   r   ú<module>ru      s  ðØ Ð Ð Ð Ð Ð à €€€Ø (Ð (Ð (Ð (Ð (Ð (Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø /Ð /Ð /Ð /Ð /Ð /ð*ð *ð *ð *ð *˜ñ *ô *ð *ð „Ø„ðpð pð pð pð p�Xñ pô pñ „ñ „ðpðf „Ø„ð3!ð 3!ð 3!ð 3!ð 3!ñ 3!ô 3!ñ „ñ „ð3!ð 3!ð 3!r   