[scenic] Move yuv //garnet -> //src

Break this out into its own separate lib from the scenic implementation,
because clients use it too.

SCN-1393 #comment
SCN-1398 #comment

Change-Id: I790b6cad9017b439db17783ecc9e354e7440c979
diff --git a/garnet/examples/ui/yuv_to_image_pipe/BUILD.gn b/garnet/examples/ui/yuv_to_image_pipe/BUILD.gn
index 8702ba4..66bddb3 100644
--- a/garnet/examples/ui/yuv_to_image_pipe/BUILD.gn
+++ b/garnet/examples/ui/yuv_to_image_pipe/BUILD.gn
@@ -17,7 +17,6 @@
   ]
 
   deps = [
-    "//garnet/lib/ui/yuv",
     "//garnet/public/lib/component/cpp",
     "//garnet/public/lib/fsl",
     "//garnet/public/lib/ui/base_view/cpp",
@@ -25,6 +24,7 @@
     "//sdk/fidl/fuchsia.ui.scenic",
     "//sdk/lib/fidl/cpp",
     "//sdk/lib/images/cpp",
+    "//src/ui/lib/yuv",
     "//zircon/public/lib/async-cpp",
     "//zircon/public/lib/async-loop-cpp",
     "//zircon/public/lib/fbl",
diff --git a/garnet/examples/ui/yuv_to_image_pipe/yuv_base_view.cc b/garnet/examples/ui/yuv_to_image_pipe/yuv_base_view.cc
index 67c4b18..5ec03cf 100644
--- a/garnet/examples/ui/yuv_to_image_pipe/yuv_base_view.cc
+++ b/garnet/examples/ui/yuv_to_image_pipe/yuv_base_view.cc
@@ -11,7 +11,7 @@
 
 #include <iostream>
 
-#include "garnet/lib/ui/yuv/yuv.h"
+#include "src/ui/lib/yuv/yuv.h"
 
 namespace yuv_to_image_pipe {
 
diff --git a/garnet/lib/ui/gfx/BUILD.gn b/garnet/lib/ui/gfx/BUILD.gn
index 72701f6..9596b74 100644
--- a/garnet/lib/ui/gfx/BUILD.gn
+++ b/garnet/lib/ui/gfx/BUILD.gn
@@ -58,8 +58,8 @@
     "//src/ui/lib/escher",
   ]
   deps = [
-    "//garnet/lib/ui/yuv",
     "//sdk/lib/images/cpp",
+    "//src/ui/lib/yuv",
   ]
 }
 
diff --git a/garnet/lib/ui/gfx/tests/BUILD.gn b/garnet/lib/ui/gfx/tests/BUILD.gn
index 2ed3be9..e7e7337 100644
--- a/garnet/lib/ui/gfx/tests/BUILD.gn
+++ b/garnet/lib/ui/gfx/tests/BUILD.gn
@@ -135,7 +135,6 @@
   include_dirs = [ "//src/ui/lib/escher" ]
   deps = [
     ":testing_deps",
-    "//garnet/lib/ui/yuv:yuv",
     "//garnet/public/lib/fsl",
     "//garnet/public/lib/gtest",
     "//garnet/testing/views",
@@ -150,6 +149,7 @@
     "//src/lib/fxl/test:gtest_main",
     "//src/ui/lib/escher",
     "//src/ui/lib/glm_workaround",
+    "//src/ui/lib/yuv",
     "//zircon/public/lib/async-cpp",
   ]
 }
diff --git a/garnet/lib/ui/gfx/tests/scenic_pixel_test.cc b/garnet/lib/ui/gfx/tests/scenic_pixel_test.cc
index 4e8f55f..67b7863 100644
--- a/garnet/lib/ui/gfx/tests/scenic_pixel_test.cc
+++ b/garnet/lib/ui/gfx/tests/scenic_pixel_test.cc
@@ -36,7 +36,7 @@
 #include "src/ui/lib/escher/impl/vulkan_utils.h"
 #include "src/ui/lib/escher/hmd/pose_buffer.h"
 #include "src/ui/lib/escher/test/gtest_vulkan.h"
