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

How can I resize a 352x288 frame into a 800x600 one?

Detlev_Petersen
Beginner
2,707 Views

Dear members,

at the moment I am bounded to the IPP 7.0.2. I decode a 352x288 MPEG2 video. With GetFrame() of the IPP I get a decoded 352x288 frame in UYVY format.

Then I use a ippiCbYCr422ToYcbCr422_8u_C2R call to do a conversion from UYVY to YUY2.

The next call is a resize call ippiResizeYUV422_8u_C2R.

At last a conversion from YUY2 to UYVY with ippiYCbCr422ToCbYCr422_8u_C2R.

This works as far as the boundaries of the 352x288 frame is used as source and destination. If I try to use the resize call to scale my 352x288 to a 800x600 frame it does not work.

I guess I have to put my decoded 352x288 frame without scaling into a 800x600 one so that the decoded frame is the upper left corner of the 800x600 frame. After this I can use my resize call above to scale my little frame to the full size of a 800x600 one.

But how can I put my 352x288 frame into a 800x600 one?

Best regards

Detlev

 

 

 

0 Kudos
24 Replies
Detlev_Petersen
Beginner
468 Views

Hi Sergey,

now my saved frame has no turn/mirror effect. The last row comes first within the saved bitmap. Please see the attached bitmap.

The colors are wrong. They are blue instead of read and grey instead of black. I saw that are some functions to correct the saturation after a UYVY->RGB conversion. What can I do to get the correct colors?

For the community I attached my new sample of my InitScaling() call. This are the lines of code which scale the 352x288 video into 800x600 frames.

Ok, my last open issues are to chose the right color for the save frame as bitmap and to find the set-up error within the DirectDraw interface of my windows application.

Best regards,

Detlev

0 Kudos
Sergey_K_Intel
Employee
468 Views

Hi Detlev,

In my test one conversion is wrong. Look at the text below and correct your application accordingly. Hope it will help.

[cpp]

#if 0
    ippiYCbCr422ToCbYCr422_8u_C2R(dstYUV, dstYUVstep, dstYCbCr, dstYCbCrstep, largeSize);
/* Visual check */
    ippiCbYCr422ToYCbCr422_8u_C2R(dstYCbCr, dstYCbCrstep, dstYCbCr, dstYCbCrstep, largeSize);
    ippiYCbCr422ToRGB_8u_C2C3R(dstYCbCr, dstYCbCrstep, dstRGB, dstRGBstep, largeSize);
#else
    ippiYUV422ToRGB_8u_C2C3R(dstYUV, dstYUVstep, dstRGB, dstRGBstep, largeSize);
#endif

[/cpp]

Regards,
Sergey 

0 Kudos
Detlev_Petersen
Beginner
468 Views

Hi Sergey,

before writing one row to the bitmap file I swap the bytes for R and B in the RGB triple byte set. Then the colors are okay in my bitmap. I saw with help of a tool, that the values for R and B were changed. White and black colors were okay in the bitmap with the wrong colors before. This swap fixes in wrong colores in my saved bitmap for one frame.

Currently I am looking for the bug in the set-up of my DirectDraw interface. All resolutions for the created parent in client windows are on 800x600. At the moment and in the past I see and saw no reason for the 352x288 output. It seems to be a hidden setting that destroys my screen output.

Best regards,

Detlev

0 Kudos
Detlev_Petersen
Beginner
468 Views

Hi all,

please find attached some save frames as bitmap file. The frames were scaled by the IPP and different scaling methods like nearest neighbor, linear and cubic were used.

Yesterday I found the reason why the scaling via IPP were ok and the frame on the screen were limited to 352x288 instead of 800x600. After scaling by the IPP I found the code segment where the scaled frame is copied to the buffer which is used by Blt(). Due to the foreign code for me I supposed the buffer with the scaled frame as the one which is used by Blt(). This was wrong. Our player SW have to copy each video frame into the frame buffer for the DirectDraw interface. For example DirectDraw can be set up to 1280x720 frames as maximum and each 352x288 or 800x600 frame must be copied into the DirectDraw buffer before Blt() is called. A lack of comments made it difficult to understand this code segment faster in the right way.

I thank you very much for all support.

Best regards,

Detlev

0 Kudos
Reply