Add libtonemap library

libtonemap is a vendor-available static library which provides a single
point where the definitions of tone mapping operations can be shared.
This faciliates sharing tone mapping operations between system libraries
and vendor libraries without making invasive changes to the framework.

The canonical use-case for this library is matching the tone-mapping
curves between DPU composition and GPU composition for the display.
Although not done in this patch, this library may be linked into
libhwui, for propagating the tone mapping operation into TextureView.

The initial design for this library is to expose a Tonemapper class,
which can return:
1. A shader string describing the tonemapper operation, which may be
inserted into any other shader string.
2. A list of shader uniforms for binding to the final shader

A later patch will allow for computing the tone mapping curve on the
CPU, which is useful for unit testing, and optionally for generating a
LUT without firing up the GPU.

Bug: 200310159
Ignore-AOSP-First: new internal-only lib
Test: libtonemap_test
Change-Id: I7f1353e0f456ec5f371e31754b2965c9b44aa125
diff --git a/libs/tonemap/Android.bp b/libs/tonemap/Android.bp
new file mode 100644
index 0000000..231a342
--- /dev/null
+++ b/libs/tonemap/Android.bp
@@ -0,0 +1,37 @@
+// Copyright 2021 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "frameworks_native_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["frameworks_native_license"],
+}
+
+cc_library_static {
+    name: "libtonemap",
+    vendor_available: true,
+
+    export_include_dirs: ["include"],
+    local_include_dirs: ["include"],
+
+    shared_libs: [
+        "android.hardware.graphics.common-V3-ndk",
+    ],
+    srcs: [
+        "tonemap.cpp",
+    ],
+}