jaqquery / libyuv

Automatically exported from code.google.com/p/libyuv
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

ARGBRotate not working correctly for kRotate270 #382

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Call ARGBRotate() on RGB32 image (640*480)
2. src_stride=640*4, dst_stride=640*4, 

What is the expected output? What do you see instead?
==> Resulting image is garbled with blocks not rotated and placed in between 
(pls chk attached image)

What version of the product are you using? On what operating system?
==> Tried on ubuntu 12.04 64-bit. 

Please provide any additional information below.
==> Works like a charm with kRotate90 and kRotate180. (no change in rest of the 
arguments compared to kRotate270)

Original issue reported on code.google.com by mandetan...@gmail.com on 21 Nov 2014 at 7:26

Attachments:

GoogleCodeExporter commented 8 years ago
If your source is 640x480 and you rotate by 90 or 270, the destination should 
be 480x640.  The destination buffer should be 480x640 with a stride of 480*4.

Original comment by fbarch...@google.com on 22 Nov 2014 at 3:50

GoogleCodeExporter commented 8 years ago
Thanks. That worked. Strange thing is, it worked for 90 and resulted in a 
480x480 image (no error). Still, changing the destination stride is the correct 
way to do it.

Original comment by mandetan...@gmail.com on 24 Nov 2014 at 8:20

GoogleCodeExporter commented 8 years ago
Thanks for feedback.

Note that ARGBRotate is a naive SSE2 implementation, so not fully efficient - 
it reads 4 pixels and stores 16 bytes at a time.
The more efficient way is implemented by YUV, doing a transpose of an 8x8 block.

Rotate by 180 is recently optimized further for both SSE2 and AVX2.  (Mirror is 
used with negative stride to implement rotate by 180)
SSE2 uses pshufd instead of pshufb.
https://code.google.com/p/libyuv/source/detail?r=1176
AVX2 ported to GCC
https://code.google.com/p/libyuv/source/detail?r=1173
Support odd widths
https://code.google.com/p/libyuv/source/detail?r=1172

Original comment by fbarch...@google.com on 24 Nov 2014 at 7:32