- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello all,
I'm trying to integrate the ipp h.264 decoder into our application. I get frame data from an RTP stream. All I can get out of the decoder are black frames (all 0's) where I expect an RGB32 formatted array of bytes. In the debugger the return value from "GetFrame" is UMC_OK, so I assume the decoder was able to decode a frame.
We also use libavcodec (ffmpeg) which seems to work fine, so we're pretty sure it's not bad input data. I've recorded a chunk of video data to a file and played it with the simple_player application. It appears to decode just fine based on the statistics output.
Choice bits of the code are below. Any help is appreciated.
I'm trying to integrate the ipp h.264 decoder into our application. I get frame data from an RTP stream. All I can get out of the decoder are black frames (all 0's) where I expect an RGB32 formatted array of bytes. In the debugger the return value from "GetFrame" is UMC_OK, so I assume the decoder was able to decode a frame.
We also use libavcodec (ffmpeg) which seems to work fine, so we're pretty sure it's not bad input data. I've recorded a chunk of video data to a file and played it with the simple_player application. It appears to decode just fine based on the statistics output.
Choice bits of the code are below. Any help is appreciated.
bool ScIppH264Decoder::initialize(int width, int height)
{
//-- Create video input buffer.
m_in_buf = new UMC::MediaData();
//-- Create output buffer.
m_out_buf = new UMC::VideoData();
m_out_buf->Init(width, height, UMC::RGB32);
m_out_buf->InitAlloc(width, height, UMC::RGB32);
m_out_buf->SetColorFormat(UMC::RGB32);
m_out_buf->SetFrameType(UMC::P_PICTURE);
//-- Create decoder.
m_decoder = new UMC::H264VideoDecoder();
if (m_decoder == NULL)
{
return false;
}
UMC::ColorConversionInfo *colorParams = new UMC::ColorConversionInfo();
colorParams->FormatDest = UMC::RGB32;
colorParams->SizeSource.width = width;
colorParams->SizeSource.height = height;
colorParams->SizeDest.width = width;
colorParams->SizeDest.height = height;
colorParams->lFlags = UMC::FLAG_CCNV_NONE;
colorParams->lDeinterlace = 0;
colorParams->lInterpolation = IPPI_INTER_NN;
UMC::VideoDecoderParams *params = new UMC::VideoDecoderParams();
params->m_pData = m_in_buf;
params->cformat = UMC::RGB32;
params->lFlags = UMC::FLAG_VDEC_NO_PREVIEW | UMC::FLAG_VDEC_COMPATIBLE | UMC::FLAG_VDEC_REORDER;
params->lpConverter = new TimedColorConverter();
params->lpConvertInit = colorParams;
params->uiLimitThreads = 1;
if (m_decoder->Init(params) != UMC::UMC_OK)
{
return false;
}
return true;
}
int ScIppH264Decoder::getImage(unsigned char **ptrDecodeImage)
{
*ptrDecodeImage = (unsigned char*) m_out_buf->GetDataPointer();
return m_out_buf->GetDataSize();
}
int ScIppH264Decoder::decode(int width, int height, unsigned char *buf, int bufSize, bool *gotImage)
{
if (!m_initialized)
{
if (!(m_initialized = initialize(width, height)))
{
*gotImage = false;
return -1;
}
}
if ((bufSize == 0) || (buf == NULL))
{
*gotImage = false;
return -1;
}
m_in_buf->SetBufferPointer(buf, bufSize);
m_in_buf->SetDataSize(bufSize);
UMC::Status decStatus = UMC::UMC_OK;
do
{
decStatus = m_decoder->GetFrame(m_in_buf, m_out_buf);
}
while ((decStatus != UMC::UMC_NOT_ENOUGH_DATA) &&
(decStatus != UMC::UMC_OK));
if (decStatus == UMC::UMC_NOT_ENOUGH_DATA)
{
*gotImage = false;
return bufSize;
}
else if (decStatus == UMC::UMC_OK)
{
*gotImage = true;
return bufSize;
}
else
{
*gotImage = false;
return -1;
}
}
Link Copied
0 Replies
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page