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

How to implement UMC color space convert version 7

nchannon
Beginner
465 Views
Hi I am not sure how to implement and use the UMC colorconversion lib as I dont seem to find any samples that show how to implement it. Is there any samples on this lib that shows how to implement it and pass any color conversion sample
Thanks
0 Kudos
8 Replies
Ying_H_Intel
Employee
465 Views
Hi Nahannon,

Do you hope to use the only single UMc colorconversion lib ( color_space_converter.lib) or also use other UMC libraries? As the color_space_converter.lib is based on umc.lib and used after one codec, for example,ipp-samples\audio-video-codecs\application\umc_h264_dec_con itself is simple sample.
It is for H.264 decode, but it will use color_spack_converter.libduring the steps of post processing.

and other UMC sample, also use the library too, Getting Started with Intel IPP Unified Media Classes Sample.

If you just want to implement color conversion sample. as allofcolorconversion code are inumc_color_space_conversion.cpp. You can copy the code to your project, thenyou can use a color conversion independently.

Best Regards,
Ying
0 Kudos
nchannon
Beginner
465 Views
Hi Ying,
Yes I just wanted to use the color converter lib as im using intel media sdk to decode my h264 data stream as it supports the hardware decoding for the second and third generation i7 cpu. im not sure if version 7 of IPP supports hardware decoding and encoding if it dose how do I implement it?

I have found that importing these two header files

#include "ipp.h"

#include "ippcc.h"

I can call ippiYCbCr420ToBGR_8u_P3C4R(...) from ippcc.h why are there several versions of the color converter in IPP

Regards
Nigel

0 Kudos
nchannon
Beginner
465 Views
Hi Ying,
I have the color conversion working but I have one problem im converting from NV12 to YV12 using ippiYCbCr420ToYCrCb420_Filter_8u_P2P3R(...) thesixth paramater requires an array consisting of three step values for the YU12 Y,U,V values
I have set the Y value to the width of the image and I have set the U and V values to the width /2 of the image
I then convert the YU12 color space to RGB using

ippiYUV420ToRGB_8u_P3C3(..) this returns a perfect image except the RGB is reversed to BGR so I have used opencv cvtColor(src,dst,CV_BGR2RGB3) which works fine.
Now the problem arrises when I wanted to convert from YU12 to RGB32 using
ippiYUV420ToRGB_8u_P3AC4R(..) the second paramater requires the step in an array of 3 values I have set these to step[0] = width of image, step[1] = width/2 and step[2] = width/2 but now my image is not right unless I resize it to 1:4 of the original size so I think my step sizes are wrong can you help and show me what i might be doing wrong
Regards
Nigel

0 Kudos
Ying_H_Intel
Employee
465 Views
Hi Nigel,

Could you pleasetell usthe exact image width, height andall of the parameter 's values so we can see what is wrong?

Andone similiartopicabout NV12 and RGBfor your reference

http://software.intel.com/en-us/forums/showthread.php?t=85989&o=a&s=lr

Regards,
Ying

0 Kudos
nchannon
Beginner
465 Views
Hi Ying,
Im decoding each h264 frame using the intel media sdk after decoding the frame mfxFrameSurfice1 returns the following data height = 1200 width = 1600 stride = 1600
when converting the YU12 to RGB color spaceusing ippiYUV420ToRGB_8u_P3C3(..) im fine as I do not need to pass the step to this function but if I useippiYUV420ToRGB_8u_P3AC4R(..) which I want to use as I need RGB32then I get problems with the return RGB image as this function require the step size and before I can view correctly I must scale the RGB image to 1:4 of the original size. So I also then needed to use the opencv2 function cvtColor(..) to convert from BGR to RGB I couldnt use the IPP ippiSwapChannels_(..) as it also wanted the step size which I beleive is where my problem is.
Regards
Nigel

0 Kudos
Ying_H_Intel
Employee
465 Views
Hi Nigel,

the concept of step size isthestride in bytes of imagerow.
In most of case,it isequal to the image Width*sizeof(datatype)*Channel.
But sometimes, it is not, especially forbmp image, which required 4bytes aligns, may pad zero at the end of row. So it may be(Width*sizeof(datatype)*Channel+3)/4.

In general, if RGB32 is4 byte aligned, as 1600 is 4x.it should be rightto set Steps as


srcStep[0]=stride;
srcStep[1]=stride/2;
srcStep[1]=stride/2;
dstStep = 4*strides; (RGB32, AC4R, the pixel is like RGBa RGBa.. and the stride is 4 x image widths).

Best Regards,
Ying
IppStatus ippiYUV420ToRGB_AC4Rconst Ipp8u* const pSrc[3], int srcStep[3], Ipp8u* pDst, int dstStep, IppiSize roiSize);

0 Kudos
nchannon
Beginner
465 Views
Hi Ying,
All works now thanks, The problem was opencv2 when creating a Mat I was using CV_8UC3 for an RGBA image where I should of used CV_8UC4 after converting the colour space from NV12 to YV12 to RGB32 so my IPP code was already working correctly live and learn.
Can you tell me if IPP7 supports hardware decoding / encoding for H264 like intel media SDK.
Thanks
Nigel
0 Kudos
Ying_H_Intel
Employee
465 Views
Hi Nigel,

Nice to know all works now.

IPP7 don't support hardware decode/encoding andAs i know, no plan in foreseen years.
Somediscussion about IPP and Media SDK for your reference

http://software.intel.com/en-us/forums/showthread.php?t=79985

Best Regards,
Ying
0 Kudos
Reply