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

Decoding Streaming H.264 Packets

Stephen_V_1
Novice
189 Views

I am using IPP 7.1 with the sample UMC code 7.1.0.011

I have an issue with decoding streaming H.264 which I suspect is in the way I'm using the Decoder, but I don't see how else to do things.  My issue is when I call the "GetFrame" function of the H264VideoDecoder UMC class, I may not have enough data for the decoder to get a frame.  Sometimes the function returns an error indicating not enough data (which would be fine), but other times it returns OK but the decoded frame is corrupted in some manner.  If I take the same data and buffer up more data before trying to decode, the resultant decoded frame looks fine.  My question is, how am I supposed to know whether I have enough dadta for a good decoded frame prior to actually doing the encoding?  Is there a proper method for this?

Note:  I am not using a splitter class, I am simply using VideoData and MediaData objects which I initialize with my decoder parameters.  Below is my function that I call to decode the data and hopefully produce a single decoded frame:

int DecodeStream(Ipp8u *inVideoData, int videoDataSize, Ipp8u *outVideoData,
                                Ipp32u& frameNumber, bool& frameReady, int *bytesDecoded)
{
  UMC::Status status;
  frameReady = false;
  *bytesDecoded = 0;
  Ipp64u ptrBefore = (Ipp64u)inVideoData;

  if(videoDataSize < 0)
  {
    // No data to decode
    return 1;
  }

  // pDataIn is a MediaData pointer, pDataOut is a VideoData pointer
  // Set the buffer pointer and sizes to what is passed in for decoding
  pDataIn->SetBufferPointer(inVideoData, videoDataSize);
  pDataIn->SetDataSize(videoDataSize);
  pDataOut->SetBufferPointer(outVideoData, dstFrameSize);

  // Decode the input video
  status  = pDecoder->GetFrame(pDataIn, pDataOut);

  if (status == UMC::UMC_OK)
  {
    frameReady = true;
    *bytesDecoded = (Ipp64u)pDataIn->GetDataPointer() - ptrBefore;
    frameNumber++;
  }     

  return status;
}

Please help and let me know if there is a better way to do this?  The latency due to having to buffer up an unknown large amount of data is quite unacceptable.

0 Kudos
1 Reply
Stephen_V_1
Novice
189 Views
I am still looking for a solution to the problem I've described above, please provide assistance.
0 Kudos
Reply