How to avoid artifacts while modifying the code for MPEG4 packetization ?

How to avoid artifacts while modifying the code for MPEG4 packetization ?

Hi there,

I have modified the function EncodeISlice in mp4_enc_vop.cpp to reflect the following :

nBitsInBuf = slice->cBS.GetNumBits() - prevnBits;
// Number of bits for the macroblock
nBits = slice->cBS.GetNumBits(MBsPtr, MBsBitOff);

if(nBitsInBuf > mVideoPacketLength)
Ipp32u numBytesToCopy;
Ipp32u EndBitOffset;
Ipp8u *TempBuffer;
Ipp32u numBitsRemaining;
Ipp32u ind;

// mark MBs in current VideoPacket as invalid for prediction

MBcurr->block[1].validPredIntra = 0;

for (i = 0; i < IPP_MIN(mbnvp, mNumMacroBlockPerRow + 1); i++)
MBcurr[-i].block[2].validPredIntra = MBcurr[-i].block[3].validPredIntra = 0;
MBcurr[-i].block[4].validPredIntra = MBcurr[-i].block[5].validPredIntra = 0;

What I am doing is that :

Once the number of bytes in the output encoded b
uffer exceeds the RTP MTU length,

I copy the encoded macroblock into a temporary buffer, then add the resync marker before this macroblock and mark the current macroblock invalid for MV prediction.

It's different fro what u guys do ,where when the number of bits for macroblock exceeds videopacket length, u put the resync marker after the encoded macroblock.

But, due to my modification, the depacketized and the decoded picture has some artifacts, like small bands appearing here and there, I am not sure whether I need to do anything more to fix it.

Please find the sample video file attached.

The IVOP distance is 90, BVOP is 0.

Only the IVOPS are big and get split into multiple RTP packets,but once the IVOP is screwed, everything else follows :)

Thanks a lot for your help,


p.s : Please rename the attache file to .m4v before playing it

Downloadvideo/mpeg encoded_mpeg4_qcif_30fps.mpeg58.14 KB
1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.