dong83615 / libyuv

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

UYVYToNV12 #466

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This function has been requested as a new feature.

UYVY and YUY2 are packed I422 formats.  Half width, Full height.
They are common on external usb webcams.

NV12 and NV21 are biplanar I420 formats.  Half width, Half height.  Y channel 
and a packed UV channel.
Common on mobile for textures and cameras for arm based platforms.

Original issue reported on code.google.com by fbarch...@google.com on 13 Jul 2015 at 6:10

GoogleCodeExporter commented 9 years ago
Hi, All,

We developed a patch to support UYVY->NV12/NV21, including NEON optimization. 
Please review it. We also uploaded the "before/after", which could help to 
review the patch more easily.

Thanks
Bo Fang

Original comment by marvell....@gmail.com on 14 Jul 2015 at 9:10

Attachments:

GoogleCodeExporter commented 9 years ago
Thinking about what this function/format does...

UYVY is U, Y0, V, Y1 in memory for 2 pixels.  half width, full height
YUY2 is Y0, U, Y1, V in memory for 2 pixels.  half width, full height

NV12 is Y channel and VU channel with half width, half height.
NV21 is Y channel and UV channel with half width, half height.

NV24 is Y channel and VU channel with half width, full height.
NV42 is Y channel and UV channel with half width, full height.

The split function could break this into Y's and UV's, producing NV24 and NV42.
The height needs subsampling to convert NV24 to NV12 and NV42 to NV21.

Original comment by fbarch...@chromium.org on 16 Jul 2015 at 10:32

GoogleCodeExporter commented 9 years ago
correction on NV12:
NV12 is Y channel and UV channel with half width, half height.
NV21 is Y channel and VU channel with half width, half height.
NV24 is Y channel and UV channel with half width, full height.
NV42 is Y channel and VU channel with half width, full height.

the process for YUY2ToNV12 or UYVYToNV12 can be done in 2 steps
SplitUVRow UYVY or YUY2 into 2 planes - Y and UV
InterpolateRow to merge 2 rows of UV into one.

Original comment by fbarch...@chromium.org on 16 Jul 2015 at 11:17

GoogleCodeExporter commented 9 years ago
YUY2ToNV12 and UYVYToNV12 have been implemented using a 2 step conversion.

SplitUV to break out Y channel from UV.
And InterpolateRow to blend 2 rows of UV.

Advantage of this technique is leveraging existing AVX2 and Neon64.

Original comment by fbarch...@chromium.org on 22 Jul 2015 at 10:43

GoogleCodeExporter commented 9 years ago

Original comment by fbarch...@chromium.org on 11 Aug 2015 at 12:26