diff options
author | Sergio Garcia Murillo <sergio.garcia.murillo@gmail.com> | 2022-03-30 11:20:30 +0200 |
---|---|---|
committer | libyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-03-31 15:30:53 +0000 |
commit | 4589081cea3dc5364dc433f9a20e67706fd3e29c (patch) | |
tree | 80b8051d34052257fc9bf760a0cd1c48ad6f22ef /source/planar_functions.cc | |
parent | f4d25308467cbd50c2706a46fa0ddcef939e715a (diff) | |
download | libyuv-4589081cea3dc5364dc433f9a20e67706fd3e29c.tar.gz |
Add I422 and I210 functions
Bug: webrtc:13826
Change-Id: I68235a668abecf76133f7b89472b192b1442bed4
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3557217
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/planar_functions.cc')
-rw-r--r-- | source/planar_functions.cc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/source/planar_functions.cc b/source/planar_functions.cc index 43dc1892..9ff4afe0 100644 --- a/source/planar_functions.cc +++ b/source/planar_functions.cc @@ -299,6 +299,49 @@ int I444Copy(const uint8_t* src_y, return 0; } +// Copy I210. +LIBYUV_API +int I210Copy(const uint16_t* src_y, + int src_stride_y, + const uint16_t* src_u, + int src_stride_u, + const uint16_t* src_v, + int src_stride_v, + uint16_t* dst_y, + int dst_stride_y, + uint16_t* dst_u, + int dst_stride_u, + uint16_t* dst_v, + int dst_stride_v, + int width, + int height) { + int halfwidth = (width + 1) >> 1; + if (!src_u || !src_v || !dst_u || !dst_v || width <= 0 || height == 0) { + return -1; + } + // Negative height means invert the image. + if (height < 0) { + height = -height; + src_y = src_y + (height - 1) * src_stride_y; + src_u = src_u + (height - 1) * src_stride_u; + src_v = src_v + (height - 1) * src_stride_v; + src_stride_y = -src_stride_y; + src_stride_u = -src_stride_u; + src_stride_v = -src_stride_v; + } + + if (dst_y) { + libyuv::CopyPlane_16(src_y, src_stride_y, dst_y, dst_stride_y, width, + height); + } + // Copy UV planes. + libyuv::CopyPlane_16(src_u, src_stride_u, dst_u, dst_stride_u, halfwidth, + height); + libyuv::CopyPlane_16(src_v, src_stride_v, dst_v, dst_stride_v, halfwidth, + height); + return 0; +} + // Copy I400. LIBYUV_API int I400ToI400(const uint8_t* src_y, |