gralloc: Add option for YCrCb venus camera preview
On judypn (LG V40) camera preview has red/blue colors
switched with HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS but
HAL_PIXEL_FORMAT_YCrCb_420_SP breaks camera preview
entirely.
When using HAL_PIXEL_FORMAT_YCrCb_420_SP_VENUS camera
preview works fine, with correct colors.
Change-Id: I84ffcbbeb66acf4401294de6b4f3cf846c7530b9
diff --git a/gralloc/Android.mk b/gralloc/Android.mk
index 2c2382d..4dffade 100644
--- a/gralloc/Android.mk
+++ b/gralloc/Android.mk
@@ -42,6 +42,8 @@
ifeq ($(TARGET_USES_YCRCB_CAMERA_PREVIEW),true)
LOCAL_CFLAGS += -DUSE_YCRCB_CAMERA_PREVIEW
+else ifeq ($(TARGET_USES_YCRCB_VENUS_CAMERA_PREVIEW),true)
+ LOCAL_CFLAGS += -DUSE_YCRCB_CAMERA_PREVIEW_VENUS
endif
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps)
diff --git a/gralloc/gr_utils.cpp b/gralloc/gr_utils.cpp
index ceb5e69..2050834 100644
--- a/gralloc/gr_utils.cpp
+++ b/gralloc/gr_utils.cpp
@@ -1337,6 +1337,8 @@
} else {
#ifdef USE_YCRCB_CAMERA_PREVIEW
gr_format = HAL_PIXEL_FORMAT_YCrCb_420_SP; // NV21 preview
+#elif USE_YCRCB_CAMERA_PREVIEW_VENUS
+ gr_format = HAL_PIXEL_FORMAT_YCrCb_420_SP_VENUS; // NV21 preview
#else
gr_format = HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS; // NV12 preview
#endif