- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I'm trying to decode H.264 bitstream from my network camera using H264Decoder. H.264 bitstream is ok and p_vidH264Decoder->GetFram(&m_pInMediaData, &m_pOutVideoData) return OK,but but I can't get the decoded data from m_pOutVideoData. Could you take a look on this file ? Can you give me a sample code to decode H.264 bitstream? sorry for my english.
Thank you!
/********Decoding***********/
if(!m_bInitialized)
{
if(bIFrame) InitilizeH264Decoder(pVideoData, nDataLen);
else return -4;
}
int mSizeRemote = width * High;
Ipp8u *pY = NULL, *pU = NULL, *pV = NULL,*pBS=NULL;
pY1 = pU = pV = pBS = NULL;
pY1 = new Ipp8u[mSizeRemote];
pU1 = new Ipp8u[mSizeRemote];
pV1 = new Ipp8u[mSizeRemote];
pBS1 = new Ipp8u[2*mSizeRemote];
m_pOutVideoData.SetDest(m_pOutBuf);
m_pOutVideoData.SetPitch(width *2);
m_pOutVideoData.SetColorFormat(UMC::YUV420);
m_pOutVideoData.SetDataSize(High*width + (High/2)*(width /2)
+ (High/2)*(width /2));
m_pOutVideoData.SetVideoParameters(width , High,UMC::YUV420);
Ipp8u *ptr=pBS1;
memcpy(ptr,pVideoData,nDataLen);
m_pInMediaData.SetBufferPointer((vm_byte*)ptr,nDataLen);
m_pInMediaData.SetDataSize(nDataLen);
int umcRes = p_vidH264Decoder->GetFram(&m_pInMediaData, &m_pOutVideoData);
if(umcRes != UMC::UMC_OK && umcRes != UMC::UMC_NOT_ENOUGH_DATA) return -2;
if(umcRes == UMC::UMC_OK) return 0;
if(umcRes == UMC::UMC_NOT_ENOUGH_DATA) return -1;
return 0;
/********Init Decoder***********/
#define width 176
#define High 144
UMC::ColorSpaceConverter *ColorDecoder;
ColorDecoder = new UMC::ColorSpaceConverter();
UMC::VideoDecoderParams *m_pVideoDecoderParams;
UMC::VideoStreamInfo video_info;
m_pVideoDecoderParams=new UMC::VideoDecoderParams();
p_vidH264Decoder=new UMC::H264VideoDecoder();
video_info.color_format = UMC::YUV420;
video_info.stream_type = UMC::H264_VIDEO;
video_info.stream_subtype = UMC::UNDEF_VIDEO_SUBTYPE;
video_info.clip_info.width = width ;
video_info.clip_info.height = High;
UMC::ColorConversionInfo ColorInit;
ColorInit.FormatSource =UMC::YUV420;
ColorInit.SizeSource.width = video_info.clip_info.width;
ColorInit.SizeSource.height = video_info.clip_info.height;
ColorInit.FormatDest = UMC::YUV420;;
ColorInit.SizeDest.width = video_info.clip_info.width;
ColorInit.SizeDest.height = video_info.clip_info.height;
ColorInit.lFlags = 1;
ColorInit.lDeinterlace = 0;
ColorInit.lInterpolation = UMC::FLAG_CCNV_CONVERT;
m_pInMediaData.SetBufferPointer((vm_byte*)pIFrameData,nFrameSize );
m_pVideoDecoderParams->info = video_info;
m_pVideoDecoderParams->cformat = UMC::YUV420;;
m_pVideoDecoderParams->lFlags = UMC::FLAG_VDEC_UVMERGED | UMC::FLAG_VDEC_REORDER;
&nbs
p; m_pVideoDecoderParams->lpConverter = ColorDecoder;
m_pVideoDecoderParams->lpConvertInit = &ColorInit;
m_pVideoDecoderParams->uiLimitThreads = 1;
m_pVideoDecoderParams->m_pData = &m_pInMediaData;
if (ippStaticInit() < ippStsNoErr) {
fprintf(stderr,"Error: Can't initialize ipp libs!
");
return 5;
}
UMC::Status status = p_vidH264Decoder->Init(m_pVideoDecoderParams);
if (UMC::UMC_OK == status)
{
m_videoWidth = m_pVideoDecoderParams.info.clip_info.width;
m_videoHeight = m_pVideoDecoderParams.info.clip_info.height;
}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
we do not have a specific example to demonstrate H.264 decoding from network. But you might find it useful to take a look on IPP simple_player application, which supports several video decoders, including H.264.
Regards,
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
I encode video using H.264 codec from camra, then wrap rtp and send via network to decoder. All works well while stream not broken.but when some frames can be lost. my application is crash in a method GetFrame of the decoder. why?
thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, you might be interested in trying the latest version of IPP H.264 codec, from IPP v 5.2.
Regards,
Vladimir
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page