<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;">Well I did a little more digging, and I found out something quite funny...<br>
I believe that this magic stuff is actually a kind of watermarking. i_frame is just used as a regularly increasing counter so you can select each one bit of the magic number 0x35a4e4f5.<br>
To confirm this you can actually print the trailing bits of each slices, and you'll find out that there are always in the form of a sequence of 0 (standard way of representing rbsp_alignment_zero_bits) or sequence of 0 followed by a single 1.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p><p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>For instance my traces give me that: (look the the trailing bit "value")<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>GlobalPicNumber 1, slice_type 7, slice_num 0, frame_num 0, POC 0, field_pic_flag 0, Size :1280x720<br>
trailing bits error: used bits: 100601, total bits: 100608<br>
nb of trailing bits: 7, value: 0x1<br>
GlobalPicNumber 2, slice_type 5, slice_num 0, frame_num 1, POC 2, field_pic_flag 0, Size :1280x720<br>
nb of trailing bits: 5, value: 0x0<br>
GlobalPicNumber 3, slice_type 5, slice_num 0, frame_num 2, POC 8, field_pic_flag 0, Size :1280x720<br>
trailing bits error: used bits: 34831, total bits: 34832<br>
nb of trailing bits: 1, value: 0x1<br>
GlobalPicNumber 4, slice_type 6, slice_num 0, frame_num 3, POC 4, field_pic_flag 0, Size :1280x720<br>
nb of trailing bits: 7, value: 0x0<br>
GlobalPicNumber 5, slice_type 6, slice_num 0, frame_num 3, POC 6, field_pic_flag 0, Size :1280x720<br>
trailing bits error: used bits: 9974, total bits: 9976<br>
nb of trailing bits: 2, value: 0x1<br>
GlobalPicNumber 6, slice_type 5, slice_num 0, frame_num 3, POC 16, field_pic_flag 0, Size :1280x720<br>
trailing bits error: used bits: 42284, total bits: 42288<br>
nb of trailing bits: 4, value: 0x1<br>
GlobalPicNumber 7, slice_type 6, slice_num 0, frame_num 4, POC 10, field_pic_flag 0, Size :1280x720<br>
trailing bits error: used bits: 17321, total bits: 17328<br>
nb of trailing bits: 7, value: 0x1<br>
GlobalPicNumber 8, slice_type 6, slice_num 0, frame_num 4, POC 12, field_pic_flag 0, Size :1280x720<br>
trailing bits error: used bits: 17435, total bits: 17440<br>
nb of trailing bits: 5, value: 0x1<br>
GlobalPicNumber 9, slice_type 6, slice_num 0, frame_num 4, POC 14, field_pic_flag 0, Size :1280x720<br>
nb of trailing bits: 3, value: 0x0<br>
GlobalPicNumber 10, slice_type 5, slice_num 0, frame_num 4, POC 24, field_pic_flag 0, Size :1280x720<br>
nb of trailing bits: 6, value: 0x0<br>
GlobalPicNumber 11, slice_type 6, slice_num 0, frame_num 5, POC 18, field_pic_flag 0, Size :1280x720<br>
trailing bits error: used bits: 15310, total bits: 15312<br>
nb of trailing bits: 2, value: 0x1<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p><p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Add up the last trailing bit and you get the magic number...<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p><p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>I believe that adding watermarking is fine (when you may need to know who use you software...), however it is better when it respect the standard...<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>So I politely ask the mastermind that is behind this nice piece of code to remove this line:<br>
        cb->i_low |= (0x35a4e4f5 >> (h->i_frame & 31) & 1) << 10;<br>
So that this wonderful codec implement respectfully the standard ;-)<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Thanks for your commitment !<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Ludrao<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>Le Tuesday 24 March 2009, Deepak Singh a écrit :<br>
> I too found this bug around two months back....<br>
> I informed too....I also agree that it is not critical error but should be<br>
> resolved.<br>
><br>
> I already gave thought on it..and I feel the magic number (0x35a4e4f5) in<br>
> the below line<br>
><br>
> cb->i_low |= (0x35a4e4f5 >> (h->i_frame & 31) & 1) << 10;<br>
><br>
> from function x264_cabac_encode_flush is the issue.<br>
> I couldn't figure out the relation between the magic number and the<br>
> h->i_frame.<br>
><br>
><br>
><br>
> 2009/3/24 Ludrao <ludh264@ludrao.net><br>
><br>
> > Hi all,<br>
> ><br>
> ><br>
> > I found h264 streams encoded with x264 that has a bizare sequence of<br>
> > trailing bits.<br>
> ><br>
> ><br>
> > This is linked to section 7.3.2.11 of the standard:<br>
> ><br>
> ><br>
> > 7.3.2.11 RBSP trailing bits syntax<br>
> > rbsp_trailing_bits( ) {<br>
> > rbsp_stop_one_bit /* equal to 1 */<br>
> > while( !byte_aligned( ) )<br>
> > rbsp_alignment_zero_bit /* equal to 0 */<br>
> > }<br>
> ><br>
> ><br>
> > This seems no always to be respected ?<br>
> > For instance I found a stream where the last byte of the slice was 0x81.<br>
> > The stream is using CABAC encoding.<br>
> ><br>
> ><br>
> > I have done some checking, it happens to be the case in a lot of streams<br>
> > encoded with x264.<br>
> ><br>
> ><br>
> > This is not really a big deals since I can just ignore the trailing bits,<br>
> > but still...<br>
> ><br>
> ><br>
> > Maybe I am missing something in the spec ?<br>
> ><br>
> ><br>
> > Regards,<br>
> ><br>
> ><br>
> > Ludrao<br>
> ><br>
> ><br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > x264-devel mailing list<br>
> > x264-devel@videolan.org<br>
> > http://mailman.videolan.org/listinfo/x264-devel<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p><p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p></body></html>