Pārlūkot izejas kodu

Improve readability of shader selecting based on pixel format, add more bayer formats

Kristian Vos 7 mēneši atpakaļ
vecāks
revīzija
cd3266466e
1 mainītis faili ar 25 papildinājumiem un 8 dzēšanām
  1. 25 8
      src/gles2_debayer.c

+ 25 - 8
src/gles2_debayer.c

@@ -19,14 +19,31 @@ gles2_debayer_new(int format)
 
         int shader = 0;
 
-        if (pixfmt == V4L2_PIX_FMT_SBGGR8 || pixfmt == V4L2_PIX_FMT_SGBRG8 ||
-            pixfmt == V4L2_PIX_FMT_SGRBG8 || pixfmt == V4L2_PIX_FMT_SRGGB8 ||
-            pixfmt == V4L2_PIX_FMT_SBGGR10P || pixfmt == V4L2_PIX_FMT_SGBRG10P ||
-            pixfmt == V4L2_PIX_FMT_SGRBG10P || pixfmt == V4L2_PIX_FMT_SRGGB10P) {
-                shader = SHADER_DEBAYER;
-        } else if (pixfmt == V4L2_PIX_FMT_YUYV) {
-                shader = SHADER_YUV;
-        } else {
+        switch (pixfmt) {
+                case V4L2_PIX_FMT_SBGGR8:
+                case V4L2_PIX_FMT_SGBRG8:
+                case V4L2_PIX_FMT_SGRBG8:
+                case V4L2_PIX_FMT_SRGGB8:
+                case V4L2_PIX_FMT_SBGGR10P:
+                case V4L2_PIX_FMT_SGBRG10P:
+                case V4L2_PIX_FMT_SGRBG10P:
+                case V4L2_PIX_FMT_SRGGB10P:
+                case V4L2_PIX_FMT_SBGGR10:
+                case V4L2_PIX_FMT_SGBRG10:
+                case V4L2_PIX_FMT_SGRBG10:
+                case V4L2_PIX_FMT_SRGGB10:
+                case V4L2_PIX_FMT_SBGGR12:
+                case V4L2_PIX_FMT_SGBRG12:
+                case V4L2_PIX_FMT_SGRBG12:
+                case V4L2_PIX_FMT_SRGGB12:
+                        shader = SHADER_DEBAYER;
+                        break;
+                case V4L2_PIX_FMT_YUYV:
+                        shader = SHADER_YUV;
+                        break;
+        }
+
+        if (shader == 0) {
                 return NULL;
         }