-#include "garnet/lib/ui/yuv/yuv.h"
+#include "src/ui/lib/yuv/yuv.h"
 
 namespace {
 
diff --git a/garnet/lib/ui/gfx/util/image_formats.cc b/garnet/lib/ui/gfx/util/image_formats.cc
index 8778039..173f45a 100644
--- a/garnet/lib/ui/gfx/util/image_formats.cc
+++ b/garnet/lib/ui/gfx/util/image_formats.cc
@@ -4,9 +4,10 @@
 
 #include "lib/ui/gfx/util/image_formats.h"
 
-#include "garnet/lib/ui/yuv/yuv.h"
-#include "lib/images/cpp/images.h"
+#include <lib/images/cpp/images.h>
+
 #include "src/lib/fxl/logging.h"
+#include "src/ui/lib/yuv/yuv.h"
 
 namespace scenic_impl {
 namespace gfx {
@@ -123,7 +124,8 @@
   // in_stride / 2 (at least until we encounter any "YV12" where that doesn't
   // work).
   const uint8_t* y_base = in_ptr;
-  const uint8_t* u_base = in_ptr + height * in_stride + height / 2 * in_stride / 2;
+  const uint8_t* u_base =
+      in_ptr + height * in_stride + height / 2 * in_stride / 2;
   const uint8_t* v_base = in_ptr + height * in_stride;
 
   for (uint32_t y = 0; y < height; y += 2) {
@@ -181,8 +183,8 @@
       if (image_info.transform == fuchsia::images::Transform::FLIP_HORIZONTAL) {
         return [](void* out, const void* in, uint32_t width, uint32_t height) {
           ConvertYuy2ToBgraAndMirror(reinterpret_cast<uint8_t*>(out),
-                                     reinterpret_cast<const uint8_t*>(in), width,
-                                     height);
+                                     reinterpret_cast<const uint8_t*>(in),
+                                     width, height);
         };
       } else {
         FXL_DCHECK(bits_per_pixel % 8 == 0);
diff --git a/garnet/lib/ui/yuv/BUILD.gn b/src/ui/lib/yuv/BUILD.gn
similarity index 99%
rename from garnet/lib/ui/yuv/BUILD.gn
rename to src/ui/lib/yuv/BUILD.gn
index 67ba920..016d704e 100644
--- a/garnet/lib/ui/yuv/BUILD.gn
+++ b/src/ui/lib/yuv/BUILD.gn
@@ -7,6 +7,7 @@
     "yuv.cc",
     "yuv.h",
   ]
+
   cflags = [
     # Always optimize regardless of --release or debug.
     "-O3",
diff --git a/garnet/lib/ui/yuv/yuv.cc b/src/ui/lib/yuv/yuv.cc
similarity index 97%
rename from garnet/lib/ui/yuv/yuv.cc
rename to src/ui/lib/yuv/yuv.cc
index 9e300bd..a8c719a 100644
--- a/garnet/lib/ui/yuv/yuv.cc
+++ b/src/ui/lib/yuv/yuv.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "garnet/lib/ui/yuv/yuv.h"
+#include "src/ui/lib/yuv/yuv.h"
 
 #include <algorithm>
 #include <cmath>
diff --git a/garnet/lib/ui/yuv/yuv.h b/src/ui/lib/yuv/yuv.h
similarity index 74%
rename from garnet/lib/ui/yuv/yuv.h
rename to src/ui/lib/yuv/yuv.h
index 5cd7d2e..b194071 100644
--- a/garnet/lib/ui/yuv/yuv.h
+++ b/src/ui/lib/yuv/yuv.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef GARNET_LIB_UI_YUV_YUV_H_
-#define GARNET_LIB_UI_YUV_YUV_H_
+#ifndef SRC_UI_LIB_YUV_YUV_H_
+#define SRC_UI_LIB_YUV_YUV_H_
 
 #include <stdint.h>
 
@@ -13,4 +13,4 @@
 
 }  // namespace yuv
 
-#endif  // GARNET_LIB_UI_YUV_YUV_H_
+#endif  // SRC_UI_LIB_YUV_YUV_H_