Sam Barham
2007-Jun-17 22:29 UTC
[theora] Please help : Trying to fool Theora into doing what I want
I'm currently doing research and initial development for an app that requires a rather odd usage of some kind of movie decoding. 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. What I want to do goes something like this: 1) Encode a whole bunch of two frame movies. For each movie, the first frame is identical (to all the other movies), and the second frame is different in each case. 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). 3) At runtime, decode the single key frame, then store its decoded data somewhere. This is done once. 4) Repeatedly, slap the decoded key frame back into memory, then decode a particular delta frame on top of it. I've got 1 and 2 working just fine (although I'm only storing the 'bytes' and 'packet' members of the packets). 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. The process I use for 3 and 4 is: To get the key frame: 1) Put the packet I saved into theora using theora_decode_packetin 2) Grab the decoded packet using theora_decode_YUVout 3) Read the YUV data into my own buffer To force the saved keyframe data back into theora: 1) call theora_decode_YUVout in order to get a YUV structure with its data members pointing somewhere usesful 2) copy the data I saved in (3) above back into the YUV structure (thereby writing it into the LastFrameRecon bit of the codec And finally, to decode the delta frame: 1) Put the packet I saved into theora using theora_decode_packetin 2) Grab the decoded packet using theora_decode_YUVout 3) convert the data to rgb and display. Like I said, it works fine except for the block artifacts. Any idea what I could be doing wrong, should be doing differently, or further information I can supply? Cheers Sam Barham -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/theora/attachments/20070618/564781c8/attachment.htm
Ralph Giles
2007-Jun-17 23:26 UTC
[theora] Please help : Trying to fool Theora into doing what I want
On Mon, Jun 18, 2007 at 04:57:10PM +1200, Sam Barham wrote:> To force the saved keyframe data back into theora: > > 1) call theora_decode_YUVout in order to get a YUV structure with its data > members pointing somewhere usesful > > 2) copy the data I saved in (3) above back into the YUV structure (thereby > writing it into the LastFrameRecon bit of the codecHmm. Does it work if you play the movies normally? Does it work if you feed it the compressed keyframe packet again? I'd have to look, but writing into the returned YUV structure won't necessarily work. There are post-processing steps after the point where you want to reconstruct from. -r