YUV data to BMP file

YUV data to BMP file

stsybikov's picture

Hi,

I have the issue to save YUV 1920x1080 data that I received from the video stream (single frame) as bitmap file. The created bitmap image has three separate gray pictures. The size of full image is correct 1920x1080

My sample code:

CIppImage src(1920,1080,3,3);

src.Attach(1920,1080,3,3, pFrameBuffer, 0);

src.Color(IC_YCBCR);

src.Sampling(IS_411);

src.ComponentOrder(0);

src.Format(IF_FIXED);

PARAMS_BITMAP params_bmp;

err = SaveImageBMP(src,params_bmp, fileout);

I tried to use SameImageBMP function from picnic and uic_transcoder_con samples - the same result.

I am able to save YUV buffer as bitmap file using standard bitmap functionality with correct size and colors but I want to use Intel process to do this.

Any suggestion what I did wrong.

Thank you in advance,

Sergey

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Chao Y (Intel)'s picture

Hello,
I checked the SaveImageBMP() function code. I only take the following three color space:
...
switch(image.NChannels())
{
case 1: imageCn.ColorSpec().SetEnumColorSpace(Grayscale); break;
case 3: imageCn.ColorSpec().SetEnumColorSpace(BGR); break;
case 4: imageCn.ColorSpec().SetEnumColorSpace(BGRA); break;
default:
break;
}

so, you need to covert the YUV data to BGR data first, than save to the BMP file.

Thanks,
Chao

stsybikov's picture

Hi Chao:
OK I will try do that.

The other question. Do you know where video and image encoding have been processed when I used Intel API? On the Intel chip? Or on the PC RAM?

Thank you.

Sergey

Chao Y (Intel)'s picture

Hi Sergey,
I am not quite sure I understand the question. basically, Intel IPP is software encoder/decoder, so the encoding and decoding parts are processed by the CPUs.

Thanks,
Chao

Login to leave a comment.