<!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-&gt;i_low |= (0x35a4e4f5 &gt;&gt; (h-&gt;i_frame &amp; 31) &amp; 1) &lt;&lt; 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>
&gt; I too found this bug around two months back....<br>
&gt; I informed too....I also agree that it is not critical error but should be<br>
&gt; resolved.<br>
&gt;<br>
&gt; I already gave thought on it..and I feel the magic number (0x35a4e4f5) in<br>
&gt; the below line<br>
&gt;<br>
&gt; cb-&gt;i_low |= (0x35a4e4f5 &gt;&gt; (h-&gt;i_frame &amp; 31) &amp; 1) &lt;&lt; 10;<br>
&gt;<br>
&gt; from function x264_cabac_encode_flush is the issue.<br>
&gt; I couldn't figure out the relation between the magic number and the<br>
&gt; h-&gt;i_frame.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; 2009/3/24 Ludrao &lt;ludh264@ludrao.net&gt;<br>
&gt;<br>
&gt; &gt; Hi all,<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; I found h264 streams encoded with x264 that has a bizare sequence of<br>
&gt; &gt; trailing bits.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; This is linked to section 7.3.2.11 of the standard:<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; 7.3.2.11 RBSP trailing bits syntax<br>
&gt; &gt; rbsp_trailing_bits( ) {<br>
&gt; &gt; rbsp_stop_one_bit /* equal to 1 */<br>
&gt; &gt; while( !byte_aligned( ) )<br>
&gt; &gt; rbsp_alignment_zero_bit /* equal to 0 */<br>
&gt; &gt; }<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; This seems no always to be respected ?<br>
&gt; &gt; For instance I found a stream where the last byte of the slice was 0x81.<br>
&gt; &gt; The stream is using CABAC encoding.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; I have done some checking, it happens to be the case in a lot of streams<br>
&gt; &gt; encoded with x264.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; This is not really a big deals since I can just ignore the trailing bits,<br>
&gt; &gt; but still...<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Maybe I am missing something in the spec ?<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Regards,<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; Ludrao<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; x264-devel mailing list<br>
&gt; &gt; x264-devel@videolan.org<br>
&gt; &gt; 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>