Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: vorbis decoder probems on VIA C3 processor (Read 2775 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

vorbis decoder probems on VIA C3 processor

hi there.
i have extracted all the vorbis packets and get it in the array. Then,
i try to decompress data and convert it to pcm. all works fine with
Visual Studio 2003, but when i compile vorbis and my code in WindowsCE
Platform Builder under x86 VIA processor (mini-ITX MB Epia-SP) i hear
slight gaps, "speed-downs" and "speed-ups". Can anybody tell me, why?



i have such code:
Code: [Select]
       //init
       vorbis_synthesis_init(&vorb_dsp_state,&m_vorb_info);
       vorbis_block_init(&vorb_dsp_state,&vorb_block);  

       offset = 0;
       // go through

       for (uint32 p = 3; p < m_packets_number; p++)
       {
               float ** pcm = NULL;
               int samples;
               if (vorbis_synthesis(&vorb_block,&m_packets[p],1)==0)
                       vorbis_synthesis_blockin(&vorb_dsp_state,&vorb_block);

                       // using no more than 4096
               while ( (samples = vorbis_synthesis_pcmout(&vorb_dsp_state, &pcm)) > 0)
               {
                       int bout=(samples<4096) ? samples : 4096;
                       float * pcm_fr[2];
                       for (i = 0; i < (uint32)m_vorb_info.channels; i++)
                               pcm_fr[i] = pcm[i];

                               //my own func, see below
                       ConvertOGGToPCM(reinterpret_cast<int16 *>(m_fake_data) + offset, pcm_fr, bout, m_vorb_info.channels);
                       offset += bout * m_vorb_info.channels;

                       vorbis_synthesis_read(&vorb_dsp_state,bout);
               }
       }

       vorbis_block_clear(&vorb_block);
       vorbis_dsp_clear(&vorb_dsp_state);

       
void ConvertOGGToPCM(int16 * dst, const float * const * src, uint32 sample_cnt, uint32 channels )
{
       for (uint32 i = 0; i < channels; i++)
       {
               int16 *ptr = dst+i;
               const float *mono = src[i];
               for (uint32 j = 0; j < sample_cnt; j++)
               {
                       int val = int(mono[j] * 32767.f);
                       if(val > 32767)
                               val = 32767;
                       if(val < -32768)
                               val =- 32768;
                       *ptr = val;
                       ptr += channels;
               }
       }
}