Niranjan Udipi
2009-Oct-22 07:23 UTC
[Vorbis-dev] Is it possible to seek different Ogg Vorbis encoded packets from the File?
Hi All, I am trying to program the 'Tremor' decoder onto an array of Processors. I am using four Processors. I did this experiment: I split the while(!eof){} in the main() in to four tasks using if(!eof) statements. In this modification, each if() decodes one packet of data at-a-time, sequentially. Then, I ran the code on a single Processor and the decoding was successful. The changes in the ivorbisfile_example.c are as follows: while(!eof){ long ret=ov_read(&vf,pcmout,sizeof(pcmout),¤t_section); if (ret == 0) { /* EOF */ eof=1; } else if (ret < 0) { /* error in the stream. Not a problem, just reporting it in case we (the app) cares. In this case, we don't. */ } else { /* we don't bother dealing with sample rate changes, etc, but you'll have to*/ fwrite(pcmout,1,ret,fp1); } if(eof) { break; } else { long ret=ov_read(&vf,pcmout,sizeof(pcmout),¤t_section); if (ret == 0) { /* EOF */ eof=1; } else if (ret < 0) { /* error in the stream. Not a problem, just reporting it in case we (the app) cares. In this case, we don't. */ } else { /* we don't bother dealing with sample rate changes, etc, but you'll have to*/ fwrite(pcmout,1,ret,fp1); } } if(eof) { break; } else { long ret=ov_read(&vf,pcmout,sizeof(pcmout),¤t_section); if (ret == 0) { /* EOF */ eof=1; } else if (ret < 0) { /* error in the stream. Not a problem, just reporting it in case we (the app) cares. In this case, we don't. */ } else { /* we don't bother dealing with sample rate changes, etc, but you'll have to*/ fwrite(pcmout,1,ret,fp1); } } if(eof) { break; } else { long ret=ov_read(&vf,pcmout,sizeof(pcmout),¤t_section); if (ret == 0) { /* EOF */ eof=1; } else if (ret < 0) { /* error in the stream. Not a problem, just reporting it in case we (the app) cares. In this case, we don't. */ } else { /* we don't bother dealing with sample rate changes, etc, but you'll have to*/ fwrite(pcmout,1,ret,fp1); } } However, in order to run the decoder parallely on four Processors, I need to run the ov_read() function on each Processor independently. In order to do that each Processor should be able to seek next encoded packet of data and there should not be duplication of packet decoding. Is it known apriori, how many Ogg-Vorbis packets are there and their corresponding locations in the File/stream? If yes, then each Processor can be pointed to its packet to-be-decoded. Please suggest how I can go ahead? Thanks, Niranjan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/vorbis-dev/attachments/20091022/f32899ac/attachment.htm
Ralph Giles
2009-Oct-23 00:04 UTC
[Vorbis-dev] Is it possible to seek different Ogg Vorbis encoded packets from the File?
On Thu, Oct 22, 2009 at 12:23 AM, Niranjan Udipi <ucniranjan at gmail.com> wrote:> ???? Is it known apriori, how many Ogg-Vorbis packets are there and their > corresponding locations in the File/stream? If yes, then each Processor can > be pointed to its packet to-be-decoded. Please suggest how I can go ahead?The ogg layer has some look ahead, based on how many packets are packed into each encapsulation page. To obtain four at once, you can simply call ogg_stream_packetout() four times, feeding more data to ogg_stream_pagein() as necessary. However, vorbis packets are not independent. Each overlaps with the previous packet, and cannot be decoded separately as you have described. You will have to use finer-grained parallelism to run Tremor in multiple threads. HTH, -r