aboutsummaryrefslogtreecommitdiff
path: root/source/convert.cc
diff options
context:
space:
mode:
authorSergio Garcia Murillo <sergio.garcia.murillo@gmail.com>2022-03-30 11:20:30 +0200
committerlibyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-03-31 15:30:53 +0000
commit4589081cea3dc5364dc433f9a20e67706fd3e29c (patch)
tree80b8051d34052257fc9bf760a0cd1c48ad6f22ef /source/convert.cc
parentf4d25308467cbd50c2706a46fa0ddcef939e715a (diff)
downloadlibyuv-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/convert.cc')
-rw-r--r--source/convert.cc41
1 files changed, 41 insertions, 0 deletions
diff --git a/source/convert.cc b/source/convert.cc
index d0116503..5ce7826c 100644
--- a/source/convert.cc
+++ b/source/convert.cc
@@ -523,6 +523,47 @@ int I422ToI420(const uint8_t* src_y,
dst_v, dst_stride_v, width, height, src_uv_width, height);
}
+LIBYUV_API
+int I422ToI210(const uint8_t* src_y,
+ int src_stride_y,
+ const uint8_t* src_u,
+ int src_stride_u,
+ const uint8_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;
+ }
+
+ // Convert Y plane.
+ libyuv::Convert8To16Plane(src_y, src_stride_y, dst_y, dst_stride_y, 1024,
+ width, height);
+ // Convert UV planes.
+ libyuv::Convert8To16Plane(src_u, src_stride_u, dst_u, dst_stride_u, 1024,
+ halfwidth, height);
+ libyuv::Convert8To16Plane(src_v, src_stride_v, dst_v, dst_stride_v, 1024,
+ halfwidth, height);
+ return 0;
+}
+
// TODO(fbarchard): Implement row conversion.
LIBYUV_API
int I422ToNV21(const uint8_t* src_y,