<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3020" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>any news on this? does it work right? any open bugs
needed to be fixed? :)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=ian.caulfield@gmail.com href="mailto:ian.caulfield@gmail.com">Ian
Caulfield</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=x264-devel@videolan.org
href="mailto:x264-devel@videolan.org">x264-devel@videolan.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, January 08, 2007 10:01
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [x264-devel] Re: Patch for
Scenarist HD compatibility</DIV>
<DIV><BR></DIV>On 1/8/07, <B class=gmail_sendername>Loren Merritt</B> <<A
href="mailto:lorenm@u.washington.edu">lorenm@u.washington.edu</A>> wrote:
<DIV><SPAN class=gmail_quote></SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">On
Sat, 6 Jan 2007, Ian Caulfield wrote:<BR><BR>> - fix a small bug in
bitstream_write (on x86 a right shift of more than 32<BR>> bits actually
shifts by the shift amount mod 32, rather than returning 0)<BR>><BR>>
--- common/bs.h (revision 616)<BR>> +++ common/bs.h (working
copy)<BR>> @@ -185,7 +185,10
@@<BR>> }<BR>> else<BR>> {<BR>>
- *s->p = (*s->p << s->i_left) |
(i_bits >> (i_count - s->i_left)); <BR>>
+ if( (i_count - s->i_left) >= 32 )<BR>>
+ *s->p = (*s->p
<< s->i_left);<BR>> + else<BR>>
+ *s->p = (*s->p
<< s->i_left) | (i_bits >> (i_count - s->i_left));
<BR>> i_count -=
s->i_left;<BR>>
s->p++;<BR>> s->i_left =
8;<BR><BR>Not a bug. i_count is the number of bits passed in i_bits, which
is a<BR>uint32_t, thus i_count<=32. i_left>0 because whenever it is 0
we increment <BR>the bitstream pointer and refill it. So the shift can't
exceed 31.</BLOCKQUOTE>
<DIV><BR>Sorry, I should have explained further - I had the problem when
bs_write_ue was being called with a value having 23 significant bits -
bs_write was then being called with a bit count of 45. I assumed that the
intended behaviour was to zero-extend the value when the count exceeded 31. I
could modify the patch to make bs_write_ue make two calls to bs_write if you'd
prefer. <BR> </DIV>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">bs_align_10
doesn't look right. shouldn't you use bs_rbsp_trailing<BR>instead?
</BLOCKQUOTE>
<DIV><BR>The difference is the one bit is optional - if the end of the SEI
payload is byte aligned, nothing further is written. From the (draft)
spec:<BR><BR><SPAN style="FONT-FAMILY: courier new,monospace">sei_payload(
payloadType, payloadSize )<BR>{<BR> <snip payload
contents><BR> if( !byte_aligned() )<BR>
bit_equal_to_one<BR> while ( !byte_aligned()
)<BR> bit_equal_to_zero<BR>}<BR
style="FONT-FAMILY: courier new,monospace"></SPAN> </DIV><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">>
- move the version info SEI header after the SPS and PPS headers<BR>>
(required for Scenarist to identify the stream as an H264 ES) <BR><BR>Bugs
should be fixed where the bug is. This is a bug in Scenarist, so out<BR>of
principle I won't work around it in x264.</BLOCKQUOTE>
<DIV><BR>Could it be a requirement of the HD DVD spec that H264 streams start
with AUD, SPS, PPS? I don't have access to that spec... <BR><BR>I did consider
adding a flag to remove the version header from the bitstream, but when I
found that reordering was sufficient I thought that just patching that would
be fairly unobtrusive<BR></DIV><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">On
Sun, 7 Jan 2007, bond wrote:</BLOCKQUOTE>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">>
or HDDVD compliance is wanted...<BR></BLOCKQUOTE>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid"><BR>The
whole patch is independent of whether HDDVD compliance is wanted. It<BR>just
adds a feature that Scenarist requires, because Scenarist is too <BR>lazy to
implement its own VBV model. (hint: a smart muxer does _not_<BR>need to know
what VBV parameters the stream was encoded with, it only<BR>needs to know
what VBV parameters the decoder wants)</BLOCKQUOTE>
<DIV><BR>Interestingly enough, Scenarist doesn't require the presence of VBV
parameters in VC-1 streams<BR><BR>Ian<BR></DIV><BR></DIV><BR>
<P>
<HR>
<P></P>Internal Virus Database is out-of-date.<BR>Checked by AVG Free
Edition.<BR>Version: 7.5.432 / Virus Database: 268.16.3/614 - Release Date:
2.1.2007 14:58<BR></BLOCKQUOTE></BODY></HTML>