[x264-devel] Duplicate lines in bitstream.c

Philip Muzzall philipmuzzall at gmail.com
Fri Oct 12 00:40:22 CEST 2012


I noticed the following functions in Bitstream.c have these lines
duplicated in their definitions.

Is this a typo or were these place intentionally?

  29 static uint8_t *x264_nal_escape_c( uint8_t *dst, uint8_t *src, uint8_t
> *end )
>   30 {
>   31     *if( src < end ) *dst++ = *src++;*
>   32     *if( src < end ) *dst++ = *src++;*
>   33     while( src < end )
>   34     {
>   35         if( src[0] <= 0x03 && !dst[-2] && !dst[-1] )
>   36             *dst++ = 0x03;
>   37         *dst++ = *src++;
>   38     }
>   39     return dst;
>   40 }
>

  51 void x264_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal )
>   52 {
>   53     uint8_t *src = nal->p_payload;
>   54     uint8_t *end = nal->p_payload + nal->i_payload;
>   55     uint8_t *orig_dst = dst;
>   56
>   57     if( h->param.b_annexb )
>   58     {
>   59         if( nal->b_long_startcode )
>   60             *dst++ = 0x00;
>   61         **dst++ = 0x00;*
>   62         **dst++ = 0x00;*
>   63         *dst++ = 0x01;
>   64     }
>   65     else /* save room for size later */
>   66         dst += 4;
>   67
>   68     /* nal header */
>   69     *dst++ = ( 0x00 << 7 ) | ( nal->i_ref_idc << 5 ) | nal->i_type;
>   70
>   71     dst = h->bsf.nal_escape( dst, src, end );
>   72     int size = (dst - orig_dst) - 4;
>   73
>   74     /* Write the size header for mp4/etc */
>   75     if( !h->param.b_annexb )
>   76     {
>   77         /* Size doesn't include the size of the header we're writing
> now. */
>   78         orig_dst[0] = size>>24;
>   79         orig_dst[1] = size>>16;
>   80         orig_dst[2] = size>> 8;
>   81         orig_dst[3] = size>> 0;
>   82     }
>   83
>   84     nal->i_payload = size+4;
>   85     nal->p_payload = orig_dst;
>   86     x264_emms();
>   87 }
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20121011/d74df921/attachment.html>


More information about the x264-devel mailing list