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

Tiled IPP YUV422 image resizing results in visual artifacts

Mike_C1
Beginner
471 Views
 

I've been implementing tiled resizing using TBB with IPP resizing functions. All works well with the TBB tiled resizing sample code using the newer resizing API in IPP 8.2 update 1 (.e.g. ResizeFilterInit, ResizeFilter). I can divide the image vertically into groups of scan lines and the results are bytewise identical however many scan lines I use as the TBB grain size.

My problem concerns resizing YUV422. As far as I can tell newer resizing APIs for YUV422 so far only exist for nearest neighbour and linear interpolation. I'd like to use Supersampling, Lanczos or possibly cubic interpolation (often with antialiasing) for better quality.

My options seem to be:

For Lanczos and cubic ResizeYCbCr422 

For supersampling ResizeYUV422 (which is deprecated).

However I'm finding ResizeYCbCr gives different results when than image is tiled too finely - the individual slices end up getting vertically stretched or squashed slightly and the output image contains noticeable visual artifacts. The rule of thumb seems to be that the image can't be divided by more than the power of two that divides both the source and destination height or horizontally by half the highest power of two that divides the source and destination width. The same problem happens if not using TBB for tiling.

ResizeYUV422 with supersampling doesn't seem to allow any vertical tiling without changing the results.

Will Intel be implementing the newer style ResizeYUV422Lanczos and ResizeYUV422Super APIs any time soon so that I can move to the new resizing APIs which will hopefully allow seamless tiling? If not are there any workarounds? 

I doubt that it would be worthwhile in performance terms to upsample from YUV422 to YUV444, resize in YUV444 and then subsample back to YUV422. I also couldn't find any appropriate upsampling or downsampling primitives in IPP from a brief inspection. It sounds like taking the simple mean of two pixels for subsampling doesn't give good results with edges in images.

 

Thanks for any advice or suggestions,

0 Kudos
7 Replies
Chao_Y_Intel
Moderator
471 Views

Hi, 

With YUV422 image,  is it plane format ( All Y data of the image first, then U data, V data), or pixel format ( YUV are interlaced)? For plane format image, it can work with ResizeLanczos function with each channel. 

Thanks,
Chao

 

0 Kudos
Mike_C1
Beginner
471 Views

The data is interleaved three channel YUV 4:2:2 so in bytes the layout is something like:

y0 u0 y1 v0 y2 u2 y3 v2 y4 u4 y5 v4

The y channel is full resolution and the u and v channels are sub-sampled to half resolution horizontally (e.g u0, u2, u4, etc).

Surely treating this as a 4 channel image will give the wrong results. The u and v channel results will be correct but the y channel will be resized as two separate sub-sampled channels y0 y2 y4 etc and y1 y3 y5 etc. Sharp y contours will produce completely different values. Or am I missing something here?

EDIT: OK, I misread your post. It's not planar so I can't use the resizing primitives on each plan individually.

0 Kudos
Mike_C1
Beginner
471 Views

Slight update:

If I allow a handful of 1 bit differences then ResizeYUV422 with supersampling seems to be subject to exactly the same power-of-two-greatest-common-divisor tiling limitations as ResizeYCbCr. 

I am a bit concerned that ResizeYUV422 is deprecated though as it's currently the only way of doing YUV422 supersampling resizing until ResizeYUV422Super is available.

 
0 Kudos
Valentin_K_Intel
Employee
471 Views

Hi Mike,

Thank you for the notification about ResizeYCbCr tiling problem. Could you please provide a code sample to reproduce the problem?
To request a new API for YUV422 resize with supersampling interpolation you can submit the feature request via Intel Premier Support.

 

Best regards,
Valentin

0 Kudos
Mike_C1
Beginner
471 Views

Thanks.

I'm having a lot of problems accessing premier support. I have a valid serial number with support until April. I can log into my downloads page but the intel premier support link at https://premier.intel.com/ says I am unauthorised. Even the 'contact us' link at https://registrationcenter.intel.com/support/ refuses me access.  I'm not allowed to re-register my serial number. I've already activated premier support for my serial number in the registration centre.  Who can I contact to sort this out?

I have a working self contained cfix unit test that demonstrates the problem but it's somewhat complex. I can strip it down to something simpler.

0 Kudos
Mike_C1
Beginner
471 Views

As a quick sanity test, how should I calculate the source slice ROI from the destination slice ROI for these older APIs ResizeYUV422 and ResizeYCbCr422?

Using ippiResizeGetSrcRoi_8u gives the wrong results. Using linear scaling and rounding down gives correct results but only up to the tiling limitations mentioned above.

 

			srcOffset.x       = (dstOffset.x		* m_SrcSize.width)  / m_DstSize.width;
			srcRoiSize.width  = (dstSizeT.width		* m_SrcSize.width)  / m_DstSize.width;
			srcOffset.y       = (dstOffset.y		* m_SrcSize.height) / m_DstSize.height;
			srcRoiSize.height = (dstSizeT.height	* m_SrcSize.height) / m_DstSize.height;

 

Using linear scaling results with rounding up gives the same results as rounding down surprisingly.

			srcOffset.x       = ((dstOffset.x		* m_SrcSize.width)  + m_DstSize.width  - 1) / m_DstSize.width;
			srcRoiSize.width  = ((dstSizeT.width	* m_SrcSize.width)  + m_DstSize.width  - 1) / m_DstSize.width;
			srcOffset.y       = ((dstOffset.y		* m_SrcSize.height) + m_DstSize.height - 1) / m_DstSize.height;
			srcRoiSize.height = ((dstSizeT.height	* m_SrcSize.height) + m_DstSize.height - 1) / m_DstSize.height;
0 Kudos
Chao_Y_Intel
Moderator
471 Views

Mike C wrote:

Thanks.

I'm having a lot of problems accessing premier support. I have a valid serial number with support until April. I can log into my downloads page but the intel premier support link at https://premier.intel.com/ says I am unauthorised. Even the 'contact us' link at https://registrationcenter.intel.com/support/ refuses me access.  I'm not allowed to re-register my serial number. I've already activated premier support for my serial number in the registration centre.  Who can I contact to sort this out?

I have a working self contained cfix unit test that demonstrates the problem but it's somewhat complex. I can strip it down to something simpler.

Mike,  here is the place you can support on your accont issues:

https://software.intel.com/en-us/forums/intel-software-development-products-download-registration-licensing

Thanks,
Chao

 

0 Kudos
Reply