<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I'm currently doing research and initial development for an
app that requires a rather odd usage of some kind of movie decoding.&nbsp; I'm
trying to find a codec that I can trick into doing what I want, and so long as
I can fix a problem or two, Theora is looking promising.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>What I want to do goes something like this:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>1) Encode a whole bunch of two frame movies.&nbsp; For each
movie, the first frame is identical (to all the other movies), and the second
frame is different in each case.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>2) Store in a data file one (1) copy of the first frame
packet (which will be a key frame), as well as every single second frame packet
(which will/should be a delta frame).<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>3) At runtime, decode the single key frame, then store its
decoded data somewhere.&nbsp; This is done once.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>4) Repeatedly, slap the decoded key frame back into memory,
then decode a particular delta frame on top of it.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I've got 1 and 2 working just fine (although I'm only
storing the 'bytes' and 'packet' members of the packets).<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I've got 3 and 4 working mostly (I'll explain the process in
a bit), but when the app is running I get block artifacts, which look like small
square bits of the image have been moved to the wrong place.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>The process I use for 3 and 4 is:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>To get the key frame:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>1) Put the packet I saved into theora using <font
color="#010001"><span style='color:#010001'>theora_decode_packetin<o:p></o:p></span></font></span></font></p>

<p class=MsoNormal><font size=2 color="#010001" face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:#010001'>2) Grab the decoded
packet using theora_decode_YUVout<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color="#010001" face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:#010001'>3) Read the YUV data
into my own buffer<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color="#010001" face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:#010001'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color="#010001" face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:#010001'>To force the saved
keyframe data back into theora:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color="#010001" face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:#010001'>1) call theora_decode_YUVout
in order to get a YUV structure with its data members pointing somewhere
usesful<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color="#010001" face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:#010001'>2) copy the data I
saved in (3) above back into the YUV structure (thereby writing it into the LastFrameRecon
bit of the codec<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color="#010001" face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:#010001'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color="#010001" face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:#010001'>And finally, to decode
the delta frame:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>1) Put the packet I saved into theora using <font
color="#010001"><span style='color:#010001'>theora_decode_packetin<o:p></o:p></span></font></span></font></p>

<p class=MsoNormal><font size=2 color="#010001" face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:#010001'>2) Grab the decoded
packet using theora_decode_YUVout<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>3) convert the data to rgb and display.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Like I said, it works fine except for the block
artifacts.&nbsp; Any idea what I could be doing wrong, should be doing
differently, or further information I can supply?<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Cheers<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Sam Barham<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>