libcsc: Add more csc methods from the hardkernel BSP
[GitHub/LineageOS/android_hardware_samsung_slsi_exynos5.git] / libcamera2 / ExynosCamera2.cpp
index c7cdd48c076e1c1997c9b0b6a568595474cd8d9e..e06f670604f6f193b25348ccd70c2f6f155420a0 100644 (file)
 
 namespace android {
 
+int32_t SUPPORT_THUMBNAIL_REAR_SIZE[3][2] =
+{
+    {160, 120},
+    {160, 90},
+    {144, 96}
+};
+
+int32_t SUPPORT_THUMBNAIL_FRONT_SIZE[4][2] =
+{
+    {160, 120},
+    {160, 160},
+    {160, 90},
+    {144, 96}
+};
+
 class Sensor {
 public:
     /**
@@ -90,7 +105,7 @@ const nsecs_t Sensor::kFrameDurationRange[2] =
 const uint8_t Sensor::kColorFilterArrangement = ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB;
 
 const uint32_t kAvailableFormats[5] = {
-        HAL_PIXEL_FORMAT_RAW_SENSOR,
+        HAL_PIXEL_FORMAT_RAW16,
         HAL_PIXEL_FORMAT_BLOB,
         HAL_PIXEL_FORMAT_RGBA_8888,
         HAL_PIXEL_FORMAT_YV12,
@@ -527,13 +542,23 @@ status_t ExynosCamera2::constructStaticInfo(camera_metadata_t **info,
 
     // android.jpeg
 
-    static const int32_t jpegThumbnailSizes[] = {
-            160, 120,
-            160, 160,
-            160, 90,
-            144, 96,
-              0, 0
-    };
+    size_t sizeOfThumbnailList = (cameraId) ? sizeof(SUPPORT_THUMBNAIL_FRONT_SIZE) /
+            sizeof(int32_t) : sizeof(SUPPORT_THUMBNAIL_REAR_SIZE) / sizeof(int32_t);
+
+    // Copy sizes from front or back camera
+    int32_t jpegThumbnailSizes[sizeOfThumbnailList + 2];
+
+    if (cameraId) {
+        memcpy(jpegThumbnailSizes, SUPPORT_THUMBNAIL_FRONT_SIZE,
+                sizeof(int32_t) * sizeOfThumbnailList);
+    } else {
+        memcpy(jpegThumbnailSizes, SUPPORT_THUMBNAIL_REAR_SIZE,
+                sizeof(int32_t) * sizeOfThumbnailList);
+    }
+
+    // Always include 0,0 size in list
+    jpegThumbnailSizes[sizeOfThumbnailList] = 0;
+    jpegThumbnailSizes[sizeOfThumbnailList + 1] = 0;
 
     ADD_OR_SIZE(ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES,
             jpegThumbnailSizes, sizeof(jpegThumbnailSizes)/sizeof(int32_t));