- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've been experimenting with the following code to convert UYUV to NV12:
void UYVYToUVURow(const std::uint8_t * src_uyvy, int src_stride_uyvy, uint8_t* dst_uv, int width) { for (int x = 0; x < width; x += 2, src_uyvy += 4, dst_uv += 2) { dst_uv[0] = (src_uyvy[0] + src_uyvy[src_stride_uyvy + 0] + 1) >> 1; dst_uv[1] = (src_uyvy[2] + src_uyvy[src_stride_uyvy + 2] + 1) >> 1; } } void UYVYToYRow(const uint8_t* src_uyvy, uint8_t* dst_y, int width) { for (int x = 0; x < width - 1; x += 2, src_uyvy += 4) { dst_y= src_uyvy[1]; dst_y[x + 1] = src_uyvy[3]; } } int UYVYToNV12(const std::uint8_t * src_uyvy, std::uint8_t * dst_y, std::uint8_t * dst_uv, int src_stride_uyvy, int dst_stride_y, int dst_stride_uv, int width, int height) { for (int y = 0; y < height - 1; y += 2) { UYVYToUVURow(src_uyvy, src_stride_uyvy, dst_uv, width); UYVYToYRow(src_uyvy, dst_y, width); UYVYToYRow(src_uyvy + src_stride_uyvy, dst_y + dst_stride_y, width); src_uyvy += src_stride_uyvy * 2; dst_y += dst_stride_y * 2; dst_uv += dst_stride_uv; } return 0; }
(found it on the internets). It works but I don't like the performance on HD sized images (1280 x 720 for example). I ran VTune on the UYVYToNV12 function and the average fetch latency was 7 cycles. So the algorithm is probably close to optimal already (it doesn't do much really does it) and there were few if any cache misses. Everything I tried like reordering code, splitting into two Y loops and so on only made it slower.
Is this the kind of thing I could do using VPP?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi There,
Currently UYUV to NV12 does not support by MSDK.
Color space conversion are support by MSDK can refer to "Table 2: Color Conversion Support in VPP* " in Page 7 in https://software.intel.com/sites/default/files/managed/47/49/mediasdk-man.pdf
Best Regards,
Zachary
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. I see it does YUY2 conversion. Does this happen in hardware or does the driver to it in software, I wonder?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, YUY2 is support, and YUY2 and UYUV are similar, but UYUV is not support. maybe you interesting Intel IPP (https://software.intel.com/en-us/intel-ipp), maybe you can find some functions help to do this.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page