]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/external-libkmsxx.git/blobdiff - libkmstest/conv.cpp
libkmstest: add EXIT()
[android/external-libkmsxx.git] / libkmstest / conv.cpp
index b716020de2bc26afed447cceb60cefbe3656f99d..cd5f8d6006c905e7a30dd8d6ab61321eb92be4e7 100644 (file)
@@ -1,13 +1,12 @@
 #include <drm_fourcc.h>
 #include <stdexcept>
 
-#include "dumbframebuffer.h"
+#include "kms++.h"
 #include "color.h"
-#include "conv.h"
 
 namespace kms
 {
-static RGB read_rgb(const DumbFramebuffer& fb, int x, int y)
+static RGB read_rgb(DumbFramebuffer& fb, int x, int y)
 {
        uint32_t *pc = (uint32_t *)(fb.map(0) + fb.stride(0) * y);
 
@@ -16,13 +15,13 @@ static RGB read_rgb(const DumbFramebuffer& fb, int x, int y)
        return RGB((c >> 16) & 0xff, (c >> 8) & 0xff, c & 0xff);
 }
 
-static YUV read_rgb_as_yuv(const DumbFramebuffer& fb, int x, int y)
+static YUV read_rgb_as_yuv(DumbFramebuffer& fb, int x, int y)
 {
        RGB rgb = read_rgb(fb, x, y);
        return YUV(rgb);
 }
 
-static void fb_rgb_to_packed_yuv(DumbFramebuffer& dst_fb, const DumbFramebuffer& src_fb)
+static void fb_rgb_to_packed_yuv(DumbFramebuffer& dst_fb, DumbFramebuffer& src_fb)
 {
        unsigned w = src_fb.width();
        unsigned h = src_fb.height();
@@ -35,13 +34,13 @@ static void fb_rgb_to_packed_yuv(DumbFramebuffer& dst_fb, const DumbFramebuffer&
                        YUV yuv2 = read_rgb_as_yuv(src_fb, x + 1, y);
 
                        switch (dst_fb.format()) {
-                       case DRM_FORMAT_UYVY:
+                       case PixelFormat::UYVY:
                                dst[x * 2 + 0] = (yuv1.u + yuv2.u) / 2;
                                dst[x * 2 + 1] = yuv1.y;
                                dst[x * 2 + 2] = (yuv1.v + yuv2.v) / 2;
                                dst[x * 2 + 3] = yuv2.y;
                                break;
-                       case DRM_FORMAT_YUYV:
+                       case PixelFormat::YUYV:
                                dst[x * 2 + 0] = yuv1.y;
                                dst[x * 2 + 1] = (yuv1.u + yuv2.u) / 2;
                                dst[x * 2 + 2] = yuv2.y;
@@ -57,7 +56,7 @@ static void fb_rgb_to_packed_yuv(DumbFramebuffer& dst_fb, const DumbFramebuffer&
        }
 }
 
-static void fb_rgb_to_semiplanar_yuv(DumbFramebuffer& dst_fb, const DumbFramebuffer& src_fb)
+static void fb_rgb_to_semiplanar_yuv(DumbFramebuffer& dst_fb, DumbFramebuffer& src_fb)
 {
        unsigned w = src_fb.width();
        unsigned h = src_fb.height();
@@ -92,7 +91,7 @@ static void fb_rgb_to_semiplanar_yuv(DumbFramebuffer& dst_fb, const DumbFramebuf
        }
 }
 
-static void fb_rgb_to_rgb565(DumbFramebuffer& dst_fb, const DumbFramebuffer& src_fb)
+static void fb_rgb_to_rgb565(DumbFramebuffer& dst_fb, DumbFramebuffer& src_fb)
 {
        unsigned w = src_fb.width();
        unsigned h = src_fb.height();
@@ -114,20 +113,20 @@ static void fb_rgb_to_rgb565(DumbFramebuffer& dst_fb, const DumbFramebuffer& src
        }
 }
 
-void color_convert(DumbFramebuffer& dst, const DumbFramebuffer &src)
+void color_convert(DumbFramebuffer& dst, DumbFramebuffer &src)
 {
        switch (dst.format()) {
-       case DRM_FORMAT_NV12:
-       case DRM_FORMAT_NV21:
+       case PixelFormat::NV12:
+       case PixelFormat::NV21:
                fb_rgb_to_semiplanar_yuv(dst, src);
                break;
 
-       case DRM_FORMAT_YUYV:
-       case DRM_FORMAT_UYVY:
+       case PixelFormat::YUYV:
+       case PixelFormat::UYVY:
                fb_rgb_to_packed_yuv(dst, src);
                break;
 
-       case DRM_FORMAT_RGB565:
+       case PixelFormat::RGB565:
                fb_rgb_to_rgb565(dst, src);
                break;