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

H.264 Encoder getting Access violation error during GetFrame function call

Bhanuprakash-reddy
548 Views
Hi,

I have getting access violation error in memcopy.asm file during a function call H264VideoEncoder::GetFrame(MediaData *in, MediaData *out) for encoding a specific frame.

I got a Access violation error below palce in memcopy.asm file,

LeadUp2:
and edx,ecx ;U - trailing byte count
mov al,[esi] ;V - get first byte from source

mov [edi],al ;U - write second byte to destination -----------> Access violation error
mov al,[esi+1] ;V - get second byte from source

Thanks,
Bhanuprakash.
0 Kudos
1 Solution
Ying_H_Intel
Employee
548 Views

Hello Bhanuprakash,

What platform and Which IPP sample version are you using? Are you call it from mulithreads? It is better if you canprovide a piece of input frame (YUV file andinput parameter)for us to see what is the problem.

Here is a sample h.264 encoder main.cpp<<http://software.intel.com/en-us/articles/getting-started-with-intel-ipp-unified-media-classes-sample/> for your reference.

Best Regards,
Ying

View solution in original post

0 Kudos
2 Replies
Ying_H_Intel
Employee
549 Views

Hello Bhanuprakash,

What platform and Which IPP sample version are you using? Are you call it from mulithreads? It is better if you canprovide a piece of input frame (YUV file andinput parameter)for us to see what is the problem.

Here is a sample h.264 encoder main.cpp<<http://software.intel.com/en-us/articles/getting-started-with-intel-ipp-unified-media-classes-sample/> for your reference.

Best Regards,
Ying
0 Kudos
Bhanuprakash-reddy
548 Views
Hi Ying,

I have solved my problem referring with intel-ipp-unified-media-classes-sample which you are provided.

Previously I createdDataOut Object like below:

MediaData *m_pMediaOut = NULL;

if( m_pMediaOut == NULL)
{
m_pMediaOut = new MediaData();
m_pMediaOut->Alloc(4*m_nWidth*m_nHeight); // this line of code created problem
}

after that I changed to m_pMediaOut->SetBufferPointer(chEncodedData,nWidth*nHeight);

My Sample code is like below:

int CH264Codec::EncodeData(unsigned char *chYUVData,int nWidth, int nHeight, int nYUVSize, unsigned char *chEncodedData)
{
if(chYUVData == NULL)
return 0;

m_nEncodedSize = 0;

try
{
UMC::Status ret = UMC_OK;

if(m_pEncoderParams && m_pVideoIn )
{
ret = m_pVideoIn->SetBufferPointer(chYUVData,nYUVSize);// It is for streaming data
m_pVideoIn->SetDataSize(nYUVSize);

m_pVideoIn->SetTime((m_nFramesEncoded+1)/m_pEncoderParams->info.framerate);
m_pEncoderParams->numEncodedFrames = m_nFramesEncoded;
m_pCodec->SetParams(m_pEncoderParams);
m_nFramesEncoded++;

m_pMediaOut->SetBufferPointer(chEncodedData,nWidth*nHeight);
}

if( m_pCodec && m_pVideoIn && m_pMediaOut )
{
ret = m_pCodec->GetFrame(m_pVideoIn, m_pMediaOut);
if ( (ret != UMC_OK) && (ret != UMC_ERR_NOT_ENOUGH_DATA) && (ret != UMC_ERR_END_OF_STREAM))
{
logger.Print(LL_INTERR, PANLOG("H264 encoding failed\n"));
m_pVideoIn->ReleaseImage();
m_pVideoIn->Reset();
m_pMediaOut->Reset();

return UMC_ERR_FAILED;
}
}

if ( ret == UMC_OK )
m_nEncodedSize = (Ipp32s)m_pMediaOut->GetDataSize();

m_pVideoIn->ReleaseImage();
m_pVideoIn->Reset();
m_pMediaOut->Reset();

}
catch(...)
{
logger.Print(LL_INTERR, PANLOG("[CH264Codec::EncodeData] Exception - Error: %ld\n"), GetLastError());
return m_nEncodedSize;
}
return m_nEncodedSize;
}

0 Kudos
Reply