Community
cancel
Showing results for 
Search instead for 
Did you mean: 
danielwang1971
Beginner
54 Views

UMC::H264VideoDecoder problem

Hello,

I'mworking for H264 coompression project.I'm testing IPP and I UMC :: H264VideoEncoder and UMC::H264VideoDecoder. I got a problem when decode h264 image using UMC::H264VideoDecoder.

First, I encode imageusingH264VideoEncoder.And I save to disk H264 images.And then I read datafrom disk and Idecode it by UMC::H264VideoDecoder but I got UMC_ERR_NOT_ENOUGH_DATA errorfor first image.Can youhelp me?

Best regards,

Daniel

0 Kudos
4 Replies
danielwang1971
Beginner
54 Views

Hello,

My decodefunction like:

BOOL Decode(void* destImage,int destBuffersize,void* srcImage,int srcBufferSize,FrameType type)

{

if(!Decoder) return FALSE;

DecodeIn->SetBufferPointersr(srcImage,srcBufferSize);

DecodeIn->SetFrameType(type);

DecodeOut->SetBufferPointer(destImage,destBuffersize);

DecodeIn->SetDataSize(len);

if(First)

{

DecoderParams->info.stream_type = H264_VIDEO;

//DecoderParams->numThreads = num_threads;

DecoderParams->lFlags = 0;

DecoderParams->m_pData = DecodeIn;

Decoder->Init(DecoderParams);

DecodeOut->SetAlignment(16);

DecodeOut->Init(ImageWidth, ImageHeight, UMC::GRAY, 8);

First = false;

}

Error = Decoder->GetFrame(DecodeIn, DecodeOut);

if(UMC_ERR_NOT_ENOUGH_DATA == Error)

return FALSE;

else

return TRUE;

}

I got UMC_ERR_NOT_ENOUGH_DATA error.

Thank you so much.

daniel wang

Vladimir_Dudnik
Employee
54 Views

Hello Daniel,

did you try to decode your data with simple_player application from IPP audio-video-codecs sample?

Regards,
Vladimir

danielwang1971
Beginner
54 Views


Thank you your response so quickly,I tested with simple_play.Exe,didn't work,neither.

Here's my Encode function

....
EncoderParams = new H264EncoderParams();
EncoderParams->info.clip_info.width = ImageWidth;
EncoderParams->info.clip_info.height = ImageHeight;
EncoderParams->info.framerate = 30;
EncoderParams->numEncodedFrames = 0x7fffffff;

EncoderParams->chroma_format_idc = 0;
EncoderParams->profile_idc = H264_HIGH_PROFILE;
EncoderParams->info.bitrate = 5000000;
.....
bool EncodeImage(void* destImage,void* srcImage)
{
if(!Encoder)return false;

if(First)
{
Error = Encoder->Init(EncoderParams);
Error = Encoder->GetInfo(EncoderParams);

if(Error != UMC_OK)
{
return false;
}
EncodeIn->Init(ImageWidth, ImageHeight,GRAY,8);

//Create the sequence on disk
StreamFile = CreateFile(_T("c:test.dat"), GENERIC_WRITE | GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
if(StreamFile == INVALID_HANDLE_VALUE)
{
StreamFile = NULL;
}
First = false;
}
EncodeInData->SetPlanePointer(srcImage,0);
EncodeOutData->SetBufferPointer(destImage,ImageWidth* ImageHeight);

Error = Encoder->GetFrame(EncodeInData,EncodeOutData);

if(Error != UMC_OK)
{
return false;
}

unsigned long len = EncodeOut->GetDataSize();

if(StreamFile)
{
DWORD written;
if(!WriteFile(StreamFile, destImage, len, &written, NULL))
return false;
}
return true;
}

After that,I run simple_player and my decode function, both of them didn't work.

Can your tellme what wrong in my code?

Best regards,

Daniel wang

Vladimir_Dudnik
Employee
54 Views

If you are able to compress your input stream with umc_video_enc_con application (and decode then back with simple_player) you may check encoder application sources to see what is wrong

Vladimir

Reply