Community
cancel
Showing results for 
Search instead for 
Did you mean: 
marco_lopes
Beginner
157 Views

Deinterlacing

Hello all,

I'm trying to deinterlace a video but somehow it's not working well.

I receive a 4:2:2 non-planar video in YCbCr. This is fix and garateed.
I give the user an option to de-interlace the video. I've included the code.
The thing is that when i use the deinterlacing path, the video shows strange artifacts. It shows for example some of left part of the video in the right corner, and this looks like its interlaced.
So it keeps some lines of the left part in the correct position, and the other parts somewhere else.
As it's messing with the step. Does anyone have an idea what's wrong ?
Thank you.

: There is something else that I don't know why it's happening. When the video is rotated, I notice some vertical lines on it whenever I make a fast movement in front of the cameras. When the video is normal - in landscape - there are no artifacts. I would expect some horizontal lines.
The unny thing is that I've used the nvidia rotation to rotate the display, and again, the vertical lines... why does it happen only when the video is somehow rotated ?

Another thing, If I use ippiCbYCr422ToYCbCr420_8u_C2P3R instead of the interlace method, the artifacts are there as well. The error must be on the ippiYCbCr420ToBGR_8u_P3C3R function.

Marco

if (m_deinterlace) {
//reorder bytes
ippError = ippiYCbCr422ToCbYCr422_8u_C2R(pAuxIn, m_srcStep, m_auxiliarBuffer,
m_auxiliarBufferStep, m_srcSize);
if (ippError == 0) {
// convert to planar data, de-interlacing
ippError = ippiCbYCr422ToYCbCr420_Interlace_8u_C2P3R(
m_auxiliarBuffer, m_auxiliarBufferStep, m_planarBuffer, m_planarStep, m_srcSize);
if (ippError == 0) {
// convert to non-planar RGB
ippError = ippiYCbCr420ToBGR_8u_P3C3R(m_planarBuffer, m_planarStep,
m_auxiliarBuffer, m_auxiliarBufferStep, reducedSize);
if (ippError != 0)
DbgOutString(L" convert to RGB Failed!! --- ");
} else {
DbgOutString(L" deinterlace --- Failed!! --- ");
}
} else {
DbgOutString(L" reordering --- Failed!! --- ");
}
// convert to RGB
} else {
ippError = ippiYCbCr422ToBGR_8u_C2C3R(pAuxIn, m_srcStep, m_auxiliarBuffer,
&n bsp; m_auxiliarBufferStep, reducedSize);
}
0 Kudos
11 Replies
Vladimir_Dudnik
Employee
157 Views

Hello,

if you pay attention to IPP documentation you may notice that ippiCbYCr422ToYCbCr420_Interlace_8u_C2P3R function do not do de-interlacing. It convert image from one format to other.

We do have in IPP functions which were specifically designed to do de-interlacing:
ippiDeinterlaceMotionAdaptive_8u_C1
ippiDeinterlaceBlend_8u_C1
ippiDeinterlaceFilterTriangle_8u_C1R
ippiDeinterlaceMedianThreshold_8u_C1R
ippiDeinterlaceEdgeDetect_8u_C1R
ippiDeinterlaceFilterCAVT_8u_C1R
ippiMedian_8u_P3C1R

you can see example of their usage in audio-video-codec sample, color-converter component, file umc_deinterlacing.cpp

Regards,
Vladimir

ILevi1
Valued Contributor I
157 Views

Vladimir,

When you are mentioning that code sample I believe there is a bug "hidden" in it:

  int field = (in->GetPictureStructure() & PS_TOP_FIELD_FIRST) ? 1 : 0;

  if (NULL == in || NULL == out) {
    return UMC_ERR_NULL_PTR;
  }

NULL check should come before dereferencing the pointer (in->GetPicture...).

Moreover, it doesn't explain how to use ippiDeinterlaceMotionAdaptive_8u_C1 which seems the most interesting one.

Finally, I really don't understand why those functions operate only on a single channel thus requiring splitting an RGBA image, multiple invocations and merging to RGBA afterwards.

Vladimir_Dudnik
Employee
157 Views

Hi Igor,
good catch, I'll inform appropriate developers.
Will try to find a sample for function you mention also.
Regards,
Vladimir

ILevi1
Valued Contributor I
157 Views

Quoting - vdudnik
Hi Igor,
good catch, I'll inform appropriate developers.
Will try to find a sample for function you mention also.
Regards,
Vladimir

Vladimir,

Any progress on this? I would like to assess the speed and quality of IPP denterlace beforre I decide whether I should sit down and roll my own.

Vladimir_Dudnik
Employee
157 Views

Igor,
the issue with dereferencing pointer before check for NULL will be fixed in the next version fo IPP sample.
Regards,
Vladimir

ILevi1
Valued Contributor I
157 Views

Quoting - vdudnik
Igor,
the issue with dereferencing pointer before check for NULL will be fixed in the next version fo IPP sample.
Regards,
Vladimir

Frankly I am more concerned with getting a usage sample or a more detailed explanation/documentation as to how to use that deinterlace function I asked about (the one which isn't in a sample).

ILevi1
Valued Contributor I
157 Views

Quoting - Igor Levicki

Frankly I am more concerned with getting a usage sample or a more detailed explanation/documentation as to how to use that deinterlace function I asked about (the one which isn't in a sample).

Bump.

Vladimir_Dudnik
Employee
157 Views

Not ready yet, our developers are busy with other work, sorry.

Vladimir
ILevi1
Valued Contributor I
157 Views

Will we finally get the sample for the above function?
Vladimir_Dudnik
Employee
157 Views

Hi Igor,

Could you please checkprevioustopics on deinterlace functions which might be already address your question, for example http://software.intel.com/en-us/forums/showthread.php?t=77702&o=a&s=lr.

Regards,
Vladimir
ILevi1
Valued Contributor I
157 Views

I did, but apart from this thread which is totally confusing:
http://origin-software.intel.com/en-us/forums/showthread.php?t=78614

I failed to find a clear example how to use ippiDeinterlaceMotionAdaptive_8u_C1() to process color video.

Documentation for deinterlacing functions should explain the algorithm, state expected color format, and data layout in memory (i.e. planar, interleaved, top or bottom field first, etc) in addition to giving usage examples.

Any chance we get documentation update? How about you task those developers who wrote the functions with documenting them properly now?


Reply