I write this small piece of code, that get pixels and encode them: ogg_page page; ogg_packet packet; m_frameSource.getYUVBits(m_buffer.y, m_buffer.u, m_buffer.v); theora_encode_YUVin(&m_encoder, &m_buffer); while(theora_encode_packetout(&m_encoder, isLastFrame, &packet)) ogg_stream_packetin(&m_oggStream, &packet); while (ogg_stream_pageout(&m_oggStream, &page)) { fwrite(page.header,page.header_len, 1, m_oggFile); fwrite(page.body,page.body_len, 1, m_oggFile); } This piece of code runs in real-time. I want to remove the last while block and save theora packets directly to a temporary file. Then when capture is finished I read packets from temp file and send them to ogg_stream_pageout. Does this solution improve performance? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/theora/attachments/20081130/43bdc807/attachment.htm
On 30-Nov-08, at 1:25 PM, Andrea Fontana wrote:> This piece of code runs in real-time. I want to remove the last > while block and save theora packets directly to a temporary file. > Then when capture is finished I read packets from temp file and > send them to ogg_stream_pageout. Does this solution improve > performance?I wouldn't expect it to affect performance. Ogg encapsulation is fairly cheap, and the memcpy()s it requires will be much faster than writing the data in either form to disk. If your video is small (packets often < 4 KB) writing out a packet at a time may spread the disk access more evenly, if that helps. Have you tried setting TH_ENCCTL_SET_SPLEVEL to 2? In the 1.0 encoder this trades some quality/bitrate for performance, and is intended for constrained realtime applications. -r
Reasonably Related Threads
- What exactly is threadsafe
- Can a libFLAC encoder be initialize and called from inside a libFLAC decoder callback?
- Can a libFLAC encoder be initialize and called from inside a libFLAC decoder callback?
- ogg_stream_pageout(): Weird Documentation (libogg-1.0).
- [?] About YUV format