Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Basics of video and audio decoding

r3d
Beginner
368 Views

I have read the forums and tried to understand fully the "simple player" that comes with ipp and I would like to know if my ideas about decoding video(and audio) are correct.

For decoding video I execute the following loop(after intiializing the avi splitter , the video decoder and the video render).

UMC::Status DecodeMPEG4Video()
{
out.SetVideoParameters(spl_info.m_video_info.clip_info.width,
spl_info.m_video_info.clip_info.height,
UMC::RGB24);

umcRes = genVideo->LockInputBuffer(&out);
umcRes = avi_spl.GetNextVideoData(&in);
while (umcRes == UMC::UMC_NOT_ENOUGH_DATA && in.GetDataSize() < 10000)
{
umcRes = avi_spl.GetNextVideoData(&in);
}
out.SetTime(in.GetTime());
if (umcRes == UMC::UMC_OK)
{
umcRes = mpeg4_dec.GetFrame(&in, &out);
}
if(umcRes == UMC::UMC_OK)
{
umcRes = genVideo->UnLockInputBuffer(&out);

if (umcRes != UMC::UMC_OK)
return umcRes;

umcRes = genVideo->RenderFrame();
if (umcRes != UMC::UMC_OK)
return umcRes;
}
return umcRes;
} // DecodeMPEG4Video()

It works ok with divx mpeg4 codec, but It shows Jittering(back and forward frames) problems with xvid. So, I have doubts about the procedure and would be glad to be pointed out to the right way

1)Lock the buffer(out) and get data in the UMC::MediaData variable in with GetNextVideoData until I have enough data(which value I am supposed to check with in in.GetDataSize() < ? )

2)Then I set the time of UMC::VideoData out variable with in.GetTime().

3)Next I decode the frame(forced mpeg4 in this example) mpeg4_dec.GetFrame

4)Unlock the buffer and do the RenderFrame

I do more or less similar things with audio with a UMC::DualThreadedCodec. The audio decoding loop scheme is something like

1)The audio decoder is initialized and a MediaBuffer given(UMC::LinearBuffer) with some UMC::MediaBufferParams. Then while not enough data GetNextAudioData in audio_in UMC::MediaData variable

2)Lock a mediaData buffer

dual_treaded_codec.LockInputBuffer(&buff)
3)Memcopy the audio_in buffer in buff being the data to copy the min between audio_in dataSize and buff BufferSize (with GetDataSize and GetBufferSize calls)

4)Unlock buff

5)Decode the audio data with dual_treaded_codec.GetFrame and put it in a UMC::AudioData variable

I get sound with this, but it gets some jitter(forward/backward jumps).

Thanks in advance!

Borja Morales

0 Kudos
3 Replies
r3d
Beginner
368 Views
Up, any little suggestion about this please smiley [:-)] ?
0 Kudos
Vladimir_Dudnik
Employee
368 Views

might be the reason is your stream? Can you attach it for analysis?

Regards,
Vladimir

0 Kudos
r3d
Beginner
368 Views

Hi Vladimir:

It's not the stream because (I forgot to say) the same video works ok ith the simple Player. That's Why I asked If I was doing something wrong with the way I get the nexdata, the buffers or similar. Do you think the procedure I wrote is correct?

Thanks!

0 Kudos
Reply