BuildRequires: pkgconfig(gstreamer-app-1.0)
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(ncurses)
+BuildRequires: pkgconfig(libdrm)
+BuildRequires: pkgconfig(glesv2)
+BuildRequires: pkgconfig(wayland-client)
+BuildRequires: pkgconfig(wayland-egl-tizen)
BuildRequires: gtest-devel
%endif
%manifest %{name}.manifest
%license LICENSE.APLv2
%{_libdir}/libmv_*helper.so
+%{_libdir}/libmv_visualizer.so
%{_libdir}/libmv_testsuite*.so
%{_bindir}/mv_*
%endif
add_subdirectory(${PROJECT_SOURCE_DIR}/image)
add_subdirectory(${PROJECT_SOURCE_DIR}/surveillance)
add_subdirectory(${PROJECT_SOURCE_DIR}/machine_learning)
-
add_subdirectory(${PROJECT_SOURCE_DIR}/visualizer)
add_subdirectory(image_helper)
add_subdirectory(video_helper)
add_subdirectory(testsuite_common)
+add_subdirectory(visualizer)
--- /dev/null
+project(mv_visualizer)
+cmake_minimum_required(VERSION 2.6...3.13)
+
+file(GLOB MV_VISUALIZER_SRC_LIST "${PROJECT_SOURCE_DIR}/src/*.cpp")
+
+find_package(OpenCV REQUIRED core highgui imgproc)
+
+if(NOT OpenCV_FOUND)
+ message(SEND_ERROR "Failed to find OpenCV")
+ return()
+endif()
+pkg_check_modules(${PROJECT_NAME}_DEP REQUIRED capi-media-tool libdrm wayland-egl glesv2 dlog)
+
+if(FORCED_STATIC_BUILD)
+ add_library(${PROJECT_NAME} STATIC ${MV_VISUALIZER_SRC_LIST})
+else()
+ add_library(${PROJECT_NAME} SHARED ${MV_VISUALIZER_SRC_LIST})
+endif()
+
+target_include_directories(${PROJECT_NAME} PUBLIC
+ ${${PROJECT_NAME}_DEP_INCLUDE_DIRS}
+ ${PROJECT_SOURCE_DIR}/include)
+target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS} ${${PROJECT_NAME}_DEP_LIBRARIES} mv_common)
+install(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
--- /dev/null
+/**
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#ifndef __MEDIA_VISION_UTIL_MATRIX_H__
+#define __MEDIA_VISION_UTIL_MATRIX_H__
+
+#ifndef M_PI
+#define M_PI (3.141592654f)
+#endif
+
+#define DEG_TO_RAD(degree) ( (M_PI/180.0f) * (degree) )
+#define RAD_TO_DEG(rad) ( (rad) * (180.0f/M_PI) )
+
+
+void matrix_translate(float *m, float x, float y, float z);
+void matrix_rotate(float *m, float angle, float x, float y, float z);
+void matrix_scale(float *m, float x, float y, float z);
+void matrix_mult(float *m, float *m1, float *m2);
+void matrix_identity(float *m);
+
+#endif /* __MEDIA_VISION_UTIL_MATRIX_H__ */
--- /dev/null
+/**
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#ifndef __MEDIA_VISION_UTIL_RENDER_2D_H__
+#define __MEDIA_VISION_UTIL_RENDER_2D_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <GLES2/gl2.h>
+
+#include <stdint.h>
+
+#define pixfmt_fourcc(a, b, c, d)\
+ ((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
+
+typedef struct _texture_2d_t
+{
+ uint32_t texid;
+ int width;
+ int height;
+ uint32_t format;
+} texture_2d_t;
+
+uint32_t create_2d_texture(void *imgbuf, int width, int height);
+int init_2d_renderer(int w, int h);
+int draw_2d_texture_ex(texture_2d_t *tex, int x, int y, int w, int h, int upsidedown);
+int egl_init_with_platform_window_surface(int gles_version, int depth_size, int stencil_size, int sample_num, int win_w, int win_h);
+int egl_swap();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MEDIA_VISION_UTIL_RENDER_2D_H__ */
+
--- /dev/null
+/**
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#ifndef __MEDIA_VISION_UTIL_VISUALIZER_2D_H__
+#define __MEDIA_VISION_UTIL_VISUALIZER_2D_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <mv_private.h>
+#include <mv_common.h>
+#include <GLES2/gl2.h>
+
+#include "util_render2d.h"
+#include "mv_common.h"
+
+#ifdef __cplusplus
+#include <cstddef>
+#include <cstdio>
+#else
+#include <stddef.h>
+#include <stdio.h>
+#endif
+
+int mv_util_visualizer_2d(mv_source_h source, unsigned int dwell);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __MEDIA_VISION_UTIL_VISUALIZER_2D_H__*/
--- /dev/null
+/**
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#ifndef __MEDIA_VISION_UTIL_VISUALIZER_3D_H__
+#define __MEDIA_VISION_UTIL_VISUALIZER_3D_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+#include "mv_common.h"
+
+int mv_util_visualizer_3d(mv_source_h source, int dwell);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __MEDIA_VISION_UTIL_VISUALIZER_3D_H__*/
--- /dev/null
+/**
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#ifndef _WINSYS_H_
+#define _WINSYS_H_
+
+struct Window;
+struct Display
+{
+ struct wl_display *wlDisplay;
+ struct wl_registry *wlRegistry;
+ struct wl_compositor *wlCompositor;
+ struct wl_shell *wlShell;
+ struct wl_pointer *pointer;
+ uint32_t serial;
+ struct Window *window;
+};
+
+struct Geometry {
+ int width, height;
+};
+
+struct Window {
+ struct Display *display;
+ struct wl_egl_window *wlEGLNativeWindow;
+ struct wl_surface *wlSurface;
+ struct wl_shell_surface *wlShellSurface;
+ struct wl_callback *callback;
+ int fullscreen, configured, opaque;
+ struct Geometry geometry,window_size;
+};
+
+void *winsys_init_native_display (void);
+void *winsys_init_native_window (void *dpy, int win_w, int win_h);
+
+#endif /* _WINSYS_H_ */
--- /dev/null
+/**
+ * Copyright(c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#include <mv_private.h>
+#include <math.h>
+
+#define M_PId180f (3.1415926f / 180.0f)
+#include "util_matrix.h"
+
+float vec3_length(float *v)
+{
+ return(float) sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
+}
+
+float vec3_normalize(float *v)
+{
+ float len, invLen;
+
+ len = vec3_length(v);
+ if(len == 0.0f){
+ return 0.0f;
+ }
+ invLen = 1.0f / len;
+
+ v[0] *= invLen;
+ v[1] *= invLen;
+ v[2] *= invLen;
+
+ return len;
+}
+
+static void turn_x(float *m, float cosA, float sinA)
+{
+ float m01, m02;
+ float m11, m12;
+ float m21, m22;
+ float m31, m32;
+ float mx01, mx02;
+ float mx11, mx12;
+ float mx21, mx22;
+ float mx31, mx32;
+
+ m01 = m[4]; //m->m01;
+ m02 = m[8]; //m->m02;
+ m11 = m[5]; //m->m11;
+ m12 = m[9]; //m->m12;
+ m21 = m[6]; //m->m21;
+ m22 = m[10]; //m->m22;
+ m31 = m[7]; //m->m31;
+ m32 = m[11]; //m->m32;
+
+ mx01 = cosA * m01;
+ mx02 = sinA * m01;
+
+ mx11 = cosA * m11;
+ mx12 = sinA * m11;
+
+ mx21 = cosA * m21;
+ mx22 = sinA * m21;
+
+ mx31 = cosA * m31;
+ mx32 = sinA * m31;
+
+ mx01 = sinA * m02 + mx01;
+ mx02 = cosA * m02 - mx02;
+
+ mx11 = sinA * m12 + mx11;
+ mx12 = cosA * m12 - mx12;
+
+ mx21 = sinA * m22 + mx21;
+ mx22 = cosA * m22 - mx22;
+
+ mx31 = sinA * m32 + mx31;
+ mx32 = cosA * m32 - mx32;
+
+ m[4] = mx01;
+ m[8] = mx02;
+
+ m[5] = mx11;
+ m[9] = mx12;
+
+ m[6] = mx21;
+ m[10] = mx22;
+
+ m[7] = mx31;
+ m[11] = mx32;
+}
+
+/*
+ * void turn_y(float *m, float cosA, float cosB)
+ * local rotation around Y-axis
+ * M = M * Ry
+ *
+ * | m00 m01 m02 m03 | | m00 m01 m02 m03 | | cosA 0 sinA 0 |
+ * | m10 m11 m12 m13 | = | m10 m11 m12 m13 | * | 0 1 0 0 |
+ * | m20 m21 m22 m23 | | m20 m21 m22 m23 | | -sinA 0 cosA 0 |
+ * | m30 m31 m32 m33 | | m30 m31 m32 m33 | | 0 0 0 1 |
+ */
+static void turn_y(float *m, float cosA, float sinA)
+{
+ float m00, m02;
+ float m10, m12;
+ float m20, m22;
+ float m30, m32;
+ float mx00, mx02;
+ float mx10, mx12;
+ float mx20, mx22;
+ float mx30, mx32;
+
+ m00 = m[0]; //m->m00;
+ m02 = m[8]; //m->m02;
+ m10 = m[1]; //m->m10;
+ m12 = m[9]; //m->m12;
+ m20 = m[2]; //m->m20;
+ m22 = m[10]; //m->m22;
+ m30 = m[3]; //m->m30;
+ m32 = m[11]; //m->m32;
+
+ mx00 = cosA * m00;
+ mx02 = sinA * m00;
+
+ mx10 = cosA * m10;
+ mx12 = sinA * m10;
+
+ mx20 = cosA * m20;
+ mx22 = sinA * m20;
+
+ mx30 = cosA * m30;
+ mx32 = sinA * m30;
+
+ mx00 = -sinA * m02 + mx00;
+ mx02 = cosA * m02 + mx02;
+
+ mx10 = -sinA * m12 + mx10;
+ mx12 = cosA * m12 + mx12;
+
+ mx20 = -sinA * m22 + mx20;
+ mx22 = cosA * m22 + mx22;
+
+ mx30 = -sinA * m32 + mx30;
+ mx32 = cosA * m32 + mx32;
+
+ m[0] = mx00;
+ m[8] = mx02;
+
+ m[1] = mx10;
+ m[9] = mx12;
+
+ m[2] = mx20;
+ m[10] = mx22;
+
+ m[3] = mx30;
+ m[11] = mx32;
+}
+
+/*
+ * void turn_z(float *m, float cosA, float sinA)
+ * local rotation around Z-axis
+ * M = M * Rz
+ *
+ * | m00 m01 m02 m03 | | m00 m01 m02 m03 | | cosA -sinA 0 0 |
+ * | m10 m11 m12 m13 | = | m10 m11 m12 m13 | * | sinA cosA 0 0 |
+ * | m20 m21 m22 m23 | | m20 m21 m22 m23 | | 0 0 1 0 |
+ * | m30 m31 m32 m33 | | m30 m31 m32 m33 | | 0 0 0 1 |
+ *
+ */
+static void turn_z(float *m, float cosA, float sinA)
+{
+ float m00, m01;
+ float m10, m11;
+ float m20, m21;
+ float m30, m31;
+ float mx00, mx01;
+ float mx10, mx11;
+ float mx20, mx21;
+ float mx30, mx31;
+
+ m00 = m[0]; //m->m00;
+ m01 = m[4]; //m->m01;
+ m10 = m[1]; //m->m10;
+ m11 = m[5]; //m->m11;
+ m20 = m[2]; //m->m20;
+ m21 = m[6]; //m->m21;
+ m30 = m[3]; //m->m30;
+ m31 = m[7]; //m->m31;
+
+ mx00 = cosA * m00;
+ mx01 = sinA * m00;
+
+ mx10 = cosA * m10;
+ mx11 = sinA * m10;
+
+ mx20 = cosA * m20;
+ mx21 = sinA * m20;
+
+ mx30 = cosA * m30;
+ mx31 = sinA * m30;
+
+ mx00 = sinA * m01 + mx00;
+ mx01 = cosA * m01 - mx01;
+
+ mx10 = sinA * m11 + mx10;
+ mx11 = cosA * m11 - mx11;
+
+ mx20 = sinA * m21 + mx20;
+ mx21 = cosA * m21 - mx21;
+
+ mx30 = sinA * m31 + mx30;
+ mx31 = cosA * m31 - mx31;
+
+ m[0] = mx00;
+ m[4] = mx01;
+ m[1] = mx10;
+ m[5] = mx11;
+ m[2] = mx20;
+ m[6] = mx21;
+ m[3] = mx30;
+ m[7] = mx31;
+}
+
+/************************************************************
+ Translate Matrix
+ M = M * T
+
+ | m00 m04 m08 m12 | | 1 0 0 x | | m00 m04 m08 (m00*x + m04*y + m08*z + m12) |
+ | m01 m05 m09 m13 | * | 0 1 0 y | = | m01 m05 m09 (m01*x + m05*y + m09*z + m13) |
+ | m02 m06 m10 m14 | | 0 0 1 z | | m02 m06 m10 (m02*x + m06*y + m10*z + m14) |
+ | m03 m07 m11 m15 | | 0 0 0 1 | | m03 m07 m11 (m03*x + m07*y + m11*z + m15) |
+***********************************************************/
+void matrix_translate(float *m, float x, float y, float z)
+{
+ float m00, m01, m02, m03;
+ float m04, m05, m06, m07;
+ float m08, m09, m10, m11;
+ float m12, m13, m14, m15;
+
+ m00 = m[ 0]; m04 = m[ 4]; m08 = m[ 8]; /* m12 = m[12]; */
+ m01 = m[ 1]; m05 = m[ 5]; m09 = m[ 9]; /* m13 = m[13]; */
+ m02 = m[ 2]; m06 = m[ 6]; m10 = m[10]; /* m14 = m[14]; */
+ m03 = m[ 3]; m07 = m[ 7]; m11 = m[11]; /* m15 = m[15]; */
+
+ m12 = m[12];
+ m13 = m[13];
+ m14 = m[14];
+ m15 = m[15];
+
+ m12 += m08 * z;
+ m13 += m09 * z;
+ m14 += m10 * z;
+ m15 += m11 * z;
+
+ m12 += m04 * y;
+ m13 += m05 * y;
+ m14 += m06 * y;
+ m15 += m07 * y;
+
+ m12 += m00 * x;
+ m13 += m01 * x;
+ m14 += m02 * x;
+ m15 += m03 * x;
+
+ m[12] = m12;
+ m[13] = m13;
+ m[14] = m14;
+ m[15] = m15;
+}
+
+/************************************************************
+ Rotate Matrix
+ | m00 m04 m08 m12 | | r00 r04 r08 0 |
+ | m01 m05 m09 m13 | * | r01 r05 r09 0 |
+ | m02 m06 m10 m14 | | r02 r06 r10 0 |
+ | m03 m07 m11 m15 | | 0 0 0 1 |
+
+ m00 = m00*r00 + m04*r01 + m08*r02
+ m01 = m01*r00 + m05*r01 + m09*r02
+ m02 = m02*r00 + m06*r01 + m10*r02
+ m03 = m03*r00 + m07*r01 + m11*r02
+
+ m04 = m00*r04 + m04*r05 + m08*r06
+ m05 = m01*r04 + m05*r05 + m09*r06
+ m06 = m02*r04 + m06*r05 + m10*r06
+ m07 = m03*r04 + m07*r05 + m11*r06
+
+ m08 = m00*r08 + m04*r09 + m08*r10
+ m09 = m01*r08 + m05*r09 + m09*r10
+ m10 = m02*r08 + m06*r09 + m10*r10
+ m11 = m03*r08 + m07*r09 + m11*r10
+
+ m12 = m12
+ m13 = m13
+ m14 = m14
+ m15 = m15
+***********************************************************/
+void matrix_rotate(float *m, float angle, float x, float y, float z)
+{
+ float v[3], angleRadian;
+ float sinA, cosA, cosA2;
+ float xcosA2, ycosA2, zcosA2;
+ float xsinA, ysinA, zsinA;
+
+ angleRadian = angle * M_PId180f;
+ sinA =(float)sin(angleRadian);
+ cosA =(float)cos(angleRadian);
+
+ /* for fast rotation around X-Axis/Y-Axis,and Z-Axis */
+ if(x == 0.0f && y == 0.0f && z != 0.0f){
+ if(z < 0.0f){
+ /* If the Axis of the Rotation is minus, Rotate Backwords */
+ sinA = -sinA;
+ }
+ /* Z Axis Rotateion */
+ turn_z(m, cosA, sinA);
+ return;
+ }else if(x == 0.0f && y != 0.0f && z == 0.0f){
+ if(y < 0.0f){
+ /* If the Axis of the Rotation is minus, Rotate Backwords */
+ sinA = -sinA;
+ }
+ /* Y Axis Rotation */
+ turn_y(m, cosA, sinA);
+ return;
+ }else if(x != 0.0f && y == 0.0f && z == 0.0f){
+ if(x < 0.0f){
+ /* If the Axis of the Rotation is minus, Rotate Backwords */
+ sinA = -sinA;
+ }
+ /* X Axis Rotation */
+ turn_x(m, cosA, sinA);
+ return;
+ }
+
+ {
+ float r00, r01, r02;
+ float r10, r11, r12;
+ float r20, r21, r22;
+
+ /* normalization of 3D-vector */
+ v[0] = x;
+ v[1] = y;
+ v[2] = z;
+ vec3_normalize(v);
+
+ x = v[0];
+ y = v[1];
+ z = v[2];
+
+ /* making rotation matrix */
+ cosA2 = 1.0f - cosA;
+ xsinA = x * sinA;
+ ysinA = y * sinA;
+ zsinA = z * sinA;
+ xcosA2 = x * cosA2;
+ ycosA2 = y * cosA2;
+ zcosA2 = z * cosA2;
+
+ r00 = x * xcosA2 + cosA;
+ r10 = y * xcosA2 + zsinA;
+ r20 = z * xcosA2 - ysinA;
+
+ r01 = x * ycosA2 - zsinA;
+ r11 = y * ycosA2 + cosA;
+ r21 = z * ycosA2 + xsinA;
+
+ r02 = x * zcosA2 + ysinA;
+ r12 = y * zcosA2 - xsinA;
+ r22 = z * zcosA2 + cosA;
+
+ /* multing with 3x3 rotating matrix. */
+ {
+ float fm0, fm1, fm2;
+ float mx, my, mz;
+
+ /* load 0th low of "m" */
+ fm0 = m[ 0]; fm1 = m[ 4]; fm2 = m[ 8]; /* fm3 = m[12]; */
+
+ mx = fm0 * r00;
+ my = fm0 * r01;
+ mz = fm0 * r02;
+
+ mx += fm1 * r10;
+ my += fm1 * r11;
+ mz += fm1 * r12;
+
+ mx += fm2 * r20;
+ my += fm2 * r21;
+ mz += fm2 * r22;
+
+ fm0 = m[ 1]; fm1 = m[ 5]; fm2 = m[ 9]; /* fm3 = m[13]; */
+
+ m[0] = mx; m[4] = my; m[8] = mz;
+
+ /* *************************** */
+ mx = fm0 * r00;
+ my = fm0 * r01;
+ mz = fm0 * r02;
+
+ mx += fm1 * r10;
+ my += fm1 * r11;
+ mz += fm1 * r12;
+
+ mx += fm2 * r20;
+ my += fm2 * r21;
+ mz += fm2 * r22;
+
+ fm0 = m[ 2]; fm1 = m[ 6]; fm2 = m[10]; /* m23 = m[14]; */
+
+ m[1] = mx; m[5] = my; m[9] = mz;
+
+ /* *************************** */
+ mx = fm0 * r00;
+ my = fm0 * r01;
+ mz = fm0 * r02;
+
+ mx += fm1 * r10;
+ my += fm1 * r11;
+ mz += fm1 * r12;
+
+ mx += fm2 * r20;
+ my += fm2 * r21;
+ mz += fm2 * r22;
+
+ fm0 = m[ 3]; fm1 = m[ 7]; fm2 = m[11]; /* m33 = m[15]; */
+
+ m[2] = mx; m[6] = my; m[10] = mz;
+
+ /* *************************** */
+ mx = fm0 * r00;
+ my = fm0 * r01;
+ mz = fm0 * r02;
+
+ mx += fm1 * r10;
+ my += fm1 * r11;
+ mz += fm1 * r12;
+
+ mx += fm2 * r20;
+ my += fm2 * r21;
+ mz += fm2 * r22;
+
+ m[3] = mx; m[7] = my; m[11] = mz;
+ }
+ }
+}
+
+/******************************************
+ Scale Matrix
+ | m00 m04 m08 m12 | | x 0 0 0 |
+ | m01 m05 m09 m13 | * | 0 y 0 0 |
+ | m02 m06 m10 m14 | | 0 0 z 0 |
+ | m03 m07 m11 m15 | | 0 0 0 1 |
+*******************************************/
+void matrix_scale(float *m, float x, float y, float z)
+{
+ float m00, m01, m02, m03;
+ float m04, m05, m06, m07;
+ float m08, m09, m10, m11;
+ /* float m12, m13, m14, m15; */
+
+ m00 = m[ 0]; m04 = m[ 4]; m08 = m[ 8]; /* m12 = m[12]; */
+ m01 = m[ 1]; m05 = m[ 5]; m09 = m[ 9]; /* m13 = m[13]; */
+ m02 = m[ 2]; m06 = m[ 6]; m10 = m[10]; /* m14 = m[14]; */
+ m03 = m[ 3]; m07 = m[ 7]; m11 = m[11]; /* m15 = m[15]; */
+
+ m00 = m00 * x;
+ m04 = m04 * y;
+ m08 = m08 * z;
+
+ m01 = m01 * x;
+ m05 = m05 * y;
+ m09 = m09 * z;
+
+ m02 = m02 * x;
+ m06 = m06 * y;
+ m10 = m10 * z;
+
+ m03 = m03 * x;
+ m07 = m07 * y;
+ m11 = m11 * z;
+
+ m[ 0] = m00;
+ m[ 4] = m04;
+ m[ 8] = m08;
+
+ m[ 1] = m01;
+ m[ 5] = m05;
+ m[ 9] = m09;
+
+ m[ 2] = m02;
+ m[ 6] = m06;
+ m[10] = m10;
+
+ m[ 3] = m03;
+ m[ 7] = m07;
+ m[11] = m11;
+}
+
+/******************************************
+ Multiply Matrix
+ M = M1 * M2
+*******************************************/
+void matrix_mult(float *m, float *m1, float *m2)
+{
+ float fm0, fm1, fm2, fm3;
+ float fpm00, fpm01, fpm02, fpm03;
+ float fpm10, fpm11, fpm12, fpm13;
+ float fpm20, fpm21, fpm22, fpm23;
+ float fpm30, fpm31, fpm32, fpm33;
+ float x, y, z, w;
+
+ /* load pMb */
+ fpm00 = m2[0];
+ fpm01 = m2[4];
+ fpm02 = m2[8];
+ fpm03 = m2[12];
+
+ fpm10 = m2[1];
+ fpm11 = m2[5];
+ fpm12 = m2[9];
+ fpm13 = m2[13];
+
+ fpm20 = m2[2];
+ fpm21 = m2[6];
+ fpm22 = m2[10];
+ fpm23 = m2[14];
+
+ fpm30 = m2[3];
+ fpm31 = m2[7];
+ fpm32 = m2[11];
+ fpm33 = m2[15];
+
+ /* process 0-line of "m1" */
+ fm0 = m1[0];
+ fm1 = m1[4];
+ fm2 = m1[8];
+ fm3 = m1[12];
+
+ x = fm0 * fpm00;
+ y = fm0 * fpm01;
+ z = fm0 * fpm02;
+ w = fm0 * fpm03;
+
+ x += fm1 * fpm10;
+ y += fm1 * fpm11;
+ z += fm1 * fpm12;
+ w += fm1 * fpm13;
+
+ x += fm2 * fpm20;
+ y += fm2 * fpm21;
+ z += fm2 * fpm22;
+ w += fm2 * fpm23;
+
+ x += fm3 * fpm30;
+ y += fm3 * fpm31;
+ z += fm3 * fpm32;
+ w += fm3 * fpm33;
+
+ fm0 = m1[1];
+ fm1 = m1[5];
+ fm2 = m1[9];
+ fm3 = m1[13];
+
+ m[0] = x;
+ m[4] = y;
+ m[8] = z;
+ m[12] = w;
+
+ /* *************************** */
+ x = fm0 * fpm00;
+ y = fm0 * fpm01;
+ z = fm0 * fpm02;
+ w = fm0 * fpm03;
+
+ x += fm1 * fpm10;
+ y += fm1 * fpm11;
+ z += fm1 * fpm12;
+ w += fm1 * fpm13;
+
+ x += fm2 * fpm20;
+ y += fm2 * fpm21;
+ z += fm2 * fpm22;
+ w += fm2 * fpm23;
+
+ x += fm3 * fpm30;
+ y += fm3 * fpm31;
+ z += fm3 * fpm32;
+ w += fm3 * fpm33;
+
+ fm0 = m1[2];
+ fm1 = m1[6];
+ fm2 = m1[10];
+ fm3 = m1[14];
+
+ m[1] = x;
+ m[5] = y;
+ m[9] = z;
+ m[13] = w;
+
+ /* *************************** */
+ x = fm0 * fpm00;
+ y = fm0 * fpm01;
+ z = fm0 * fpm02;
+ w = fm0 * fpm03;
+
+ x += fm1 * fpm10;
+ y += fm1 * fpm11;
+ z += fm1 * fpm12;
+ w += fm1 * fpm13;
+
+ x += fm2 * fpm20;
+ y += fm2 * fpm21;
+ z += fm2 * fpm22;
+ w += fm2 * fpm23;
+
+ x += fm3 * fpm30;
+ y += fm3 * fpm31;
+ z += fm3 * fpm32;
+ w += fm3 * fpm33;
+
+ fm0 = m1[3];
+ fm1 = m1[7];
+ fm2 = m1[11];
+ fm3 = m1[15];
+
+ m[2] = x;
+ m[6] = y;
+ m[10] = z;
+ m[14] = w;
+
+ /* *************************** */
+ x = fm0 * fpm00;
+ y = fm0 * fpm01;
+ z = fm0 * fpm02;
+ w = fm0 * fpm03;
+
+ x += fm1 * fpm10;
+ y += fm1 * fpm11;
+ z += fm1 * fpm12;
+ w += fm1 * fpm13;
+
+ x += fm2 * fpm20;
+ y += fm2 * fpm21;
+ z += fm2 * fpm22;
+ w += fm2 * fpm23;
+
+ x += fm3 * fpm30;
+ y += fm3 * fpm31;
+ z += fm3 * fpm32;
+ w += fm3 * fpm33;
+
+ m[3] = x;
+ m[7] = y;
+ m[11] = z;
+ m[15] = w;
+}
+
+void matrix_identity(float *m)
+{
+ m[ 0] = 1.0f; m[ 4] = 0.0f; m[ 8] = 0.0f; m[12] = 0.0f;
+ m[ 1] = 0.0f; m[ 5] = 1.0f; m[ 9] = 0.0f; m[13] = 0.0f;
+ m[ 2] = 0.0f; m[ 6] = 0.0f; m[10] = 1.0f; m[14] = 0.0f;
+ m[ 3] = 0.0f; m[ 7] = 0.0f; m[11] = 0.0f; m[15] = 1.0f;
+}
--- /dev/null
+/**
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#include <mv_private.h>
+#include <math.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include "util_matrix.h"
+#include "util_render2d.h"
+#include "winsys.h"
+
+/* ------------------------------------------------------ *
+ * shader for FillColor
+ * ------------------------------------------------------ */
+static char vs_fill[] = " \n\
+ \n\
+attribute vec4 a_Vertex; \n\
+uniform mat4 u_PMVMatrix; \n\
+void main (void) \n\
+{ \n\
+ gl_Position = u_PMVMatrix * a_Vertex; \n\
+} ";
+
+static char fs_fill[] = " \n\
+ \n\
+precision mediump float; \n\
+uniform vec4 u_Color; \n\
+ \n\
+void main (void) \n\
+{ \n\
+ gl_FragColor = u_Color; \n\
+} ";
+
+/* ------------------------------------------------------ *
+ * shader for Texture
+ * ------------------------------------------------------ */
+static char vs_tex[] = " \n\
+attribute vec4 a_Vertex; \n\
+attribute vec2 a_TexCoord; \n\
+varying vec2 v_TexCoord; \n\
+uniform mat4 u_PMVMatrix; \n\
+ \n\
+void main (void) \n\
+{ \n\
+ gl_Position = u_PMVMatrix * a_Vertex; \n\
+ v_TexCoord = a_TexCoord; \n\
+} \n";
+
+static char fs_tex[] = " \n\
+precision mediump float; \n\
+varying vec2 v_TexCoord; \n\
+uniform sampler2D u_sampler; \n\
+uniform vec4 u_Color; \n\
+ \n\
+void main (void) \n\
+{ \n\
+ gl_FragColor = texture2D (u_sampler, v_TexCoord); \n\
+ gl_FragColor *= u_Color; \n\
+} \n";
+
+/* ------------------------------------------------------ *
+ * shader for External Texture
+ * ------------------------------------------------------ */
+static char fs_extex[] = " \n\
+#extension GL_NV_EGL_stream_consumer_external: enable \n\
+#extension GL_OES_EGL_image_external : enable \n\
+precision mediump float; \n\
+varying vec2 v_TexCoord; \n\
+uniform samplerExternalOES u_sampler; \n\
+uniform vec4 u_Color; \n\
+ \n\
+void main (void) \n\
+{ \n\
+ gl_FragColor = texture2D (u_sampler, v_TexCoord); \n\
+ gl_FragColor *= u_Color; \n\
+} \n";
+
+/* ------------------------------------------------------ *
+ * shader for MATLAB Jet colormap
+ * ------------------------------------------------------ */
+static char fs_cmap_jet[] =" \n\
+precision mediump float; \n\
+varying vec2 v_TexCoord; \n\
+uniform sampler2D u_sampler; \n\
+uniform vec4 u_Color; \n\
+ \n\
+float cmap_jet_red(float x) { \n\
+ if (x < 0.7) { \n\
+ return 4.0 * x - 1.5; \n\
+ } else { \n\
+ return -4.0 * x + 4.5; \n\
+ } \n\
+} \n\
+ \n\
+float cmap_jet_green(float x) { \n\
+ if (x < 0.5) { \n\
+ return 4.0 * x - 0.5; \n\
+ } else { \n\
+ return -4.0 * x + 3.5; \n\
+ } \n\
+} \n\
+ \n\
+float cmap_jet_blue(float x) { \n\
+ if (x < 0.3) { \n\
+ return 4.0 * x + 0.5; \n\
+ } else { \n\
+ return -4.0 * x + 2.5; \n\
+ } \n\
+} \n\
+ \n\
+vec4 colormap_jet(float x) { \n\
+ float r = clamp(cmap_jet_red(x), 0.0, 1.0); \n\
+ float g = clamp(cmap_jet_green(x), 0.0, 1.0); \n\
+ float b = clamp(cmap_jet_blue(x), 0.0, 1.0); \n\
+ return vec4(r, g, b, 1.0); \n\
+} \n\
+ \n\
+void main (void) \n\
+{ \n\
+ vec4 src_col = texture2D (u_sampler, v_TexCoord); \n\
+ gl_FragColor = colormap_jet (src_col.r); \n\
+ gl_FragColor *= u_Color; \n\
+} \n";
+
+
+/* ------------------------------------------------------ *
+ * shader for YUYV Texture
+ * +--+--+--+--+
+ * | R| G| B| A|
+ * +--+--+--+--+
+ * |Y0| U|Y1| V|
+ * +--+--+--+--+
+ * ------------------------------------------------------ */
+static char vs_tex_yuyv[] = " \n\
+attribute vec4 a_Vertex; \n\
+attribute vec2 a_TexCoord; \n\
+varying vec2 v_TexCoord; \n\
+varying vec2 v_TexCoordPix; \n\
+uniform mat4 u_PMVMatrix; \n\
+uniform vec2 u_TexDim; \n\
+ \n\
+void main (void) \n\
+{ \n\
+ gl_Position = u_PMVMatrix * a_Vertex; \n\
+ v_TexCoord = a_TexCoord; \n\
+ v_TexCoordPix = a_TexCoord * u_TexDim; \n\
+} \n";
+
+static char fs_tex_yuyv[] = " \n\
+precision mediump float; \n\
+varying vec2 v_TexCoord; \n\
+varying vec2 v_TexCoordPix; \n\
+uniform sampler2D u_sampler; \n\
+uniform vec4 u_Color; \n\
+ \n\
+void main (void) \n\
+{ \n\
+ vec2 evenodd = mod(v_TexCoordPix, 2.0); \n\
+ vec3 yuv, rgb; \n\
+ vec4 texcol = texture2D (u_sampler, v_TexCoord); \n\
+ if (evenodd.x < 1.0) \n\
+ { \n\
+ yuv.r = texcol.r; /* Y */ \n\
+ yuv.g = texcol.g - 0.5; /* U */ \n\
+ yuv.b = texcol.a - 0.5; /* V */ \n\
+ } \n\
+ else \n\
+ { \n\
+ yuv.r = texcol.b; /* Y */ \n\
+ yuv.g = texcol.g - 0.5; /* U */ \n\
+ yuv.b = texcol.a - 0.5; /* V */ \n\
+ } \n\
+ \n\
+ rgb = mat3 ( 1, 1, 1, \n\
+ 0, -0.34413, 1.772, \n\
+ 1.402, -0.71414, 0) * yuv; \n\
+ gl_FragColor = vec4(rgb, 1.0); \n\
+ gl_FragColor *= u_Color; \n\
+} \n";
+
+
+#define SHADER_NUM 5
+static char *s_shader[SHADER_NUM * 2] =
+{
+ vs_fill, fs_fill,
+ vs_tex, fs_tex,
+ vs_tex, fs_extex,
+ vs_tex, fs_cmap_jet,
+ vs_tex_yuyv, fs_tex_yuyv
+};
+
+typedef struct shader_obj_t
+{
+ GLuint program;
+ GLint loc_vtx;
+ GLint loc_nrm;
+ GLint loc_clr;
+ GLint loc_uv;
+ GLint loc_tex;
+ GLint loc_mtx;
+ GLint loc_mtx_nrm;
+} shader_obj_t;
+
+static shader_obj_t s_sobj[SHADER_NUM];
+static int s_loc_mtx[SHADER_NUM];
+static int s_loc_color[SHADER_NUM];
+static int s_loc_texdim[SHADER_NUM];
+
+static EGLDisplay s_dpy;
+static EGLSurface s_sfc;
+static EGLContext s_ctx;
+
+GLuint
+create_2d_texture (void *imgbuf, int width, int height)
+{
+ GLuint texid;
+
+ glGenTextures (1, &texid );
+ glBindTexture (GL_TEXTURE_2D, texid);
+
+ glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+ glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
+
+ glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA,
+ width, height, 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, imgbuf);
+
+ return texid;
+}
+
+
+static EGLConfig find_egl_config (int r, int g, int b, int a, int d,
+ int s, int ms, int sfc_type, int ver)
+{
+ EGLint num_conf, i;
+ EGLBoolean ret;
+ EGLConfig conf = 0, *conf_array = NULL;
+
+ EGLint config_attribs[] = {
+ EGL_RED_SIZE, 8, /* 0 */
+ EGL_GREEN_SIZE, 8, /* 2 */
+ EGL_BLUE_SIZE, 8, /* 4 */
+ EGL_ALPHA_SIZE, 8, /* 6 */
+ EGL_DEPTH_SIZE, EGL_DONT_CARE, /* 8 */
+ EGL_STENCIL_SIZE, EGL_DONT_CARE, /* 10 */
+ EGL_SAMPLES, EGL_DONT_CARE, /* 12 */
+ EGL_SURFACE_TYPE , EGL_WINDOW_BIT, /* 14 */
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+ EGL_NONE
+ };
+
+ config_attribs[ 1] = r;
+ config_attribs[ 3] = g;
+ config_attribs[ 5] = b;
+ config_attribs[ 7] = a;
+ config_attribs[ 9] = d;
+ config_attribs[11] = s;
+ config_attribs[13] = ms;
+ config_attribs[15] = sfc_type; /* EGL_WINDOW_BIT/EGL_STREAM_BIT_KHR */
+
+ switch (ver){
+ case 1:
+ case 2: config_attribs[17] = EGL_OPENGL_ES2_BIT;
+ break;
+ default:
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ goto exit;
+ }
+
+ ret = eglChooseConfig (s_dpy, config_attribs, NULL, 0, &num_conf);
+ if(ret != EGL_TRUE || num_conf == 0){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ goto exit;
+ }
+
+ conf_array = (EGLConfig *)calloc (num_conf, sizeof (EGLConfig));
+ if(conf_array == NULL){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ goto exit;
+ }
+
+ ret = eglChooseConfig (s_dpy, config_attribs, conf_array, num_conf, &num_conf);
+ if(ret != EGL_TRUE){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ goto exit;
+ }
+
+ for (i = 0; i < num_conf; i ++){
+ EGLint id, rsize, gsize, bsize, asize;
+
+ eglGetConfigAttrib (s_dpy, conf_array[i], EGL_CONFIG_ID, &id);
+ eglGetConfigAttrib (s_dpy, conf_array[i], EGL_RED_SIZE, &rsize);
+ eglGetConfigAttrib (s_dpy, conf_array[i], EGL_GREEN_SIZE, &gsize);
+ eglGetConfigAttrib (s_dpy, conf_array[i], EGL_BLUE_SIZE, &bsize);
+ eglGetConfigAttrib (s_dpy, conf_array[i], EGL_ALPHA_SIZE, &asize);
+
+ if(rsize == r && gsize == g && bsize == b && asize == a){
+ conf = conf_array[i];
+ break;
+ }
+ }
+
+ if(i == num_conf){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ goto exit;
+ }
+
+exit:
+ if(conf_array)
+ free (conf_array);
+
+ return conf;
+}
+
+int egl_init_with_platform_window_surface (int gles_version, int depth_size, int stencil_size, int sample_num,
+ int win_w, int win_h)
+{
+ void *native_dpy, *native_win;
+ EGLint major, minor;
+ EGLConfig config;
+ EGLBoolean ret;
+ EGLint context_attribs[] = {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_NONE
+ };
+ EGLint sfc_attr[] = { EGL_NONE };
+
+ native_dpy = winsys_init_native_display ();
+ if((native_dpy != EGL_DEFAULT_DISPLAY) && (native_dpy == NULL)){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return -1;
+ }
+
+ s_dpy = eglGetDisplay (native_dpy);
+ if(s_dpy == EGL_NO_DISPLAY){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return -1;
+ }
+
+ ret = eglInitialize (s_dpy, &major, &minor);
+ if(ret != EGL_TRUE){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return -1;
+ }
+
+ eglBindAPI (EGL_OPENGL_ES_API);
+
+ config = find_egl_config (8, 8, 8, 8, depth_size, stencil_size, sample_num, EGL_WINDOW_BIT, gles_version);
+ if(config == NULL){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return -1;
+ }
+
+ native_win = winsys_init_native_window (s_dpy, win_w, win_h);
+ if(native_win == NULL){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return -1;
+ }
+
+ s_sfc = eglCreateWindowSurface (s_dpy, config, (NativeWindowType)native_win, sfc_attr);
+ if(s_sfc== EGL_NO_SURFACE){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return -1;
+ }
+
+ switch (gles_version){
+ case 1: context_attribs[1] = 1; break;
+ case 2: context_attribs[1] = 2; break;
+ case 3: context_attribs[1] = 3; break;
+ default:
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return -1;
+ }
+
+ s_ctx = eglCreateContext (s_dpy, config, EGL_NO_CONTEXT, context_attribs);
+ if(s_ctx== EGL_NO_CONTEXT){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return -1;
+ }
+
+ ret = eglMakeCurrent (s_dpy, s_sfc, s_sfc, s_ctx);
+ if(ret != EGL_TRUE){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return -1;
+ }
+
+ return 0;
+}
+
+int egl_swap()
+{
+ EGLBoolean ret;
+
+ ret = eglSwapBuffers(s_dpy, s_sfc);
+ if(ret != EGL_TRUE){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+GLuint
+compile_shader_text(GLenum shaderType, const char *text)
+{
+ GLuint shader;
+ GLint stat;
+
+ shader = glCreateShader(shaderType);
+ glShaderSource(shader, 1, (const char **)&text, NULL);
+ glCompileShader(shader);
+
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
+ if(!stat){
+ GLsizei len;
+ char *lpBuf;
+
+ glGetShaderiv (shader, GL_INFO_LOG_LENGTH, &len);
+ lpBuf = (char *)malloc (len);
+
+ glGetShaderInfoLog (shader, len, &len, lpBuf);
+ LOGE("Error: problem compiling shader.");
+ LOGE("-----------------------------------");
+ LOGE("%s", lpBuf);
+ LOGE("-----------------------------------");
+
+ free (lpBuf);
+
+ return 0;
+ }
+
+ return shader;
+}
+
+GLuint link_shaders (GLuint vertShader, GLuint fragShader)
+{
+ GLuint program = glCreateProgram();
+
+ if(fragShader) glAttachShader (program, fragShader);
+ if(vertShader) glAttachShader (program, vertShader);
+
+ glLinkProgram (program);
+
+ {
+ GLint stat;
+ glGetProgramiv (program, GL_LINK_STATUS, &stat);
+ if(!stat){
+ GLsizei len;
+ char *lpBuf;
+
+ glGetProgramiv (program, GL_INFO_LOG_LENGTH, &len);
+ lpBuf = (char *)malloc (len);
+
+ glGetProgramInfoLog (program, len, &len, lpBuf);
+ LOGE("Error: problem linking shader.");
+ LOGE("-----------------------------------");
+ LOGE("%s", lpBuf);
+ LOGE("-----------------------------------");
+
+ free (lpBuf);
+
+ return 0;
+ }
+ }
+
+ return program;
+}
+
+int generate_shader(shader_obj_t *sobj, char *str_vs, char *str_fs)
+{
+ GLuint fs, vs, program;
+
+ vs = compile_shader_text(GL_VERTEX_SHADER, str_vs);
+ fs = compile_shader_text(GL_FRAGMENT_SHADER, str_fs);
+ if(vs == 0 || fs == 0){
+ LOGE("Failed to compile shader.");
+ return -1;
+ }
+
+ program = link_shaders (vs, fs);
+ if(program == 0){
+ LOGE("Failed to link shaders.");
+ return -1;
+ }
+
+ glDeleteShader(vs);
+ glDeleteShader(fs);
+
+ sobj->program = program;
+ sobj->loc_vtx = glGetAttribLocation(program, "a_Vertex");
+ sobj->loc_nrm = glGetAttribLocation(program, "a_Normal");
+ sobj->loc_clr = glGetAttribLocation(program, "a_Color");
+ sobj->loc_uv = glGetAttribLocation(program, "a_TexCoord");
+ sobj->loc_tex = glGetUniformLocation(program, "u_sampler");
+ sobj->loc_mtx = glGetUniformLocation(program, "u_PMVMatrix");
+ sobj->loc_mtx_nrm = glGetUniformLocation(program, "u_NrmMatrix");
+
+ return 0;
+}
+
+static float varray[] = {
+ 0.0, 0.0,
+ 0.0, 1.0,
+ 1.0, 0.0,
+ 1.0, 1.0
+};
+
+static float tarray[] = {
+ 0.0, 0.0,
+ 0.0, 1.0,
+ 1.0, 0.0,
+ 1.0, 1.0
+};
+
+static float tarray2[] = {
+ 0.0, 1.0,
+ 0.0, 0.0,
+ 1.0, 1.0,
+ 1.0, 0.0
+};
+
+static float s_matprj[16];
+static int set_projection_matrix(int w, int h)
+{
+ float mat_proj[] = {
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 0.0f,
+ -1.0f, 1.0f, 0.0f, 1.0f};
+
+ mat_proj[0] = 2.0f / (float)w;
+ mat_proj[5] = -2.0f / (float)h;
+
+ memcpy(s_matprj, mat_proj, 16*sizeof(float));
+
+ return 0;
+}
+
+int init_2d_renderer (int w, int h)
+{
+ int i;
+
+ for(i = 0; i < SHADER_NUM; i ++){
+ if(generate_shader (&s_sobj[i], s_shader[2*i], s_shader[2*i + 1]) < 0){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return -1;
+ }
+
+ s_loc_mtx[i] = glGetUniformLocation(s_sobj[i].program, "u_PMVMatrix");
+ s_loc_color[i] = glGetUniformLocation(s_sobj[i].program, "u_Color");
+ s_loc_texdim[i] = glGetUniformLocation(s_sobj[i].program, "u_TexDim");
+ }
+
+ set_projection_matrix(w, h);
+
+ return 0;
+}
+
+typedef struct _texparam{
+ int textype;
+ int texid;
+ int x, y, w, h;
+ int texw, texh;
+ int upsidedown;
+ float color[4];
+ float rot;
+ float px, py;
+ int blendfunc_en;
+ unsigned int blendfunc[4];
+ float *user_texcoord;
+}texparam_t;
+
+static int draw_2d_texture_in(texparam_t *tparam)
+{
+ int ttype = tparam->textype;
+ int texid = tparam->texid;
+ float x = tparam->x;
+ float y = tparam->y;
+ float w = tparam->w;
+ float h = tparam->h;
+ float rot = tparam->rot;
+ shader_obj_t *sobj = &s_sobj[ttype];
+ float matrix[16];
+ float *uv = tarray;
+
+ glBindBuffer (GL_ARRAY_BUFFER, 0);
+ glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0);
+
+ glUseProgram (sobj->program);
+ glUniform1i(sobj->loc_tex, 0);
+
+ switch (ttype){
+ case 0: /* fill */
+ break;
+ case 1: /* tex */
+ case 4: /* tex_yuyv */
+ glBindTexture (GL_TEXTURE_2D, texid);
+ uv = tparam->upsidedown ? tarray2 : tarray;
+ break;
+ case 2: /* tex_extex */
+ glBindTexture (GL_TEXTURE_EXTERNAL_OES, texid);
+ uv = tparam->upsidedown ? tarray : tarray2;
+ break;
+ default:
+ break;
+ }
+
+ if(tparam->user_texcoord)
+ uv = tparam->user_texcoord;
+
+ if(sobj->loc_uv >= 0){
+ glEnableVertexAttribArray (sobj->loc_uv);
+ glVertexAttribPointer (sobj->loc_uv, 2, GL_FLOAT, GL_FALSE, 0, uv);
+ }
+
+ glEnable (GL_BLEND);
+
+ if(tparam->blendfunc_en){
+ glBlendFuncSeparate (tparam->blendfunc[0], tparam->blendfunc[1],
+ tparam->blendfunc[2], tparam->blendfunc[3]);
+ }else{
+ glBlendFuncSeparate (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
+ GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ }
+
+ matrix_identity (matrix);
+ matrix_translate (matrix, x, y, 0.0f);
+ if(rot != 0){
+ float px = tparam->px;
+ float py = tparam->py;
+ matrix_translate (matrix, px, py, 0.0f);
+ matrix_rotate (matrix, rot, 0.0f, 0.0f, 1.0f);
+ matrix_translate (matrix, -px, -py, 0.0f);
+ }
+ matrix_scale (matrix, w, h, 1.0f);
+ matrix_mult (matrix, s_matprj, matrix);
+
+ glUniformMatrix4fv (s_loc_mtx[ttype], 1, GL_FALSE, matrix);
+ glUniform4fv (s_loc_color[ttype], 1, tparam->color);
+
+ if(s_loc_texdim[ttype] >= 0){
+ float texdim[2];
+ texdim[0] = tparam->texw;
+ texdim[1] = tparam->texh;
+ glUniform2fv (s_loc_texdim[ttype], 1, texdim);
+ }
+
+ if(sobj->loc_vtx >= 0){
+ glEnableVertexAttribArray (sobj->loc_vtx);
+ glVertexAttribPointer (sobj->loc_vtx, 2, GL_FLOAT, GL_FALSE, 0, varray);
+ }
+
+ glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
+
+ glDisable (GL_BLEND);
+
+ return 0;
+
+}
+
+int draw_2d_texture_ex (texture_2d_t *tex, int x, int y, int w, int h, int upsidedown)
+{
+ texparam_t tparam = {0};
+ tparam.x = x;
+ tparam.y = y;
+ tparam.w = w;
+ tparam.h = h;
+ tparam.texid = tex->texid;
+ tparam.textype = 1;
+ tparam.texw = tex->width;
+ tparam.texh = tex->height;
+ tparam.color[0]= 1.0f;
+ tparam.color[1]= 1.0f;
+ tparam.color[2]= 1.0f;
+ tparam.color[3]= 1.0f;
+ tparam.upsidedown = upsidedown;
+ int ret = 0;
+
+ if(tex->format == pixfmt_fourcc('Y', 'U', 'Y', 'V'))
+ tparam.textype = 4;
+
+ ret = draw_2d_texture_in (&tparam);
+
+ return ret;
+}
--- /dev/null
+/**
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#include <chrono>
+#include "visualizer_2d.h"
+
+static int quit = 1;
+static int win_w = 1920;
+static int win_h = 1080;
+
+int load_texture(mv_source_h source, int *lpTexID, int *lpWidth, int *lpHeight)
+{
+ unsigned char *data_buffer = NULL;
+ unsigned int buffer_size = 0;
+ unsigned int width, height;
+ GLuint texid;
+
+ /* decode image data to RGBA8888 */
+ int err = mv_source_get_buffer(source, &data_buffer, &buffer_size);
+ if (MEDIA_VISION_ERROR_NONE != err) {
+ LOGE(
+ "ERROR: Errors were occurred during getting buffer from the "
+ "source; code %i\n",
+ err);
+ return err;
+ }
+
+ err = mv_source_get_width(source, &width);
+ if (MEDIA_VISION_ERROR_NONE != err) {
+ LOGE(
+ "ERROR: Errors were occurred during getting width from the "
+ "source; code %i\n",
+ err);
+ return err;
+ }
+
+ err = mv_source_get_height(source, &height);
+ if (MEDIA_VISION_ERROR_NONE != err) {
+ LOGE(
+ "ERROR: Errors were occurred during getting height from the "
+ "source; code %i\n",
+ err);
+ return err;
+ }
+
+ texid = create_2d_texture (data_buffer, width, height);
+
+ if (lpTexID) *lpTexID = texid;
+ if (lpWidth) *lpWidth = width;
+ if (lpHeight) *lpHeight = height;
+
+ return MEDIA_VISION_ERROR_NONE;
+}
+
+int mv_util_visualizer_2d(mv_source_h source, unsigned int dwell)
+{
+ int texid;
+ int texw, texh;
+ int err = MEDIA_VISION_ERROR_NONE;
+ texture_2d_t captex = {0};
+
+ err = egl_init_with_platform_window_surface(2, 8, 0, 0, win_w, win_h);
+ if (MEDIA_VISION_ERROR_NONE != err) {
+ LOGE("egl_init_with_platform_window_surface: %i", err);
+ return MEDIA_VISION_ERROR_INTERNAL;
+ }
+ err = init_2d_renderer(win_w, win_h);
+ if (MEDIA_VISION_ERROR_NONE != err) {
+ LOGE("init_2d_renderer: %i", err);
+ return MEDIA_VISION_ERROR_INTERNAL;
+ }
+
+ err = load_texture(source, &texid, &texw, &texh);
+ if (MEDIA_VISION_ERROR_NONE != err) {
+ LOGE("load_texture: %i", err);
+ return MEDIA_VISION_ERROR_INTERNAL;
+ }
+
+ captex.texid = texid;
+ captex.width = texw;
+ captex.height = texh;
+ captex.format = pixfmt_fourcc ('R', 'G', 'B', 'A');
+
+ float scale = (float)win_h / (float)texh;
+
+ glClearColor (0.f, 0.f, 0.f, 1.0f);
+ glClear (GL_COLOR_BUFFER_BIT);
+ glViewport (0, 0, win_w, win_h);
+
+ std::chrono::system_clock::time_point StartTime = std::chrono::system_clock::now();
+ std::chrono::milliseconds ms;
+ quit = 1;
+ while(quit){
+ err = draw_2d_texture_ex (&captex, (win_w - scale * texw) * 0.5f,
+ 0, scale * texw, scale * texh, 0);
+ if (MEDIA_VISION_ERROR_NONE != err) {
+ LOGE("draw_2d_texture_ex: %i", err);
+ return MEDIA_VISION_ERROR_INTERNAL;
+ }
+
+ err = egl_swap();
+ if (MEDIA_VISION_ERROR_NONE != err) {
+ LOGE("egl_swap: %i", err);
+ return MEDIA_VISION_ERROR_INTERNAL;
+ }
+
+ ms = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - StartTime);
+ if (ms.count() > dwell) {
+ quit = 0;
+ }
+ }
+
+ return MEDIA_VISION_ERROR_NONE;
+}
--- /dev/null
+/**
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#include "visualizer_3d.h"
+
+int mv_util_visualizer_3d(mv_source_h source, int dwell)
+{
+ return MEDIA_VISION_ERROR_NONE;
+}
--- /dev/null
+/**
+ * Copyright(c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+#include <mv_private.h>
+#include <sys/mman.h>
+#include <signal.h>
+#include "wayland-client.h"
+#include "wayland-egl.h"
+#include "winsys.h"
+
+#define UNUSED(x)(void)(x)
+
+struct Display s_display;
+struct Window s_window;
+
+static void handle_ping(void *data, struct wl_shell_surface *wlShellSurface,
+ uint32_t serial)
+{
+ UNUSED(data);
+
+ wl_shell_surface_pong(wlShellSurface, serial);
+}
+
+static void handle_configure(void *data, struct wl_shell_surface *shell_surface,
+ uint32_t edges, int32_t width, int32_t height)
+{
+ struct Window *window =(struct Window *)data;
+ UNUSED(data);
+ UNUSED(shell_surface);
+ UNUSED(edges);
+
+ if(window->wlEGLNativeWindow){
+ wl_egl_window_resize(window->wlEGLNativeWindow, width, height, 0, 0);
+ }
+
+ window->geometry.width = width;
+ window->geometry.height = height;
+
+ if(!window->fullscreen){
+ window->window_size = window->geometry;
+ }
+}
+
+static const struct wl_shell_surface_listener shell_surface_listener =
+{
+ handle_ping,
+ handle_configure,
+ NULL
+};
+
+static void configure_callback(void *data, struct wl_callback *callback, uint32_t time)
+{
+ struct Window *window =(struct Window *)data;
+ UNUSED(time);
+
+ wl_callback_destroy(callback);
+
+ window->configured = 1;
+}
+
+static struct wl_callback_listener configure_callback_listener =
+{
+ configure_callback,
+};
+
+static void toggle_fullscreen(struct Window *window, int fullscreen)
+{
+
+ struct wl_callback *callback;
+
+ window->fullscreen = fullscreen;
+ window->configured = 0;
+
+ if(fullscreen){
+ wl_shell_surface_set_fullscreen(
+ window->wlShellSurface,
+ WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,0, NULL);
+ } else {
+ wl_shell_surface_set_toplevel(window->wlShellSurface);
+ handle_configure(window, window->wlShellSurface, 0,
+ window->window_size.width,
+ window->window_size.height);
+ }
+
+ callback = wl_display_sync(window->display->wlDisplay);
+ wl_callback_add_listener(callback, &configure_callback_listener,
+ window);
+
+}
+
+// Registry handling static function
+static void registry_handle_global(void *data, struct wl_registry *registry,
+ uint32_t name, const char *interface, uint32_t version)
+{
+ struct Display *d =(struct Display *)data;
+ UNUSED(version);
+
+ if(strcmp(interface, "wl_compositor") == 0){
+ d->wlCompositor =(wl_compositor *)wl_registry_bind(registry, name,
+ &wl_compositor_interface, 1);
+ } else if(strcmp(interface, "wl_shell") == 0){
+ d->wlShell =(wl_shell *)wl_registry_bind(registry, name,
+ &wl_shell_interface, 1);
+ }
+}
+
+static void registry_handle_global_remove(void *data, struct wl_registry *registry,
+ uint32_t name)
+{
+ UNUSED(data);
+ UNUSED(registry);
+ UNUSED(name);
+}
+
+static const struct wl_registry_listener registry_listener = {
+ registry_handle_global,
+ registry_handle_global_remove
+};
+
+void * winsys_init_native_display(void)
+{
+ memset(&s_display, 0, sizeof(s_display));
+
+
+ s_display.wlDisplay = wl_display_connect(NULL);
+ if(s_display.wlDisplay == NULL){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return 0;
+ }
+
+ s_display.wlRegistry = wl_display_get_registry(s_display.wlDisplay);
+ if(s_display.wlRegistry == NULL){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return 0;
+ }
+
+ wl_registry_add_listener(s_display.wlRegistry, ®istry_listener, &s_display);
+
+ wl_display_dispatch(s_display.wlDisplay);
+
+ return s_display.wlDisplay;;
+}
+
+
+void * winsys_init_native_window(void *dpy, int win_w, int win_h)
+{
+ UNUSED(dpy);
+ memset(&s_window, 0, sizeof(s_window));
+
+ if(!s_display.wlCompositor || !s_display.wlShell){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return 0;
+ }
+
+ s_window.wlSurface = wl_compositor_create_surface(s_display.wlCompositor);
+ if(s_window.wlSurface == NULL){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return 0;
+ }
+
+ s_window.wlShellSurface =
+ wl_shell_get_shell_surface(s_display.wlShell, s_window.wlSurface);
+ if(s_window.wlShellSurface == NULL){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return 0;
+ }
+
+ wl_shell_surface_add_listener(s_window.wlShellSurface, &shell_surface_listener, &s_window);
+
+ s_window.window_size.width = win_w;
+ s_window.window_size.height = win_h;
+ s_window.display = &s_display;
+ toggle_fullscreen(&s_window, 0);
+
+ s_window.wlEGLNativeWindow = wl_egl_window_create(s_window.wlSurface, win_w, win_h);
+ if(s_window.wlEGLNativeWindow == NULL){
+ LOGE("%s(%d)", __FILE__, __LINE__);
+ return 0;
+ }
+
+ return s_window.wlEGLNativeWindow;
+}
+
project(mv_visualizer_test_suite)
cmake_minimum_required(VERSION 2.6...3.13)
-pkg_check_modules(GLIB_PKG glib-2.0)
-
-if (NOT GLIB_PKG_FOUND)
- message(SEND_ERROR "Failed to find glib")
- return()
-endif()
+pkg_check_modules(${PROJECT_NAME}_DEP REQUIRED)
add_executable(${PROJECT_NAME} visualizer_test_suite.cpp)
+target_include_directories(${PROJECT_NAME} PUBLIC
+ ${${PROJECT_NAME}_DEP_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} ${MV_IMAGE_LIB_NAME}
- ${GLIB_PKG_LIBRARIES}
+ ${${PROJECT_NAME}_DEP_LIBRARIES}
+ ${MV_BARCODE_DETECTOR_LIB_NAME}
capi-system-info
- mv_image_helper
- mv_video_helper
- mv_testsuite_common)
+ mv_testsuite_common
+ mv_visualizer)
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
* limitations under the License.
*/
-#include <image_helper.h>
#include <mv_private.h>
#include <iostream>
#include <chrono>
+#include <error.h>
+#include <argp.h>
-void test_visualizer_2d()
+#include "visualizer_2d.h"
+#include "visualizer_3d.h"
+
+#define MAX_ARGS 2
+
+static const char doc[] = "[VQA-barcode]\vmediavision barcode assessment\n\
+ e.g) mv_visualizer_testsuite [0|1] \n\
+ 0 : 2D \n\
+ 1 : 3D";
+
+#define IMAGE_WIDTH 640
+#define IMAGE_HEIGHT 480
+#define RGB888 4
+
+static const char args_doc[] = "2D|3D SOURCE";
+
+struct arguments
+{
+ int type;
+};
+
+void fill_buffer_2d(unsigned char *data, unsigned int r, unsigned int g, unsigned int b)
{
+ int i = 0;
+ for (i = 0; i < IMAGE_WIDTH * IMAGE_HEIGHT; i++){
+ data[i*4] = r;
+ data[i*4+1] = g;
+ data[i*4+2] = b;
+ data[i*4+3] = 255;
+ }
}
-void test_visualizer_3d()
+void perform_visualize_2d(struct arguments *arguments, unsigned int r, unsigned int g, unsigned int b)
{
+ MEDIA_VISION_FUNCTION_ENTER();
+
+ mv_source_h source = NULL;
+ unsigned char *data_buffer = NULL;
+ unsigned long buffer_size = IMAGE_WIDTH * IMAGE_WIDTH * RGB888;
+ int err = MEDIA_VISION_ERROR_NONE;
+
+ data_buffer = new (std::nothrow)unsigned char[buffer_size];
+ fill_buffer_2d(data_buffer, r, g, b);
+
+ err = mv_create_source(&source);
+ if (MEDIA_VISION_ERROR_NONE != err) {
+ LOGE("Errors were occurred during creating the source!!! code : %i", err);
+ goto out;
+ }
+
+ err = mv_source_fill_by_buffer(source, data_buffer, buffer_size,
+ IMAGE_WIDTH, IMAGE_HEIGHT, MEDIA_VISION_COLORSPACE_RGB888);
+ if (MEDIA_VISION_ERROR_NONE != err) {
+ LOGE("Errors were occurred during filling the source!!! code : %i", err);
+ goto out;
+ }
+
+ mv_util_visualizer_2d(source, 2000); // 2000 ms
+
+out:
+ if (data_buffer != NULL) {
+ delete [] data_buffer;
+ data_buffer = NULL;
+ }
+
+ if (source != NULL) {
+ err = mv_destroy_source(source);
+ if (MEDIA_VISION_ERROR_NONE != err) {
+ LOGE("Errors were occurred during destroying the source!!! code : %i", err);
+ }
+ }
+ MEDIA_VISION_FUNCTION_LEAVE();
}
+void perform_visualize_3d(struct arguments *arguments)
+{
+ MEDIA_VISION_FUNCTION_ENTER();
+ MEDIA_VISION_FUNCTION_LEAVE();
+}
+
+static error_t parse_opt (int key, char *arg, struct argp_state *state)
+{
+ struct arguments *arguments = (struct arguments *)state->input;
+
+ switch (key) {
+ case ARGP_KEY_NO_ARGS:
+ argp_usage(state);
+ break;
+ case ARGP_KEY_ARG:
+ if (state->argc > MAX_ARGS)
+ argp_failure(state, 1, 0, "too many arguments");
+ else if (state->argc < MAX_ARGS)
+ argp_failure(state, 1, 0, "too few arguments");
+ arguments->type = atoi(arg);
+
+ state->next = state->argc;
+ if (arguments->type < 0 || arguments->type > 1) {
+ argp_failure(state, 1, 0, "Invalid type");
+ }
+ break;
+ default:
+ return ARGP_ERR_UNKNOWN;
+ }
+
+ return 0;
+}
+
+static struct argp argp = { NULL, parse_opt, args_doc, doc };
+
int main(int argc, char *argv[])
{
LOGI("Media Vision visualizer-Testsuite is launched.");
+ struct arguments arguments;
+ argp_parse (&argp, argc, argv, 0, 0, &arguments);
+
std::chrono::system_clock::time_point StartTime = std::chrono::system_clock::now();
- test_visualizer_2d();
+ if (arguments.type == 0){
+ perform_visualize_2d(&arguments, 255, 0 , 0);
+ perform_visualize_2d(&arguments, 0, 255, 0);
+ perform_visualize_2d(&arguments, 0, 0, 255);
+ }else if (arguments.type == 1)
+ perform_visualize_3d(&arguments);
std::chrono::milliseconds ms = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - StartTime);
- std::cout << "test_visualizer_2d : " << ms.count() << "ms" << std::endl;
-
- StartTime = std::chrono::system_clock::now();
- test_visualizer_3d();
- ms = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - StartTime);
- std::cout << "test_visualizer_3d : "<< ms.count() << "ms" << std::endl;
+ std::cout << "total : " << ms.count() << "ms" << std::endl;
LOGI("Media Vision visualizer-Testsuite is closed.");