Showing preview only (1,938K chars total). Download the full file or copy to clipboard to get everything.
Repository: anael-seghezzi/Maratis-Tiny-C-library
Branch: master
Commit: a32af1aa4239
Files: 89
Total size: 1.8 MB
Directory structure:
gitextract_a32ni6ry/
├── .gitignore
├── CMake/
│ └── OutOfSourceBuild.cmake
├── CMakeLists.txt
├── LICENSE
├── README.md
├── build_tests_unix.sh
├── build_tests_vs.bat
├── include/
│ ├── m_dist.h
│ ├── m_image.h
│ ├── m_math.h
│ ├── m_path_finding.h
│ └── m_raster.h
└── tests/
├── 3rdparty/
│ ├── CMakeLists.txt
│ ├── glfw/
│ │ ├── CMakeLists.txt
│ │ ├── COPYING.txt
│ │ ├── deps/
│ │ │ ├── EGL/
│ │ │ │ └── eglext.h
│ │ │ ├── GL/
│ │ │ │ ├── glext.h
│ │ │ │ ├── glxext.h
│ │ │ │ └── wglext.h
│ │ │ ├── getopt.c
│ │ │ ├── getopt.h
│ │ │ ├── tinycthread.c
│ │ │ └── tinycthread.h
│ │ ├── include/
│ │ │ └── GLFW/
│ │ │ ├── glfw3.h
│ │ │ └── glfw3native.h
│ │ └── src/
│ │ ├── CMakeLists.txt
│ │ ├── clipboard.c
│ │ ├── cocoa_clipboard.m
│ │ ├── cocoa_gamma.c
│ │ ├── cocoa_init.m
│ │ ├── cocoa_joystick.m
│ │ ├── cocoa_monitor.m
│ │ ├── cocoa_platform.h
│ │ ├── cocoa_time.c
│ │ ├── cocoa_window.m
│ │ ├── config.h
│ │ ├── config.h.in
│ │ ├── context.c
│ │ ├── egl_context.c
│ │ ├── egl_platform.h
│ │ ├── gamma.c
│ │ ├── glfw3.pc.in
│ │ ├── glfwConfig.cmake.in
│ │ ├── glfwConfigVersion.cmake.in
│ │ ├── glx_context.c
│ │ ├── glx_platform.h
│ │ ├── init.c
│ │ ├── input.c
│ │ ├── internal.h
│ │ ├── joystick.c
│ │ ├── monitor.c
│ │ ├── nsgl_context.m
│ │ ├── nsgl_platform.h
│ │ ├── time.c
│ │ ├── wgl_context.c
│ │ ├── wgl_platform.h
│ │ ├── win32_clipboard.c
│ │ ├── win32_gamma.c
│ │ ├── win32_init.c
│ │ ├── win32_joystick.c
│ │ ├── win32_monitor.c
│ │ ├── win32_platform.h
│ │ ├── win32_time.c
│ │ ├── win32_window.c
│ │ ├── window.c
│ │ ├── x11_clipboard.c
│ │ ├── x11_gamma.c
│ │ ├── x11_init.c
│ │ ├── x11_joystick.c
│ │ ├── x11_monitor.c
│ │ ├── x11_platform.h
│ │ ├── x11_time.c
│ │ ├── x11_unicode.c
│ │ └── x11_window.c
│ ├── stb/
│ │ └── stb_image.h
│ └── tinycthread/
│ ├── CMakeLists.txt
│ ├── README.txt
│ └── source/
│ ├── tinycthread.c
│ └── tinycthread.h
├── dataset/
│ └── lena.tga
├── raster/
│ ├── CMakeLists.txt
│ └── main.c
├── raytracing/
│ ├── CMakeLists.txt
│ └── main.c
├── test.h
├── vorogen/
│ ├── CMakeLists.txt
│ └── main.c
└── voronoi/
├── CMakeLists.txt
└── main.c
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Object files
*.o
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
Build
bin
================================================
FILE: CMake/OutOfSourceBuild.cmake
================================================
# Disallow in-source build
STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" BUILDING_IN_SOURCE)
IF(BUILDING_IN_SOURCE)
MESSAGE(FATAL_ERROR "This project requires an out of source build. Please create a separate build directory and run 'cmake [options] <path-to-source>' there.")
ENDIF(BUILDING_IN_SOURCE)
================================================
FILE: CMakeLists.txt
================================================
PROJECT(MTCL)
## Let's use a reasonable modern version
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
SET(CMAKE_HAS_SORT 1)
SET(CMAKE_MODULE_PATH
${MTCL_SOURCE_DIR}/CMake
${CMAKE_MODULE_PATH}
)
## Disallow in-source builds
INCLUDE(OutOfSourceBuild)
## Set version and info
SET(MTCL_MAJOR_VERSION 1)
SET(MTCL_MINOR_VERSION 0)
SET(MTCL_PATCH_VERSION 0)
SET(MTCL_PACKAGE "Maratis Tiny C Library")
SET(MTCL_VENDOR "Anael Seghezzi")
SET(MTCL_VERSION "${MTCL_MAJOR_VERSION}.${MTCL_MINOR_VERSION}.${MTCL_PATCH_VERSION}")
SET(MTCL_COPYRIGHT "Copyright (c) 2015, ${MTCL_VENDOR}.")
MESSAGE(STATUS "${MTCL_PACKAGE} ${MTCL_VERSION}")
## Set install path
SET(MTCL_INSTALL_DIR MTCL)
IF(WIN32)
FIND_PACKAGE(OpenGL REQUIRED)
SET(MTCL_BUILD_FLAGS "")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MOE_BUILD_FLAGS} /EHsc /nologo /GR /FC /DWIN32 /D_MBCS")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Z7 /W4 /Od /MDd /D_DEBUG /D__Debug__")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /W1 /Ox /Ot /MD /DNDEBUG")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MARATIS_BUILD_FLAGS} /EHsc /nologo /GR /FC /DWIN32 /D_MBCS")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Z7 /W4 /Od /MDd /D_DEBUG /D__Debug__")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W1 /Ox /Ot /MD /DNDEBUG")
SET(OS_SPECIFIC_LIBRARIES)
ENDIF(WIN32)
IF(APPLE)
FIND_PACKAGE(OpenGL REQUIRED)
FIND_LIBRARY(COCOA_LIB Cocoa)
FIND_LIBRARY(CORE_SERVICES_LIB CoreServices)
FIND_LIBRARY(FOUNDATION_LIB Foundation)
FIND_LIBRARY(IOKIT_LIB IOKit)
SET(MTCL_BUILD_FLAGS "-mmacosx-version-min=10.6")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MTCL_BUILD_FLAGS} -O3 -DOSX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__Debug__")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MTCL_BUILD_FLAGS} -O3 -DOSX")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D__Debug__")
SET(CMAKE_SHARED_LINKER_FLAGS "-Wl")
SET(OS_SPECIFIC_LIBRARIES ${COCOA_LIB} ${CORE_SERVICES_LIB} ${FOUNDATION_LIB} ${IOKIT_LIB})
ENDIF(APPLE)
IF(UNIX AND NOT APPLE)
FIND_PACKAGE(OpenGL REQUIRED)
SET(MTCL_BUILD_FLAGS "")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MTCL_BUILD_FLAGS} -O3 -fPIC -DLINUX -ldl")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D__Debug__")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MTCL_BUILD_FLAGS} -O3 -fPIC -DLINUX -ldl")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D__Debug__")
SET(CMAKE_SHARED_LINKER_FLAGS "-ldl -Wl,--as-needed,--allow-multiple-definition,--build-id")
SET(OS_SPECIFIC_LIBRARIES pthread Xxf86vm X11 Xrandr Xi dl m)
ENDIF(UNIX AND NOT APPLE)
FIND_PACKAGE(OpenMP)
IF(OPENMP_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
ENDIF()
## Set up 3rd party dependencies
SET(GLFW_INCLUDE_DIR ${MTCL_SOURCE_DIR}/tests/3rdparty/glfw/include)
SET(TINYCTHREAD_INCLUDE_DIR ${MTCL_SOURCE_DIR}/tests/3rdparty/tinycthread/source)
SET(STB_INCLUDE_DIR ${MTCL_SOURCE_DIR}/tests/3rdparty/stb)
SET(GLFW_LIBRARIES glfw)
SET(TINYCTHREAD_LIBRARIES tinycthread)
## Set up SDK dependencies
SET(MTCL_INCLUDE_DIR ${MTCL_SOURCE_DIR}/include)
## Set up subdirectories...
ADD_SUBDIRECTORY(tests/3rdparty)
ADD_SUBDIRECTORY(tests/raster)
ADD_SUBDIRECTORY(tests/raytracing)
ADD_SUBDIRECTORY(tests/voronoi)
ADD_SUBDIRECTORY(tests/vorogen)
================================================
FILE: LICENSE
================================================
Maratis Tiny C library
Copyright (c) 2015 Anael Seghezzi <www.maratis3d.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would
be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
================================================
FILE: README.md
================================================
Maratis Tiny C library
======================
is a collection of small and efficient math and image processing routines written in ANSI C with no dependencies.
The library is divided in independent single files (stb style):
- [m_math.h](https://github.com/anael-seghezzi/Maratis-Tiny-C-library/blob/master/include/m_math.h)
- [m_image.h](https://github.com/anael-seghezzi/Maratis-Tiny-C-library/blob/master/include/m_image.h)
- [m_raster.h](https://github.com/anael-seghezzi/Maratis-Tiny-C-library/blob/master/include/m_raster.h)
- [m_dist.h](https://github.com/anael-seghezzi/Maratis-Tiny-C-library/blob/master/include/m_dist.h)
- [m_path_finding.h](https://github.com/anael-seghezzi/Maratis-Tiny-C-library/blob/master/include/m_path_finding.h)
Math
----
* vector manipulation
* interpolation (cubic, catmullrom)
* quaternion (basics, slerp...)
* matrix (projection, transformation...)
* random number generator
* 2d routines
* 3d routines
* voxeliser (tri-box overlap)
* raytracing (sphere, plane, box, triangle)
Image manipulation
------------------
* ubyte, ushort, int, half, float...
* copy, conversions, mirror, reframe, rotate...
* filters (convolution, gaussian blur, sobel, harris)
* resizing, pyrdown
* morphology (floodfill, dilate, erode, thinning...)
* corner detection (harris, non-maxima suppression)
Rasterization
-------------
* triangle with interpolation (perspective correct)
* basic line, circle and polygon
Distance map
------------
* distance transform and voronoi
Path finding
------------
* path finding on regular grid (floodfill-based)
Asm.js demos
------------
* [m_raster](http://maratis3d.org/js/m_raster/m_raster.html)
* [m_voronoi](http://maratis3d.org/js/m_voronoi/m_voronoi.html)
* [m_raytracing](http://maratis3d.org/js/m_raytracing/m_raytracing.html)
Games / Demos
-------------
* Back on Earth - Ludum Dare 34 Compo
[](http://maratis3d.com/download/ludum34/b/web_player.html)
Building the demos (CMake)
--------------------------
**Unix:**
run:
build_tests_unix.sh
or type:
mkdir Build
cd Build
cmake -G "Unix Makefiles" ../ -DCMAKE_INSTALL_PREFIX=../bin
make
make install
**Windows:**
mkdir Build
cd Build
cmake -G "Visual Studio 11" ../ -DCMAKE_INSTALL_PREFIX=../bin
or:
mkdir Build
cd Build
cmake -G "MinGW Makefiles" ../ -DCMAKE_INSTALL_PREFIX=../bin
make
make install
**Emscripten:**
./emcc -s LEGACY_GL_EMULATION=1 -s USE_GLFW=3
License (zlib)
--------------
Copyright (c) 2015 Anael Seghezzi <www.maratis3d.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would
be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
You may also like
-----------------
* [stb](https://github.com/nothings/stb)
* [PAL](https://github.com/parallella/pal)
* [Maratis](http://www.maratis3d.org)
* [BGFX](https://github.com/bkaradzic/bgfx)
* [GLFW](https://github.com/glfw/glfw)
================================================
FILE: build_tests_unix.sh
================================================
#!/bin/bash
cur_dir=`dirname "$0"`; cur_dir=`eval "cd \"$cur_dir\" && pwd"`
build_path=$cur_dir"/Build"
install_path=$cur_dir"/bin"
# build
mkdir $build_path
cd $build_path
cmake -G "Unix Makefiles" ../ -DCMAKE_INSTALL_PREFIX=$install_path
make
make install
echo ""
echo "done"
read x
================================================
FILE: build_tests_vs.bat
================================================
mkdir Build
cd Build
cmake -G "Visual Studio 11" ../ -DCMAKE_INSTALL_PREFIX=../bin
================================================
FILE: include/m_dist.h
================================================
/*======================================================================
Maratis Tiny C Library
version 1.0
------------------------------------------------------------------------
Copyright (c) 2015 Anael Seghezzi <www.maratis3d.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would
be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
========================================================================*/
/*
Fast distance transform and Voronoi:
to create the implementation,
#define M_DIST_IMPLEMENTATION
in *one* C/CPP file that includes this file.
optional:
include this file after *m_image.h* to enable m_image helpers
*/
#ifndef M_DIST_H
#define M_DIST_H
#define M_DIST_VERSION 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef MDAPI
#define MDAPI extern
#endif
#define M_DIST_MAX 1e20f
/* raw distance functions
dest: squared distance */
MDAPI void m_dist_transform_1d(float *dest, float *src, int count);
MDAPI void m_dist_transform_2d(float *dest, float *src, int width, int height);
/* raw voronoi distance functions
destd: squared distance, desti: closest src index */
MDAPI void m_voronoi_transform_1d(float *destd, int *desti, float *src, int count);
MDAPI void m_voronoi_transform_2d(float *destd, int *desti, float *src, int width, int height);
/* image distance transform */
#ifdef M_IMAGE_VERSION
MDAPI void m_image_dist_mask_init(struct m_image *dest, const struct m_image *src); /* initialize a valid distance map from a ubyte mask */
MDAPI void m_image_dist_transform(struct m_image *dest, const struct m_image *src);
MDAPI void m_image_voronoi_transform(struct m_image *destd, struct m_image *desti, const struct m_image *src);
MDAPI void m_image_voronoi_fill(struct m_image *dest, const struct m_image *src, const struct m_image *srci);
#endif /* M_IMAGE_VERSION */
#ifdef __cplusplus
}
#endif
/*
----------------------------------------------------------------------*/
#endif /* M_DIST_H */
#ifdef M_DIST_IMPLEMENTATION
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
/* From paper:
Distance Transforms of Sampled Functions
by Pedro F. Felzenszwalb and Daniel P. Huttenlocher */
#define M_DIST_T()\
v[0] = 0;\
z[0] = -M_DIST_MAX;\
z[1] = M_DIST_MAX;\
k = 0;\
for (q = 1; q < count; q++) {\
float s;\
while (1) {\
s = (((double)src[q] + q * q) - ((double)src[v[k]] + v[k] * v[k])) / (double)(2 * q - 2 * v[k]);\
if (s > z[k])\
break;\
k--;\
}\
k++;\
v[k] = q;\
z[k] = s;\
z[k+1] = M_DIST_MAX;\
}
void m_dist_transform_1d(float *dest, float *src, int count)
{
int *v = (int *)malloc(count * sizeof(int));
float *z = (float *)malloc((count + 1) * sizeof(float));
int q, k;
M_DIST_T()
k = 0;
for (q = 0; q < count; q++) {
while(z[k+1] < q) k++;
dest[q] = (q - v[k]) * (q - v[k]) + src[v[k]];
}
free(z);
free(v);
}
void m_voronoi_transform_1d(float *destd, int *desti, float *src, int count)
{
int *v = (int *)malloc(count * sizeof(int));
float *z = (float *)malloc((count + 1) * sizeof(float));
int q, k;
M_DIST_T()
k = 0;
for (q = 0; q < count; q++) {
while (z[k+1] < q) k++;
destd[q] = (q - v[k]) * (q - v[k]) + src[v[k]];
desti[q] = v[k];
}
free(z);
free(v);
}
void m_dist_transform_2d(float *dest, float *src, int width, int height)
{
float *tmp1 = (float *)malloc(M_MAX(width, height) * sizeof(float));
float *tmp2 = (float *)malloc(M_MAX(width, height) * sizeof(float));
int x, y;
/* vertical pass */
for (x = 0; x < width; x++) {
/* fill vertical line */
for (y = 0; y < height; y++)
tmp1[y] = *(src + width * y + x);
m_dist_transform_1d(tmp2, tmp1, height);
/* copy the result */
for (y = 0; y < height; y++)
*(dest + width * y + x) = tmp2[y];
}
/* horizontal pass */
for (y = 0; y < height; y++) {
memcpy(tmp1, dest + width * y, width * sizeof(float));
m_dist_transform_1d(dest + width * y, tmp1, width);
}
free(tmp2);
free(tmp1);
}
void m_voronoi_transform_2d(float *destd, int *desti, float *src, int width, int height)
{
int maxs = M_MAX(width, height);
float *tmp1 = (float *)malloc(maxs * sizeof(float));
float *tmp2 = (float *)malloc(maxs * sizeof(float));
int *tmpi1 = (int *)malloc(maxs * sizeof(int));
int *tmpi2 = (int *)malloc(width * sizeof(int));
int x, y;
/* vertical pass */
for (x = 0; x < width; x++) {
/* fill vertical line */
for (y = 0; y < height; y++)
tmp1[y] = *(src + width * y + x);
m_voronoi_transform_1d(tmp2, tmpi1, tmp1, height);
/* copy the result */
for (y = 0; y < height; y++) {
*(destd + width * y + x) = tmp2[y];
*(desti + width * y + x) = tmpi1[y];
}
}
/* horizontal pass */
for (y = 0; y < height; y++) {
/* copy distance and index of current line */
memcpy(tmp1, destd + width * y, width * sizeof(float));
memcpy(tmpi2, desti + width * y, width * sizeof(int));
m_voronoi_transform_1d(destd + width * y, tmpi1, tmp1, width);
/* compute 2d closest pixel index */
for (x = 0; x < width; x++) {
int _x = tmpi1[x];
int _y = tmpi2[_x];
*(desti + width * y + x) = _y * width + _x;
}
}
free(tmpi2);
free(tmpi1);
free(tmp2);
free(tmp1);
}
#ifdef M_IMAGE_VERSION
void m_image_dist_mask_init(struct m_image *dest, const struct m_image *src)
{
float *dest_data;
unsigned char *src_data;
int width = src->width;
int height = src->height;
int size = src->size;
int i;
assert(src->size > 0 && src->type == M_UBYTE && src->comp == 1);
m_image_create(dest, M_FLOAT, width, height, 1);
dest_data = (float *)dest->data;
src_data = (unsigned char *)src->data;
/* init from mask */
for (i = 0; i < size; i++)
dest_data[i] = src_data[i] < 128 ? M_DIST_MAX : 0;
}
void m_image_dist_transform(struct m_image *dest, const struct m_image *src)
{
float *dest_data;
int width = src->width;
int height = src->height;
int size = src->size;
int i;
assert(src->size > 0 && src->type == M_FLOAT && src->comp == 1);
m_image_create(dest, M_FLOAT, width, height, 1);
dest_data = (float *)dest->data;
/* distance transform */
m_dist_transform_2d(dest_data, (float *)src->data, width, height);
for (i = 0; i < size; i++)
dest_data[i] = sqrtf(dest_data[i]);
}
void m_image_voronoi_transform(struct m_image *destd, struct m_image *desti, const struct m_image *src)
{
float *dest_data;
int width = src->width;
int height = src->height;
int size = src->size;
int i;
assert(src->size > 0 && src->type == M_FLOAT && src->comp == 1);
m_image_create(destd, M_FLOAT, width, height, 1);
m_image_create(desti, M_INT, width, height, 1);
dest_data = (float *)destd->data;
/* distance transform */
m_voronoi_transform_2d(dest_data, (int *)desti->data, (float *)src->data, width, height);
for (i = 0; i < size; i++)
dest_data[i] = sqrtf(dest_data[i]);
}
void m_image_voronoi_fill(struct m_image *dest, const struct m_image *src, const struct m_image *srci)
{
#define M_VORO_FILL(T)\
{\
T *sData = (T *)src->data;\
T *dData = (T *)dest->data;\
int i, c;\
for (i = 0; i < size; i++) {\
for (c = 0; c < comp; c++) {\
(*dData) = sData[(*datai) * comp + c];\
dData++;\
}\
datai++;\
}\
}
int *datai = (int *)srci->data;
int comp = src->comp;
int size = srci->size;
m_image_create(dest, src->type, src->width, src->height, src->comp);
switch(src->type)
{
case M_BYTE:
case M_UBYTE:
M_VORO_FILL(char);
break;
case M_SHORT:
case M_USHORT:
case M_HALF:
M_VORO_FILL(short);
break;
case M_INT:
case M_UINT:
M_VORO_FILL(int);
break;
case M_FLOAT:
M_VORO_FILL(float);
break;
default:
assert(0);
break;
}
#undef M_VORO_FILL
}
#endif /* M_IMAGE_VERSION */
#endif /* M_DIST_IMPLEMENTATION */
================================================
FILE: include/m_image.h
================================================
/*======================================================================
Maratis Tiny C Library
version 1.0
------------------------------------------------------------------------
Copyright (c) 2015 Anael Seghezzi <www.maratis3d.org>
Copyright (c) 2015 Marti Maria Saguer
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would
be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
========================================================================*/
/*
Image manipulation :
- transformation (re-frame, mirror, rotation)
- conversions (float, half, ubyte, linear, greyscale...)
- filtering (convolution, Gaussian blur, Harris)
- scaling (pyramid, generic, bilinear)
- morphology (flood-fill, dilate, erode, thinning)
- edge and corner detection (Sobel, Harris)
to create the implementation,
#define M_IMAGE_IMPLEMENTATION
in *one* C/CPP file that includes this file.
optional:
include after *m_math.h*
//////////////////////////////////////////////////////
Example: create a 256x256 float image with 1 component:
struct m_image foo1 = M_IMAGE_IDENTITY();
struct m_image foo2 = M_IMAGE_IDENTITY();
int x, y;
m_image_create(&foo1, M_FLOAT, 256, 256, 1);
memset(foo1.data, 0, foo1.size * sizeof(float)); // clear to zero
y = 128; x = 128;
((float *)foo1.data)[y * foo1.width + x] = 1.0f; // set (x, y) pixel to one
m_image_gaussian_blur(&foo2, &foo1, 3, 3); // apply Gaussian blur
m_image_destroy(&foo2);
m_image_destroy(&foo1);
*/
#ifndef M_IMAGE_H
#define M_IMAGE_H
#include <stdint.h>
#define M_IMAGE_VERSION 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef MIAPI
#define MIAPI extern
#endif
#define M_VOID 0
#define M_BOOL 1
#define M_BYTE 2
#define M_UBYTE 3
#define M_SHORT 4
#define M_USHORT 5
#define M_INT 6
#define M_UINT 7
#define M_HALF 8
#define M_FLOAT 9
#define M_DOUBLE 10
struct m_image
{
void *data;
int size;
int width;
int height;
int comp;
char type;
};
/* identity, must be used before calling m_image_create */
#define M_IMAGE_IDENTITY() {0, 0, 0, 0, 0, 0}
/* m_image type util */
MIAPI int m_type_sizeof(char type);
/* fully supported types are: M_UBYTE, M_USHORT, M_HALF, M_FLOAT
partially supported types: M_BYTE, M_SHORT, M_INT, M_UINT (no support for conversion) */
MIAPI void m_image_create(struct m_image *image, char type, int width, int height, int comp);
MIAPI void m_image_destroy(struct m_image *image);
MIAPI void m_image_ubyte_to_float(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_ushort_to_float(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_half_to_float(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_float_to_ubyte(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_float_to_ushort(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_float_to_half(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_copy(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_copy_sub_image(struct m_image *dest, const struct m_image *src, int x, int y, int w, int h);
MIAPI void m_image_reframe_zero(struct m_image *dest, const struct m_image *src, int left, int top, int right, int bottom);
MIAPI void m_image_reframe(struct m_image *dest, const struct m_image *src, int left, int top, int right, int bottom);
MIAPI void m_image_extract_component(struct m_image *dest, const struct m_image *src, int c);
MIAPI void m_image_rotate_left(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_rotate_right(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_rotate_180(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_mirror_x(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_mirror_y(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_premultiply(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_unpremultiply(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_sRGB_to_linear(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_linear_to_sRGB(struct m_image *dest, const struct m_image *src);
/* float/half conversion */
MIAPI float m_half2float(uint16_t h);
MIAPI uint16_t m_float2half(float flt);
/* raw processing */
MIAPI void m_sRGB_to_linear(float *dest, const float *src, int size);
MIAPI void m_linear_to_sRGB(float *dest, const float *src, int size);
MIAPI void m_RGB_to_HSV(float *dest, const float *src);
MIAPI void m_HSV_to_RGB(float *dest, const float *src);
MIAPI void m_RGB_to_HSL(float *dest, const float *src);
MIAPI void m_HSL_to_RGB(float *dest, const float *src);
MIAPI void m_gaussian_kernel(float *dest, int size, float radius);
MIAPI void m_sst(float *dest, const float *src, int count);
MIAPI void m_harris_response(float *dest, const float *src, int count);
MIAPI void m_tfm(float *dest, const float *src, int count);
MIAPI void m_normalize(float *dest, const float *src, int size); /* dest = src / norm(src) */
MIAPI void m_normalize_sum(float *dest, const float *src, int size); /* dest = src / sum(src) */
MIAPI float m_mean(const float *src, int size);
MIAPI float m_squared_distance(const float *src1, const float *src2, int size);
MIAPI float m_squared_distance_dispatch(const float *src1, const float *src2, int size);
MIAPI float m_convolution(const float *src1, const float *src2, int size); /* a dot product really */
MIAPI float m_chi_squared_distance(const float *src1, const float *src2, int size); /* good at estimating signed hystograms difference */
/* conversion to 1 component (float image only) */
MIAPI void m_image_grey(struct m_image *dest, const struct m_image *src); /* from RGB src */
MIAPI void m_image_max(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_max_abs(struct m_image *dest, const struct m_image *src);
/* summed area table (also called "integral image") */
MIAPI void m_image_summed_area(struct m_image *dest, const struct m_image *src);
/* convolutions (float image only) */
/* if alpha channel, src image must be pre-multiplied */
MIAPI void m_image_convolution_h_raw(struct m_image *dest, const struct m_image *src, float *kernel, int size);
MIAPI void m_image_convolution_v_raw(struct m_image *dest, const struct m_image *src, float *kernel, int size);
MIAPI void m_image_convolution_h(struct m_image *dest, const struct m_image *src, float *kernel, int size); /* horizontal */
MIAPI void m_image_convolution_v(struct m_image *dest, const struct m_image *src, float *kernel, int size); /* vertical */
MIAPI void m_image_gaussian_blur(struct m_image *dest, const struct m_image *src, float dx, float dy);
/* edge and corner (float 1 component image only) */
MIAPI void m_image_sobel(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_harris(struct m_image *dest, const struct m_image *src, float radius);
/* morphology (ubyte 1 component image only) */
MIAPI int m_image_floodfill_4x(struct m_image *dest, int x, int y, uint8_t ref, uint8_t value, uint16_t *stack, int stack_size);
MIAPI int m_image_floodfill_8x(struct m_image *dest, int x, int y, uint8_t ref, uint8_t value, uint16_t *stack, int stack_size);
MIAPI void m_image_dilate(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_erode(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_edge_4x(struct m_image *dest, const struct m_image *src, uint8_t ref);
MIAPI void m_image_thin(struct m_image *dest);
/* non maxima suppression (float image only) */
MIAPI void m_image_non_max_supp(struct m_image *dest, const struct m_image *src, int radius, float threshold);
/* detect Harris corners
margin: margin around the image to exclude corners
radius: maxima radius
threshold: Harris response threshold
corners: corners coordinates of size max_count * 2
max_count: maximum number of corners
return corner count */
MIAPI int m_image_corner_harris(const struct m_image *src, int margin, float radius, float threshold, int *corners, int max_count);
/* resizing (float image only) */
MIAPI void m_image_sub_pixel(const struct m_image *src, float x, float y, float *result);
MIAPI void m_image_pyrdown(struct m_image *dest, const struct m_image *src);
MIAPI void m_image_resize(struct m_image *dest, const struct m_image *src, int new_width, int new_height);
#ifdef __cplusplus
}
#endif
/*
----------------------------------------------------------------------*/
#endif /* M_IMAGE_H */
#ifdef M_IMAGE_IMPLEMENTATION
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#include <math.h>
#include <float.h>
#include <assert.h>
#ifndef M_SAFE_FREE
#define M_SAFE_FREE(p) {if (p) {free(p); (p) = NULL;}}
#endif
#ifndef M_MIN
#define M_MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef M_MAX
#define M_MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef M_ABS
#define M_ABS(a) (((a) < 0) ? -(a) : (a))
#endif
#ifndef M_CLAMP
#define M_CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
#endif
MIAPI void m_linear_to_sRGB(float *dest, const float *src, int size)
{
int i;
for (i = 0; i < size; i++) {
if (*src < 0.0031308f)
*dest = 12.92f * (*src);
else
*dest = (1.0f + 0.055f) * powf(*src, 1.0f/2.4f) - 0.055f;
dest++;
src++;
}
}
MIAPI void m_sRGB_to_linear(float *dest, const float *src, int size)
{
int i;
for (i = 0; i < size; i++) {
if (*src <= 0.03928f)
*dest = *src / 12.92f;
else
*dest = powf((*src + 0.055f) / 1.055f, 2.4f);
dest++;
src++;
}
}
MIAPI void m_RGB_to_HSV(float *dest, const float *src)
{
float r = src[0];
float g = src[1];
float b = src[2];
float h = 0;
float s = 0;
float v = 0;
float min = r;
float max = r;
float delta;
min = M_MIN(min, g);
min = M_MIN(min, b);
max = M_MAX(max, g);
max = M_MAX(max, b);
delta = max - min;
v = max;
if (delta == 0 || max == 0) {
dest[0] = h; dest[1] = s; dest[2] = v;
return;
}
s = delta / max;
if (r == max)
h = (g - b) / delta;
else if (g == max)
h = 2 + (b - r) / delta;
else
h = 4 + (r - g) / delta;
h *= 60;
if (h < 0) h += 360;
dest[0] = h; dest[1] = s; dest[2] = v;
}
MIAPI void m_HSV_to_RGB(float *dest, const float *src)
{
float r, g, b;
float f, p, q, t;
float h = src[0];
float s = src[1];
float v = src[2];
int i;
if (s == 0) {
dest[0] = v; dest[1] = v; dest[2] = v;
return;
}
h /= 60.0f;
i = (int)floorf(h);
f = h - i;
p = v * (1 - s);
q = v * (1 - s * f);
t = v * (1 - s * (1 - f));
switch (i) {
case 0:
r = v; g = t; b = p;
break;
case 1:
r = q; g = v; b = p;
break;
case 2:
r = p; g = v; b = t;
break;
case 3:
r = p; g = q; b = v;
break;
case 4:
r = t; g = p; b = v;
break;
default:
r = v; g = p; b = q;
break;
}
dest[0] = r; dest[1] = g; dest[2] = b;
}
MIAPI void m_RGB_to_HSL(float *dest, const float *src)
{
float h, s, l, dr, dg, db;
float r = src[0];
float g = src[1];
float b = src[2];
float min = r;
float max = r;
float delta;
min = M_MIN(min, g);
min = M_MIN(min, b);
max = M_MAX(max, g);
max = M_MAX(max, b);
delta = max - min;
h = 0;
s = 0;
l = (max + min) * 0.5f;
if (max == 0) {
dest[0] = h; dest[1] = s; dest[2] = l;
return;
}
if(r == max)
h = fmodf(((g - b) / delta), 6.0f);
else if(g == max)
h = ((b - r) / delta) + 2.0f;
else
h = ((r - g) / delta) + 4.0f;
h *= 60.0f;
if (h < 0) h += 360;
s = delta / (1.0f - fabsf(2.0f * l - 1.0f));
dest[0] = h;
dest[1] = s;
dest[2] = l;
}
MIAPI void m_HSL_to_RGB(float *dest, const float *src)
{
float h = src[0];
float s = src[1];
float l = src[2];
float c, m, x;
if (s == 0) {
dest[0] = l; dest[1] = l; dest[2] = l;
return;
}
c = (1.0f - fabsf(2.0f * l - 1.0f)) * s;
m = 1.0f * (l - 0.5f * c);
x = c * (1.0f - fabsf(fmodf(h / 60.0f, 2) - 1.0f));
if (h >= 0.0f && h < 60.0f) {
dest[0] = c + m;
dest[1] = x + m;
dest[2] = m;
}
else if (h >= 60.0f && h < 120.0f) {
dest[0] = x + m;
dest[1] = c + m;
dest[2] = m;
}
else if (h < 120.0f && h < 180.0f) {
dest[0] = m;
dest[1] = c + m;
dest[2] = x + m;
}
else if (h >= 180.0f && h < 240.0f) {
dest[0] = m;
dest[1] = x + m;
dest[2] = c + m;
}
else if (h >= 240.0f && h < 300.0f) {
dest[0] = x + m;
dest[1] = m;
dest[2] = c + m;
}
else if (h >= 300.0f && h < 360.0f) {
dest[0] = c + m;
dest[1] = m;
dest[2] = x + m;
}
else {
dest[0] = m;
dest[1] = m;
dest[2] = m;
}
}
MIAPI void m_gaussian_kernel(float *dest, int size, float radius)
{
float *k;
float rs, s2, sum;
float sigma = 1.6f;
float tetha = 2.25f;
int r, hsize = size / 2;
s2 = 1.0f / expf(sigma * sigma * tetha);
rs = sigma / radius;
k = dest;
sum = 0.0f;
/* compute gaussian kernel */
for (r = -hsize; r <= hsize; r++) {
float x = r * rs;
float v = (1.0f / expf(x * x)) - s2;
v = M_MAX(v, 0);
*k = v;
sum += v;
k++;
}
/* normalize */
if (sum > 0.0f) {
float isum = 1.0f / sum;
for (r = 0; r < size; r++)
dest[r] *= isum;
}
}
MIAPI void m_sst(float *dest, const float *src, int count)
{
register int i;
register float dx;
register float dy;
for (i = 0; i < count; i++) {
dx = src[0];
dy = src[1];
dest[0] = dx*dx;
dest[1] = dy*dy;
dest[2] = dx*dy;
src += 2;
dest += 3;
}
}
MIAPI void m_harris_response(float *dest, const float *src, int count)
{
int i;
for (i = 0; i < count; i++) {
float dx2 = src[0];
float dy2 = src[1];
float dxy = src[2];
*dest = (dx2 * dy2 - dxy * dxy) / (dx2 + dy2 + 1e-8f);
src += 3;
dest++;
}
}
MIAPI void m_tfm(float *dest, const float *src, int count)
{
int i;
for (i = 0; i < count; i++) {
if (src[0] < src[1]) {
float dx2 = src[0];
float dy2 = src[1];
float dxy = src[2];
float sqd = (dy2 * dy2) - (2.0f * dx2 * dy2) + (dx2 * dx2) + (4.0f * dxy * dxy);
float lambda = 0.5f * (dy2 + dx2 + sqrtf(M_MAX(0, sqd)));
dest[0] = dx2 - lambda;
dest[1] = dxy;
}
else {
float dy2 = src[0];
float dx2 = src[1];
float dxy = src[2];
float sqd = (dy2 * dy2) - (2.0f * dx2 * dy2) + (dx2 * dx2) + (4.0f * dxy * dxy);
float lambda = 0.5f * (dy2 + dx2 + sqrtf(M_MAX(0, sqd)));
dest[0] = dxy;
dest[1] = dx2 - lambda;
}
src += 3;
dest += 2;
}
}
MIAPI float m_chi_squared_distance(const float *src1, const float *src2, int size)
{
int i;
float score = 0;
for (i = 0; i < size; i++) {
float val1 = src1[i];
float val2 = src2[i];
/* chi squared distance */
if ((val1 + val2) > 0) {
float x = val2 - val1;
score += (x * x) / (val1 + val2);
}
}
return score * 0.5f;
}
MIAPI float m_convolution(const float *src1, const float *src2, int size)
{
float c = 0; int i;
for (i = 0; i < size; i++)
c += src1[i] * src2[i];
return c;
}
MIAPI void m_normalize(float *dest, const float *src, int size)
{
float sum = 0.0f; int i;
for(i = 0; i < size; i++)
sum += src[i] * src[i];
if (sum > 0.0f) {
sum = 1.0f / sqrtf(sum);
for(i = 0; i < size; i++)
dest[i] = src[i] * sum;
}
else if (dest != src) {
memset(dest, 0, size * sizeof(float));
}
}
MIAPI void m_normalize_sum(float *dest, const float *src, int size)
{
float sum = 0.0f; int i;
for(i = 0; i < size; i++)
sum += src[i];
if (sum > 0.0f) {
sum = 1.0f / sum;
for(i = 0; i < size; i++)
dest[i] = src[i] * sum;
}
else {
memset(dest, 0, size * sizeof(float));
}
}
MIAPI float m_mean(const float *src, int size)
{
float mean = 0; int i;
for (i = 0; i < size; i++)
mean += (*src++);
return mean / size;
}
MIAPI float m_squared_distance(const float *src1, const float *src2, int size)
{
register float score = 0.0f;
register int i;
register float x;
for (i = 0; i < size; i++) {
x = src2[i] - src1[i];
score += x * x;
}
return score;
}
/* m_half2float / m_float2half :
a big thanks to Marti Maria Saguer for allowing the use of this code
under the zlib license from "Little Color Management System" (cmshalf.c) */
/* This code is inspired in the paper "Fast Half Float Conversions"
by Jeroen van der Zijp */
static uint32_t m__mantissa[2048] = {
0x00000000, 0x33800000, 0x34000000, 0x34400000, 0x34800000, 0x34a00000,
0x34c00000, 0x34e00000, 0x35000000, 0x35100000, 0x35200000, 0x35300000,
0x35400000, 0x35500000, 0x35600000, 0x35700000, 0x35800000, 0x35880000,
0x35900000, 0x35980000, 0x35a00000, 0x35a80000, 0x35b00000, 0x35b80000,
0x35c00000, 0x35c80000, 0x35d00000, 0x35d80000, 0x35e00000, 0x35e80000,
0x35f00000, 0x35f80000, 0x36000000, 0x36040000, 0x36080000, 0x360c0000,
0x36100000, 0x36140000, 0x36180000, 0x361c0000, 0x36200000, 0x36240000,
0x36280000, 0x362c0000, 0x36300000, 0x36340000, 0x36380000, 0x363c0000,
0x36400000, 0x36440000, 0x36480000, 0x364c0000, 0x36500000, 0x36540000,
0x36580000, 0x365c0000, 0x36600000, 0x36640000, 0x36680000, 0x366c0000,
0x36700000, 0x36740000, 0x36780000, 0x367c0000, 0x36800000, 0x36820000,
0x36840000, 0x36860000, 0x36880000, 0x368a0000, 0x368c0000, 0x368e0000,
0x36900000, 0x36920000, 0x36940000, 0x36960000, 0x36980000, 0x369a0000,
0x369c0000, 0x369e0000, 0x36a00000, 0x36a20000, 0x36a40000, 0x36a60000,
0x36a80000, 0x36aa0000, 0x36ac0000, 0x36ae0000, 0x36b00000, 0x36b20000,
0x36b40000, 0x36b60000, 0x36b80000, 0x36ba0000, 0x36bc0000, 0x36be0000,
0x36c00000, 0x36c20000, 0x36c40000, 0x36c60000, 0x36c80000, 0x36ca0000,
0x36cc0000, 0x36ce0000, 0x36d00000, 0x36d20000, 0x36d40000, 0x36d60000,
0x36d80000, 0x36da0000, 0x36dc0000, 0x36de0000, 0x36e00000, 0x36e20000,
0x36e40000, 0x36e60000, 0x36e80000, 0x36ea0000, 0x36ec0000, 0x36ee0000,
0x36f00000, 0x36f20000, 0x36f40000, 0x36f60000, 0x36f80000, 0x36fa0000,
0x36fc0000, 0x36fe0000, 0x37000000, 0x37010000, 0x37020000, 0x37030000,
0x37040000, 0x37050000, 0x37060000, 0x37070000, 0x37080000, 0x37090000,
0x370a0000, 0x370b0000, 0x370c0000, 0x370d0000, 0x370e0000, 0x370f0000,
0x37100000, 0x37110000, 0x37120000, 0x37130000, 0x37140000, 0x37150000,
0x37160000, 0x37170000, 0x37180000, 0x37190000, 0x371a0000, 0x371b0000,
0x371c0000, 0x371d0000, 0x371e0000, 0x371f0000, 0x37200000, 0x37210000,
0x37220000, 0x37230000, 0x37240000, 0x37250000, 0x37260000, 0x37270000,
0x37280000, 0x37290000, 0x372a0000, 0x372b0000, 0x372c0000, 0x372d0000,
0x372e0000, 0x372f0000, 0x37300000, 0x37310000, 0x37320000, 0x37330000,
0x37340000, 0x37350000, 0x37360000, 0x37370000, 0x37380000, 0x37390000,
0x373a0000, 0x373b0000, 0x373c0000, 0x373d0000, 0x373e0000, 0x373f0000,
0x37400000, 0x37410000, 0x37420000, 0x37430000, 0x37440000, 0x37450000,
0x37460000, 0x37470000, 0x37480000, 0x37490000, 0x374a0000, 0x374b0000,
0x374c0000, 0x374d0000, 0x374e0000, 0x374f0000, 0x37500000, 0x37510000,
0x37520000, 0x37530000, 0x37540000, 0x37550000, 0x37560000, 0x37570000,
0x37580000, 0x37590000, 0x375a0000, 0x375b0000, 0x375c0000, 0x375d0000,
0x375e0000, 0x375f0000, 0x37600000, 0x37610000, 0x37620000, 0x37630000,
0x37640000, 0x37650000, 0x37660000, 0x37670000, 0x37680000, 0x37690000,
0x376a0000, 0x376b0000, 0x376c0000, 0x376d0000, 0x376e0000, 0x376f0000,
0x37700000, 0x37710000, 0x37720000, 0x37730000, 0x37740000, 0x37750000,
0x37760000, 0x37770000, 0x37780000, 0x37790000, 0x377a0000, 0x377b0000,
0x377c0000, 0x377d0000, 0x377e0000, 0x377f0000, 0x37800000, 0x37808000,
0x37810000, 0x37818000, 0x37820000, 0x37828000, 0x37830000, 0x37838000,
0x37840000, 0x37848000, 0x37850000, 0x37858000, 0x37860000, 0x37868000,
0x37870000, 0x37878000, 0x37880000, 0x37888000, 0x37890000, 0x37898000,
0x378a0000, 0x378a8000, 0x378b0000, 0x378b8000, 0x378c0000, 0x378c8000,
0x378d0000, 0x378d8000, 0x378e0000, 0x378e8000, 0x378f0000, 0x378f8000,
0x37900000, 0x37908000, 0x37910000, 0x37918000, 0x37920000, 0x37928000,
0x37930000, 0x37938000, 0x37940000, 0x37948000, 0x37950000, 0x37958000,
0x37960000, 0x37968000, 0x37970000, 0x37978000, 0x37980000, 0x37988000,
0x37990000, 0x37998000, 0x379a0000, 0x379a8000, 0x379b0000, 0x379b8000,
0x379c0000, 0x379c8000, 0x379d0000, 0x379d8000, 0x379e0000, 0x379e8000,
0x379f0000, 0x379f8000, 0x37a00000, 0x37a08000, 0x37a10000, 0x37a18000,
0x37a20000, 0x37a28000, 0x37a30000, 0x37a38000, 0x37a40000, 0x37a48000,
0x37a50000, 0x37a58000, 0x37a60000, 0x37a68000, 0x37a70000, 0x37a78000,
0x37a80000, 0x37a88000, 0x37a90000, 0x37a98000, 0x37aa0000, 0x37aa8000,
0x37ab0000, 0x37ab8000, 0x37ac0000, 0x37ac8000, 0x37ad0000, 0x37ad8000,
0x37ae0000, 0x37ae8000, 0x37af0000, 0x37af8000, 0x37b00000, 0x37b08000,
0x37b10000, 0x37b18000, 0x37b20000, 0x37b28000, 0x37b30000, 0x37b38000,
0x37b40000, 0x37b48000, 0x37b50000, 0x37b58000, 0x37b60000, 0x37b68000,
0x37b70000, 0x37b78000, 0x37b80000, 0x37b88000, 0x37b90000, 0x37b98000,
0x37ba0000, 0x37ba8000, 0x37bb0000, 0x37bb8000, 0x37bc0000, 0x37bc8000,
0x37bd0000, 0x37bd8000, 0x37be0000, 0x37be8000, 0x37bf0000, 0x37bf8000,
0x37c00000, 0x37c08000, 0x37c10000, 0x37c18000, 0x37c20000, 0x37c28000,
0x37c30000, 0x37c38000, 0x37c40000, 0x37c48000, 0x37c50000, 0x37c58000,
0x37c60000, 0x37c68000, 0x37c70000, 0x37c78000, 0x37c80000, 0x37c88000,
0x37c90000, 0x37c98000, 0x37ca0000, 0x37ca8000, 0x37cb0000, 0x37cb8000,
0x37cc0000, 0x37cc8000, 0x37cd0000, 0x37cd8000, 0x37ce0000, 0x37ce8000,
0x37cf0000, 0x37cf8000, 0x37d00000, 0x37d08000, 0x37d10000, 0x37d18000,
0x37d20000, 0x37d28000, 0x37d30000, 0x37d38000, 0x37d40000, 0x37d48000,
0x37d50000, 0x37d58000, 0x37d60000, 0x37d68000, 0x37d70000, 0x37d78000,
0x37d80000, 0x37d88000, 0x37d90000, 0x37d98000, 0x37da0000, 0x37da8000,
0x37db0000, 0x37db8000, 0x37dc0000, 0x37dc8000, 0x37dd0000, 0x37dd8000,
0x37de0000, 0x37de8000, 0x37df0000, 0x37df8000, 0x37e00000, 0x37e08000,
0x37e10000, 0x37e18000, 0x37e20000, 0x37e28000, 0x37e30000, 0x37e38000,
0x37e40000, 0x37e48000, 0x37e50000, 0x37e58000, 0x37e60000, 0x37e68000,
0x37e70000, 0x37e78000, 0x37e80000, 0x37e88000, 0x37e90000, 0x37e98000,
0x37ea0000, 0x37ea8000, 0x37eb0000, 0x37eb8000, 0x37ec0000, 0x37ec8000,
0x37ed0000, 0x37ed8000, 0x37ee0000, 0x37ee8000, 0x37ef0000, 0x37ef8000,
0x37f00000, 0x37f08000, 0x37f10000, 0x37f18000, 0x37f20000, 0x37f28000,
0x37f30000, 0x37f38000, 0x37f40000, 0x37f48000, 0x37f50000, 0x37f58000,
0x37f60000, 0x37f68000, 0x37f70000, 0x37f78000, 0x37f80000, 0x37f88000,
0x37f90000, 0x37f98000, 0x37fa0000, 0x37fa8000, 0x37fb0000, 0x37fb8000,
0x37fc0000, 0x37fc8000, 0x37fd0000, 0x37fd8000, 0x37fe0000, 0x37fe8000,
0x37ff0000, 0x37ff8000, 0x38000000, 0x38004000, 0x38008000, 0x3800c000,
0x38010000, 0x38014000, 0x38018000, 0x3801c000, 0x38020000, 0x38024000,
0x38028000, 0x3802c000, 0x38030000, 0x38034000, 0x38038000, 0x3803c000,
0x38040000, 0x38044000, 0x38048000, 0x3804c000, 0x38050000, 0x38054000,
0x38058000, 0x3805c000, 0x38060000, 0x38064000, 0x38068000, 0x3806c000,
0x38070000, 0x38074000, 0x38078000, 0x3807c000, 0x38080000, 0x38084000,
0x38088000, 0x3808c000, 0x38090000, 0x38094000, 0x38098000, 0x3809c000,
0x380a0000, 0x380a4000, 0x380a8000, 0x380ac000, 0x380b0000, 0x380b4000,
0x380b8000, 0x380bc000, 0x380c0000, 0x380c4000, 0x380c8000, 0x380cc000,
0x380d0000, 0x380d4000, 0x380d8000, 0x380dc000, 0x380e0000, 0x380e4000,
0x380e8000, 0x380ec000, 0x380f0000, 0x380f4000, 0x380f8000, 0x380fc000,
0x38100000, 0x38104000, 0x38108000, 0x3810c000, 0x38110000, 0x38114000,
0x38118000, 0x3811c000, 0x38120000, 0x38124000, 0x38128000, 0x3812c000,
0x38130000, 0x38134000, 0x38138000, 0x3813c000, 0x38140000, 0x38144000,
0x38148000, 0x3814c000, 0x38150000, 0x38154000, 0x38158000, 0x3815c000,
0x38160000, 0x38164000, 0x38168000, 0x3816c000, 0x38170000, 0x38174000,
0x38178000, 0x3817c000, 0x38180000, 0x38184000, 0x38188000, 0x3818c000,
0x38190000, 0x38194000, 0x38198000, 0x3819c000, 0x381a0000, 0x381a4000,
0x381a8000, 0x381ac000, 0x381b0000, 0x381b4000, 0x381b8000, 0x381bc000,
0x381c0000, 0x381c4000, 0x381c8000, 0x381cc000, 0x381d0000, 0x381d4000,
0x381d8000, 0x381dc000, 0x381e0000, 0x381e4000, 0x381e8000, 0x381ec000,
0x381f0000, 0x381f4000, 0x381f8000, 0x381fc000, 0x38200000, 0x38204000,
0x38208000, 0x3820c000, 0x38210000, 0x38214000, 0x38218000, 0x3821c000,
0x38220000, 0x38224000, 0x38228000, 0x3822c000, 0x38230000, 0x38234000,
0x38238000, 0x3823c000, 0x38240000, 0x38244000, 0x38248000, 0x3824c000,
0x38250000, 0x38254000, 0x38258000, 0x3825c000, 0x38260000, 0x38264000,
0x38268000, 0x3826c000, 0x38270000, 0x38274000, 0x38278000, 0x3827c000,
0x38280000, 0x38284000, 0x38288000, 0x3828c000, 0x38290000, 0x38294000,
0x38298000, 0x3829c000, 0x382a0000, 0x382a4000, 0x382a8000, 0x382ac000,
0x382b0000, 0x382b4000, 0x382b8000, 0x382bc000, 0x382c0000, 0x382c4000,
0x382c8000, 0x382cc000, 0x382d0000, 0x382d4000, 0x382d8000, 0x382dc000,
0x382e0000, 0x382e4000, 0x382e8000, 0x382ec000, 0x382f0000, 0x382f4000,
0x382f8000, 0x382fc000, 0x38300000, 0x38304000, 0x38308000, 0x3830c000,
0x38310000, 0x38314000, 0x38318000, 0x3831c000, 0x38320000, 0x38324000,
0x38328000, 0x3832c000, 0x38330000, 0x38334000, 0x38338000, 0x3833c000,
0x38340000, 0x38344000, 0x38348000, 0x3834c000, 0x38350000, 0x38354000,
0x38358000, 0x3835c000, 0x38360000, 0x38364000, 0x38368000, 0x3836c000,
0x38370000, 0x38374000, 0x38378000, 0x3837c000, 0x38380000, 0x38384000,
0x38388000, 0x3838c000, 0x38390000, 0x38394000, 0x38398000, 0x3839c000,
0x383a0000, 0x383a4000, 0x383a8000, 0x383ac000, 0x383b0000, 0x383b4000,
0x383b8000, 0x383bc000, 0x383c0000, 0x383c4000, 0x383c8000, 0x383cc000,
0x383d0000, 0x383d4000, 0x383d8000, 0x383dc000, 0x383e0000, 0x383e4000,
0x383e8000, 0x383ec000, 0x383f0000, 0x383f4000, 0x383f8000, 0x383fc000,
0x38400000, 0x38404000, 0x38408000, 0x3840c000, 0x38410000, 0x38414000,
0x38418000, 0x3841c000, 0x38420000, 0x38424000, 0x38428000, 0x3842c000,
0x38430000, 0x38434000, 0x38438000, 0x3843c000, 0x38440000, 0x38444000,
0x38448000, 0x3844c000, 0x38450000, 0x38454000, 0x38458000, 0x3845c000,
0x38460000, 0x38464000, 0x38468000, 0x3846c000, 0x38470000, 0x38474000,
0x38478000, 0x3847c000, 0x38480000, 0x38484000, 0x38488000, 0x3848c000,
0x38490000, 0x38494000, 0x38498000, 0x3849c000, 0x384a0000, 0x384a4000,
0x384a8000, 0x384ac000, 0x384b0000, 0x384b4000, 0x384b8000, 0x384bc000,
0x384c0000, 0x384c4000, 0x384c8000, 0x384cc000, 0x384d0000, 0x384d4000,
0x384d8000, 0x384dc000, 0x384e0000, 0x384e4000, 0x384e8000, 0x384ec000,
0x384f0000, 0x384f4000, 0x384f8000, 0x384fc000, 0x38500000, 0x38504000,
0x38508000, 0x3850c000, 0x38510000, 0x38514000, 0x38518000, 0x3851c000,
0x38520000, 0x38524000, 0x38528000, 0x3852c000, 0x38530000, 0x38534000,
0x38538000, 0x3853c000, 0x38540000, 0x38544000, 0x38548000, 0x3854c000,
0x38550000, 0x38554000, 0x38558000, 0x3855c000, 0x38560000, 0x38564000,
0x38568000, 0x3856c000, 0x38570000, 0x38574000, 0x38578000, 0x3857c000,
0x38580000, 0x38584000, 0x38588000, 0x3858c000, 0x38590000, 0x38594000,
0x38598000, 0x3859c000, 0x385a0000, 0x385a4000, 0x385a8000, 0x385ac000,
0x385b0000, 0x385b4000, 0x385b8000, 0x385bc000, 0x385c0000, 0x385c4000,
0x385c8000, 0x385cc000, 0x385d0000, 0x385d4000, 0x385d8000, 0x385dc000,
0x385e0000, 0x385e4000, 0x385e8000, 0x385ec000, 0x385f0000, 0x385f4000,
0x385f8000, 0x385fc000, 0x38600000, 0x38604000, 0x38608000, 0x3860c000,
0x38610000, 0x38614000, 0x38618000, 0x3861c000, 0x38620000, 0x38624000,
0x38628000, 0x3862c000, 0x38630000, 0x38634000, 0x38638000, 0x3863c000,
0x38640000, 0x38644000, 0x38648000, 0x3864c000, 0x38650000, 0x38654000,
0x38658000, 0x3865c000, 0x38660000, 0x38664000, 0x38668000, 0x3866c000,
0x38670000, 0x38674000, 0x38678000, 0x3867c000, 0x38680000, 0x38684000,
0x38688000, 0x3868c000, 0x38690000, 0x38694000, 0x38698000, 0x3869c000,
0x386a0000, 0x386a4000, 0x386a8000, 0x386ac000, 0x386b0000, 0x386b4000,
0x386b8000, 0x386bc000, 0x386c0000, 0x386c4000, 0x386c8000, 0x386cc000,
0x386d0000, 0x386d4000, 0x386d8000, 0x386dc000, 0x386e0000, 0x386e4000,
0x386e8000, 0x386ec000, 0x386f0000, 0x386f4000, 0x386f8000, 0x386fc000,
0x38700000, 0x38704000, 0x38708000, 0x3870c000, 0x38710000, 0x38714000,
0x38718000, 0x3871c000, 0x38720000, 0x38724000, 0x38728000, 0x3872c000,
0x38730000, 0x38734000, 0x38738000, 0x3873c000, 0x38740000, 0x38744000,
0x38748000, 0x3874c000, 0x38750000, 0x38754000, 0x38758000, 0x3875c000,
0x38760000, 0x38764000, 0x38768000, 0x3876c000, 0x38770000, 0x38774000,
0x38778000, 0x3877c000, 0x38780000, 0x38784000, 0x38788000, 0x3878c000,
0x38790000, 0x38794000, 0x38798000, 0x3879c000, 0x387a0000, 0x387a4000,
0x387a8000, 0x387ac000, 0x387b0000, 0x387b4000, 0x387b8000, 0x387bc000,
0x387c0000, 0x387c4000, 0x387c8000, 0x387cc000, 0x387d0000, 0x387d4000,
0x387d8000, 0x387dc000, 0x387e0000, 0x387e4000, 0x387e8000, 0x387ec000,
0x387f0000, 0x387f4000, 0x387f8000, 0x387fc000, 0x38000000, 0x38002000,
0x38004000, 0x38006000, 0x38008000, 0x3800a000, 0x3800c000, 0x3800e000,
0x38010000, 0x38012000, 0x38014000, 0x38016000, 0x38018000, 0x3801a000,
0x3801c000, 0x3801e000, 0x38020000, 0x38022000, 0x38024000, 0x38026000,
0x38028000, 0x3802a000, 0x3802c000, 0x3802e000, 0x38030000, 0x38032000,
0x38034000, 0x38036000, 0x38038000, 0x3803a000, 0x3803c000, 0x3803e000,
0x38040000, 0x38042000, 0x38044000, 0x38046000, 0x38048000, 0x3804a000,
0x3804c000, 0x3804e000, 0x38050000, 0x38052000, 0x38054000, 0x38056000,
0x38058000, 0x3805a000, 0x3805c000, 0x3805e000, 0x38060000, 0x38062000,
0x38064000, 0x38066000, 0x38068000, 0x3806a000, 0x3806c000, 0x3806e000,
0x38070000, 0x38072000, 0x38074000, 0x38076000, 0x38078000, 0x3807a000,
0x3807c000, 0x3807e000, 0x38080000, 0x38082000, 0x38084000, 0x38086000,
0x38088000, 0x3808a000, 0x3808c000, 0x3808e000, 0x38090000, 0x38092000,
0x38094000, 0x38096000, 0x38098000, 0x3809a000, 0x3809c000, 0x3809e000,
0x380a0000, 0x380a2000, 0x380a4000, 0x380a6000, 0x380a8000, 0x380aa000,
0x380ac000, 0x380ae000, 0x380b0000, 0x380b2000, 0x380b4000, 0x380b6000,
0x380b8000, 0x380ba000, 0x380bc000, 0x380be000, 0x380c0000, 0x380c2000,
0x380c4000, 0x380c6000, 0x380c8000, 0x380ca000, 0x380cc000, 0x380ce000,
0x380d0000, 0x380d2000, 0x380d4000, 0x380d6000, 0x380d8000, 0x380da000,
0x380dc000, 0x380de000, 0x380e0000, 0x380e2000, 0x380e4000, 0x380e6000,
0x380e8000, 0x380ea000, 0x380ec000, 0x380ee000, 0x380f0000, 0x380f2000,
0x380f4000, 0x380f6000, 0x380f8000, 0x380fa000, 0x380fc000, 0x380fe000,
0x38100000, 0x38102000, 0x38104000, 0x38106000, 0x38108000, 0x3810a000,
0x3810c000, 0x3810e000, 0x38110000, 0x38112000, 0x38114000, 0x38116000,
0x38118000, 0x3811a000, 0x3811c000, 0x3811e000, 0x38120000, 0x38122000,
0x38124000, 0x38126000, 0x38128000, 0x3812a000, 0x3812c000, 0x3812e000,
0x38130000, 0x38132000, 0x38134000, 0x38136000, 0x38138000, 0x3813a000,
0x3813c000, 0x3813e000, 0x38140000, 0x38142000, 0x38144000, 0x38146000,
0x38148000, 0x3814a000, 0x3814c000, 0x3814e000, 0x38150000, 0x38152000,
0x38154000, 0x38156000, 0x38158000, 0x3815a000, 0x3815c000, 0x3815e000,
0x38160000, 0x38162000, 0x38164000, 0x38166000, 0x38168000, 0x3816a000,
0x3816c000, 0x3816e000, 0x38170000, 0x38172000, 0x38174000, 0x38176000,
0x38178000, 0x3817a000, 0x3817c000, 0x3817e000, 0x38180000, 0x38182000,
0x38184000, 0x38186000, 0x38188000, 0x3818a000, 0x3818c000, 0x3818e000,
0x38190000, 0x38192000, 0x38194000, 0x38196000, 0x38198000, 0x3819a000,
0x3819c000, 0x3819e000, 0x381a0000, 0x381a2000, 0x381a4000, 0x381a6000,
0x381a8000, 0x381aa000, 0x381ac000, 0x381ae000, 0x381b0000, 0x381b2000,
0x381b4000, 0x381b6000, 0x381b8000, 0x381ba000, 0x381bc000, 0x381be000,
0x381c0000, 0x381c2000, 0x381c4000, 0x381c6000, 0x381c8000, 0x381ca000,
0x381cc000, 0x381ce000, 0x381d0000, 0x381d2000, 0x381d4000, 0x381d6000,
0x381d8000, 0x381da000, 0x381dc000, 0x381de000, 0x381e0000, 0x381e2000,
0x381e4000, 0x381e6000, 0x381e8000, 0x381ea000, 0x381ec000, 0x381ee000,
0x381f0000, 0x381f2000, 0x381f4000, 0x381f6000, 0x381f8000, 0x381fa000,
0x381fc000, 0x381fe000, 0x38200000, 0x38202000, 0x38204000, 0x38206000,
0x38208000, 0x3820a000, 0x3820c000, 0x3820e000, 0x38210000, 0x38212000,
0x38214000, 0x38216000, 0x38218000, 0x3821a000, 0x3821c000, 0x3821e000,
0x38220000, 0x38222000, 0x38224000, 0x38226000, 0x38228000, 0x3822a000,
0x3822c000, 0x3822e000, 0x38230000, 0x38232000, 0x38234000, 0x38236000,
0x38238000, 0x3823a000, 0x3823c000, 0x3823e000, 0x38240000, 0x38242000,
0x38244000, 0x38246000, 0x38248000, 0x3824a000, 0x3824c000, 0x3824e000,
0x38250000, 0x38252000, 0x38254000, 0x38256000, 0x38258000, 0x3825a000,
0x3825c000, 0x3825e000, 0x38260000, 0x38262000, 0x38264000, 0x38266000,
0x38268000, 0x3826a000, 0x3826c000, 0x3826e000, 0x38270000, 0x38272000,
0x38274000, 0x38276000, 0x38278000, 0x3827a000, 0x3827c000, 0x3827e000,
0x38280000, 0x38282000, 0x38284000, 0x38286000, 0x38288000, 0x3828a000,
0x3828c000, 0x3828e000, 0x38290000, 0x38292000, 0x38294000, 0x38296000,
0x38298000, 0x3829a000, 0x3829c000, 0x3829e000, 0x382a0000, 0x382a2000,
0x382a4000, 0x382a6000, 0x382a8000, 0x382aa000, 0x382ac000, 0x382ae000,
0x382b0000, 0x382b2000, 0x382b4000, 0x382b6000, 0x382b8000, 0x382ba000,
0x382bc000, 0x382be000, 0x382c0000, 0x382c2000, 0x382c4000, 0x382c6000,
0x382c8000, 0x382ca000, 0x382cc000, 0x382ce000, 0x382d0000, 0x382d2000,
0x382d4000, 0x382d6000, 0x382d8000, 0x382da000, 0x382dc000, 0x382de000,
0x382e0000, 0x382e2000, 0x382e4000, 0x382e6000, 0x382e8000, 0x382ea000,
0x382ec000, 0x382ee000, 0x382f0000, 0x382f2000, 0x382f4000, 0x382f6000,
0x382f8000, 0x382fa000, 0x382fc000, 0x382fe000, 0x38300000, 0x38302000,
0x38304000, 0x38306000, 0x38308000, 0x3830a000, 0x3830c000, 0x3830e000,
0x38310000, 0x38312000, 0x38314000, 0x38316000, 0x38318000, 0x3831a000,
0x3831c000, 0x3831e000, 0x38320000, 0x38322000, 0x38324000, 0x38326000,
0x38328000, 0x3832a000, 0x3832c000, 0x3832e000, 0x38330000, 0x38332000,
0x38334000, 0x38336000, 0x38338000, 0x3833a000, 0x3833c000, 0x3833e000,
0x38340000, 0x38342000, 0x38344000, 0x38346000, 0x38348000, 0x3834a000,
0x3834c000, 0x3834e000, 0x38350000, 0x38352000, 0x38354000, 0x38356000,
0x38358000, 0x3835a000, 0x3835c000, 0x3835e000, 0x38360000, 0x38362000,
0x38364000, 0x38366000, 0x38368000, 0x3836a000, 0x3836c000, 0x3836e000,
0x38370000, 0x38372000, 0x38374000, 0x38376000, 0x38378000, 0x3837a000,
0x3837c000, 0x3837e000, 0x38380000, 0x38382000, 0x38384000, 0x38386000,
0x38388000, 0x3838a000, 0x3838c000, 0x3838e000, 0x38390000, 0x38392000,
0x38394000, 0x38396000, 0x38398000, 0x3839a000, 0x3839c000, 0x3839e000,
0x383a0000, 0x383a2000, 0x383a4000, 0x383a6000, 0x383a8000, 0x383aa000,
0x383ac000, 0x383ae000, 0x383b0000, 0x383b2000, 0x383b4000, 0x383b6000,
0x383b8000, 0x383ba000, 0x383bc000, 0x383be000, 0x383c0000, 0x383c2000,
0x383c4000, 0x383c6000, 0x383c8000, 0x383ca000, 0x383cc000, 0x383ce000,
0x383d0000, 0x383d2000, 0x383d4000, 0x383d6000, 0x383d8000, 0x383da000,
0x383dc000, 0x383de000, 0x383e0000, 0x383e2000, 0x383e4000, 0x383e6000,
0x383e8000, 0x383ea000, 0x383ec000, 0x383ee000, 0x383f0000, 0x383f2000,
0x383f4000, 0x383f6000, 0x383f8000, 0x383fa000, 0x383fc000, 0x383fe000,
0x38400000, 0x38402000, 0x38404000, 0x38406000, 0x38408000, 0x3840a000,
0x3840c000, 0x3840e000, 0x38410000, 0x38412000, 0x38414000, 0x38416000,
0x38418000, 0x3841a000, 0x3841c000, 0x3841e000, 0x38420000, 0x38422000,
0x38424000, 0x38426000, 0x38428000, 0x3842a000, 0x3842c000, 0x3842e000,
0x38430000, 0x38432000, 0x38434000, 0x38436000, 0x38438000, 0x3843a000,
0x3843c000, 0x3843e000, 0x38440000, 0x38442000, 0x38444000, 0x38446000,
0x38448000, 0x3844a000, 0x3844c000, 0x3844e000, 0x38450000, 0x38452000,
0x38454000, 0x38456000, 0x38458000, 0x3845a000, 0x3845c000, 0x3845e000,
0x38460000, 0x38462000, 0x38464000, 0x38466000, 0x38468000, 0x3846a000,
0x3846c000, 0x3846e000, 0x38470000, 0x38472000, 0x38474000, 0x38476000,
0x38478000, 0x3847a000, 0x3847c000, 0x3847e000, 0x38480000, 0x38482000,
0x38484000, 0x38486000, 0x38488000, 0x3848a000, 0x3848c000, 0x3848e000,
0x38490000, 0x38492000, 0x38494000, 0x38496000, 0x38498000, 0x3849a000,
0x3849c000, 0x3849e000, 0x384a0000, 0x384a2000, 0x384a4000, 0x384a6000,
0x384a8000, 0x384aa000, 0x384ac000, 0x384ae000, 0x384b0000, 0x384b2000,
0x384b4000, 0x384b6000, 0x384b8000, 0x384ba000, 0x384bc000, 0x384be000,
0x384c0000, 0x384c2000, 0x384c4000, 0x384c6000, 0x384c8000, 0x384ca000,
0x384cc000, 0x384ce000, 0x384d0000, 0x384d2000, 0x384d4000, 0x384d6000,
0x384d8000, 0x384da000, 0x384dc000, 0x384de000, 0x384e0000, 0x384e2000,
0x384e4000, 0x384e6000, 0x384e8000, 0x384ea000, 0x384ec000, 0x384ee000,
0x384f0000, 0x384f2000, 0x384f4000, 0x384f6000, 0x384f8000, 0x384fa000,
0x384fc000, 0x384fe000, 0x38500000, 0x38502000, 0x38504000, 0x38506000,
0x38508000, 0x3850a000, 0x3850c000, 0x3850e000, 0x38510000, 0x38512000,
0x38514000, 0x38516000, 0x38518000, 0x3851a000, 0x3851c000, 0x3851e000,
0x38520000, 0x38522000, 0x38524000, 0x38526000, 0x38528000, 0x3852a000,
0x3852c000, 0x3852e000, 0x38530000, 0x38532000, 0x38534000, 0x38536000,
0x38538000, 0x3853a000, 0x3853c000, 0x3853e000, 0x38540000, 0x38542000,
0x38544000, 0x38546000, 0x38548000, 0x3854a000, 0x3854c000, 0x3854e000,
0x38550000, 0x38552000, 0x38554000, 0x38556000, 0x38558000, 0x3855a000,
0x3855c000, 0x3855e000, 0x38560000, 0x38562000, 0x38564000, 0x38566000,
0x38568000, 0x3856a000, 0x3856c000, 0x3856e000, 0x38570000, 0x38572000,
0x38574000, 0x38576000, 0x38578000, 0x3857a000, 0x3857c000, 0x3857e000,
0x38580000, 0x38582000, 0x38584000, 0x38586000, 0x38588000, 0x3858a000,
0x3858c000, 0x3858e000, 0x38590000, 0x38592000, 0x38594000, 0x38596000,
0x38598000, 0x3859a000, 0x3859c000, 0x3859e000, 0x385a0000, 0x385a2000,
0x385a4000, 0x385a6000, 0x385a8000, 0x385aa000, 0x385ac000, 0x385ae000,
0x385b0000, 0x385b2000, 0x385b4000, 0x385b6000, 0x385b8000, 0x385ba000,
0x385bc000, 0x385be000, 0x385c0000, 0x385c2000, 0x385c4000, 0x385c6000,
0x385c8000, 0x385ca000, 0x385cc000, 0x385ce000, 0x385d0000, 0x385d2000,
0x385d4000, 0x385d6000, 0x385d8000, 0x385da000, 0x385dc000, 0x385de000,
0x385e0000, 0x385e2000, 0x385e4000, 0x385e6000, 0x385e8000, 0x385ea000,
0x385ec000, 0x385ee000, 0x385f0000, 0x385f2000, 0x385f4000, 0x385f6000,
0x385f8000, 0x385fa000, 0x385fc000, 0x385fe000, 0x38600000, 0x38602000,
0x38604000, 0x38606000, 0x38608000, 0x3860a000, 0x3860c000, 0x3860e000,
0x38610000, 0x38612000, 0x38614000, 0x38616000, 0x38618000, 0x3861a000,
0x3861c000, 0x3861e000, 0x38620000, 0x38622000, 0x38624000, 0x38626000,
0x38628000, 0x3862a000, 0x3862c000, 0x3862e000, 0x38630000, 0x38632000,
0x38634000, 0x38636000, 0x38638000, 0x3863a000, 0x3863c000, 0x3863e000,
0x38640000, 0x38642000, 0x38644000, 0x38646000, 0x38648000, 0x3864a000,
0x3864c000, 0x3864e000, 0x38650000, 0x38652000, 0x38654000, 0x38656000,
0x38658000, 0x3865a000, 0x3865c000, 0x3865e000, 0x38660000, 0x38662000,
0x38664000, 0x38666000, 0x38668000, 0x3866a000, 0x3866c000, 0x3866e000,
0x38670000, 0x38672000, 0x38674000, 0x38676000, 0x38678000, 0x3867a000,
0x3867c000, 0x3867e000, 0x38680000, 0x38682000, 0x38684000, 0x38686000,
0x38688000, 0x3868a000, 0x3868c000, 0x3868e000, 0x38690000, 0x38692000,
0x38694000, 0x38696000, 0x38698000, 0x3869a000, 0x3869c000, 0x3869e000,
0x386a0000, 0x386a2000, 0x386a4000, 0x386a6000, 0x386a8000, 0x386aa000,
0x386ac000, 0x386ae000, 0x386b0000, 0x386b2000, 0x386b4000, 0x386b6000,
0x386b8000, 0x386ba000, 0x386bc000, 0x386be000, 0x386c0000, 0x386c2000,
0x386c4000, 0x386c6000, 0x386c8000, 0x386ca000, 0x386cc000, 0x386ce000,
0x386d0000, 0x386d2000, 0x386d4000, 0x386d6000, 0x386d8000, 0x386da000,
0x386dc000, 0x386de000, 0x386e0000, 0x386e2000, 0x386e4000, 0x386e6000,
0x386e8000, 0x386ea000, 0x386ec000, 0x386ee000, 0x386f0000, 0x386f2000,
0x386f4000, 0x386f6000, 0x386f8000, 0x386fa000, 0x386fc000, 0x386fe000,
0x38700000, 0x38702000, 0x38704000, 0x38706000, 0x38708000, 0x3870a000,
0x3870c000, 0x3870e000, 0x38710000, 0x38712000, 0x38714000, 0x38716000,
0x38718000, 0x3871a000, 0x3871c000, 0x3871e000, 0x38720000, 0x38722000,
0x38724000, 0x38726000, 0x38728000, 0x3872a000, 0x3872c000, 0x3872e000,
0x38730000, 0x38732000, 0x38734000, 0x38736000, 0x38738000, 0x3873a000,
0x3873c000, 0x3873e000, 0x38740000, 0x38742000, 0x38744000, 0x38746000,
0x38748000, 0x3874a000, 0x3874c000, 0x3874e000, 0x38750000, 0x38752000,
0x38754000, 0x38756000, 0x38758000, 0x3875a000, 0x3875c000, 0x3875e000,
0x38760000, 0x38762000, 0x38764000, 0x38766000, 0x38768000, 0x3876a000,
0x3876c000, 0x3876e000, 0x38770000, 0x38772000, 0x38774000, 0x38776000,
0x38778000, 0x3877a000, 0x3877c000, 0x3877e000, 0x38780000, 0x38782000,
0x38784000, 0x38786000, 0x38788000, 0x3878a000, 0x3878c000, 0x3878e000,
0x38790000, 0x38792000, 0x38794000, 0x38796000, 0x38798000, 0x3879a000,
0x3879c000, 0x3879e000, 0x387a0000, 0x387a2000, 0x387a4000, 0x387a6000,
0x387a8000, 0x387aa000, 0x387ac000, 0x387ae000, 0x387b0000, 0x387b2000,
0x387b4000, 0x387b6000, 0x387b8000, 0x387ba000, 0x387bc000, 0x387be000,
0x387c0000, 0x387c2000, 0x387c4000, 0x387c6000, 0x387c8000, 0x387ca000,
0x387cc000, 0x387ce000, 0x387d0000, 0x387d2000, 0x387d4000, 0x387d6000,
0x387d8000, 0x387da000, 0x387dc000, 0x387de000, 0x387e0000, 0x387e2000,
0x387e4000, 0x387e6000, 0x387e8000, 0x387ea000, 0x387ec000, 0x387ee000,
0x387f0000, 0x387f2000, 0x387f4000, 0x387f6000, 0x387f8000, 0x387fa000,
0x387fc000, 0x387fe000
};
static uint16_t m__offset[64] = {
0x0000, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,
0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,
0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,
0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,
0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,
0x0400, 0x0400, 0x0000, 0x0400, 0x0400, 0x0400,
0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,
0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,
0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,
0x0400, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,
0x0400, 0x0400, 0x0400, 0x0400
};
static uint32_t m__exponent[64] = {
0x00000000, 0x00800000, 0x01000000, 0x01800000, 0x02000000, 0x02800000,
0x03000000, 0x03800000, 0x04000000, 0x04800000, 0x05000000, 0x05800000,
0x06000000, 0x06800000, 0x07000000, 0x07800000, 0x08000000, 0x08800000,
0x09000000, 0x09800000, 0x0a000000, 0x0a800000, 0x0b000000, 0x0b800000,
0x0c000000, 0x0c800000, 0x0d000000, 0x0d800000, 0x0e000000, 0x0e800000,
0x0f000000, 0x47800000, 0x80000000, 0x80800000, 0x81000000, 0x81800000,
0x82000000, 0x82800000, 0x83000000, 0x83800000, 0x84000000, 0x84800000,
0x85000000, 0x85800000, 0x86000000, 0x86800000, 0x87000000, 0x87800000,
0x88000000, 0x88800000, 0x89000000, 0x89800000, 0x8a000000, 0x8a800000,
0x8b000000, 0x8b800000, 0x8c000000, 0x8c800000, 0x8d000000, 0x8d800000,
0x8e000000, 0x8e800000, 0x8f000000, 0xc7800000
};
static uint16_t m__base[512] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040,
0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x0c00, 0x1000, 0x1400, 0x1800, 0x1c00,
0x2000, 0x2400, 0x2800, 0x2c00, 0x3000, 0x3400, 0x3800, 0x3c00, 0x4000, 0x4400,
0x4800, 0x4c00, 0x5000, 0x5400, 0x5800, 0x5c00, 0x6000, 0x6400, 0x6800, 0x6c00,
0x7000, 0x7400, 0x7800, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00,
0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00,
0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00,
0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00,
0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00,
0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00,
0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00,
0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00,
0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00,
0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00,
0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00,
0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x7c00, 0x8000, 0x8000, 0x8000, 0x8000,
0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000,
0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8001,
0x8002, 0x8004, 0x8008, 0x8010, 0x8020, 0x8040, 0x8080, 0x8100, 0x8200, 0x8400,
0x8800, 0x8c00, 0x9000, 0x9400, 0x9800, 0x9c00, 0xa000, 0xa400, 0xa800, 0xac00,
0xb000, 0xb400, 0xb800, 0xbc00, 0xc000, 0xc400, 0xc800, 0xcc00, 0xd000, 0xd400,
0xd800, 0xdc00, 0xe000, 0xe400, 0xe800, 0xec00, 0xf000, 0xf400, 0xf800, 0xfc00,
0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00,
0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00,
0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00,
0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00,
0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00,
0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00,
0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00,
0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00,
0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00,
0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00,
0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00, 0xfc00,
0xfc00, 0xfc00
};
static uint8_t m__shift[512] = {
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x17,
0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d,
0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x0d, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x17, 0x16, 0x15, 0x14, 0x13,
0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d,
0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x18, 0x18, 0x18, 0x18, 0x0d
};
MIAPI float m_half2float(uint16_t h)
{
union {
float flt;
uint32_t num;
} out;
int n = h >> 10;
out.num = m__mantissa[ (h & 0x3ff) + m__offset[n]] + m__exponent[n];
return out.flt;
}
MIAPI uint16_t m_float2half(float flt)
{
union {
float flt;
uint32_t num;
} in;
uint32_t n, j;
in.flt = flt;
n = in.num;
j = (n >> 23) & 0x1ff;
return (uint16_t) ((uint32_t) m__base[j] + ((n & 0x007fffff) >> m__shift[j]));
}
MIAPI int m_type_sizeof(char type)
{
switch (type) {
case M_BYTE:
case M_UBYTE:
return sizeof(uint8_t);
break;
case M_SHORT:
case M_USHORT:
case M_HALF:
return sizeof(uint16_t);
break;
case M_BOOL:
case M_INT:
case M_UINT:
return sizeof(uint32_t);
break;
case M_FLOAT:
return sizeof(float);
break;
case M_DOUBLE:
return sizeof(double);
break;
default:
assert(0);
return 0;
}
}
MIAPI void m_image_create(struct m_image *image, char type, int width, int height, int comp)
{
int size = width * height * comp;
assert(size > 0);
/* already allocated */
if (image->data != 0 && type == image->type && width == image->width && height == image->height && comp == image->comp)
return;
M_SAFE_FREE(image->data);
image->data = malloc(size * m_type_sizeof(type));
if( !image->data )
printf("BAD ALLOC:m_image_create\n");
image->type = type;
image->width = width;
image->height = height;
image->comp = comp;
image->size = size;
}
MIAPI void m_image_destroy(struct m_image *image)
{
M_SAFE_FREE(image->data);
memset(image, 0, sizeof(struct m_image));
}
MIAPI void m_image_copy(struct m_image *dest, const struct m_image *src)
{
m_image_create(dest, src->type, src->width, src->height, src->comp);
switch (dest->type) {
case M_BYTE:
case M_UBYTE:
memcpy(dest->data, src->data, dest->size*sizeof(uint8_t));
break;
case M_SHORT:
case M_USHORT:
case M_HALF:
memcpy(dest->data, src->data, dest->size*sizeof(uint16_t));
break;
case M_INT:
case M_UINT:
memcpy(dest->data, src->data, dest->size*sizeof(uint32_t));
break;
case M_FLOAT:
memcpy(dest->data, src->data, dest->size*sizeof(float));
break;
default:
assert(0);
break;
}
}
MIAPI void m_image_copy_sub_image(struct m_image *dest, const struct m_image *src, int x, int y, int w, int h)
{
#define M_COPY_SUBI(T)\
{\
T *sData = (T *)src->data + (miny * src->width + minx) * comp;\
T *dData = (T *)dest->data;\
int y;\
for (y = miny; y <= maxy; y++) {\
memcpy(dData, sData, dstep * sizeof(T));\
dData += dstep;\
sData += sstep;\
}\
}
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_copy_sub_image(dest, &tmp, x, y, w, h);
m_image_destroy(&tmp);
}
else {
int comp = src->comp;
int minx = M_MAX(0, x);
int miny = M_MAX(0, y);
int maxx = M_CLAMP(x + w - 1, 0, src->width - 1);
int maxy = M_CLAMP(y + h - 1, 0, src->height - 1);
int dwidth = 1 + maxx - minx;
int dheight = 1 + maxy - miny;
int sstep = src->width * comp;
int dstep = dwidth * comp;
m_image_create(dest, src->type, dwidth, dheight, src->comp);
switch(src->type)
{
case M_BYTE:
case M_UBYTE:
M_COPY_SUBI(uint8_t);
break;
case M_SHORT:
case M_USHORT:
case M_HALF:
M_COPY_SUBI(uint16_t);
break;
case M_INT:
case M_UINT:
M_COPY_SUBI(uint32_t);
break;
case M_FLOAT:
M_COPY_SUBI(float);
break;
default:
assert(0);
break;
}
}
#undef M_COPY_SUBI
}
MIAPI void m_image_ubyte_to_float(struct m_image *dest, const struct m_image *src)
{
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_ubyte_to_float(dest, &tmp);
m_image_destroy(&tmp);
}
else {
uint8_t *src_data;
float *dest_data;
float ubyte_div = 1.0f / 255.0f;
int i;
m_image_create(dest, M_FLOAT, src->width, src->height, src->comp);
src_data = (uint8_t *)src->data;
dest_data = (float *)dest->data;
for (i = 0; i < src->size; i++)
dest_data[i] = (float)src_data[i] * ubyte_div;
}
}
MIAPI void m_image_ushort_to_float(struct m_image *dest, const struct m_image *src)
{
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_ushort_to_float(dest, &tmp);
m_image_destroy(&tmp);
}
else {
uint16_t *src_data;
float *dest_data;
float ushort_div = 1.0f / (float)65535;
int i;
m_image_create(dest, M_FLOAT, src->width, src->height, src->comp);
src_data = (uint16_t *)src->data;
dest_data = (float *)dest->data;
for (i = 0; i < src->size; i++)
dest_data[i] = (float)src_data[i] * ushort_div;
}
}
MIAPI void m_image_half_to_float(struct m_image *dest, const struct m_image *src)
{
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_half_to_float(dest, &tmp);
m_image_destroy(&tmp);
}
else {
uint16_t *src_data;
float *dest_data;
int i;
m_image_create(dest, M_FLOAT, src->width, src->height, src->comp);
src_data = (uint16_t *)src->data;
dest_data = (float *)dest->data;
for (i = 0; i < src->size; i++)
dest_data[i] = m_half2float(src_data[i]);
}
}
MIAPI void m_image_float_to_ubyte(struct m_image *dest, const struct m_image *src)
{
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_float_to_ubyte(dest, &tmp);
m_image_destroy(&tmp);
}
else {
float *src_data;
uint8_t *dest_data;
int i;
m_image_create(dest, M_UBYTE, src->width, src->height, src->comp);
src_data = (float *)src->data;
dest_data = (uint8_t *)dest->data;
for (i = 0; i < src->size; i++) {
int x = (int)(src_data[i] * 255.0f + 0.5f);
dest_data[i] = (uint8_t)M_CLAMP(x, 0, 255);
}
}
}
MIAPI void m_image_float_to_ushort(struct m_image *dest, const struct m_image *src)
{
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_float_to_ushort(dest, &tmp);
m_image_destroy(&tmp);
}
else {
float *src_data;
uint16_t *dest_data;
int i;
m_image_create(dest, M_USHORT, src->width, src->height, src->comp);
src_data = (float *)src->data;
dest_data = (uint16_t *)dest->data;
for (i = 0; i < src->size; i++) {
int x = (int)(src_data[i] * 65535);
dest_data[i] = (uint16_t)M_CLAMP(x, 0, 65535);
}
}
}
MIAPI void m_image_float_to_half(struct m_image *dest, const struct m_image *src)
{
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_float_to_half(dest, &tmp);
m_image_destroy(&tmp);
}
else {
float *src_data;
uint16_t *dest_data;
int i;
m_image_create(dest, M_HALF, src->width, src->height, src->comp);
src_data = (float *)src->data;
dest_data = (uint16_t *)dest->data;
for (i = 0; i < src->size; i++)
dest_data[i] = m_float2half(src_data[i]);
}
}
MIAPI void m_image_extract_component(struct m_image *dest, const struct m_image *src, int c)
{
#define M_EXTRACT(T)\
{\
T *dest_pixel = (T *)dest->data;\
T *src_pixel = (T *)src->data;\
for (i = 0; i < size; i += comp) {\
(*dest_pixel) = src_pixel[c];\
dest_pixel++;\
src_pixel += comp;\
}\
}
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_extract_component(dest, &tmp, c);
m_image_destroy(&tmp);
}
else {
int width = src->width;
int height = src->height;
int comp = src->comp;
int size = src->size;
int i;
if(c >= src->comp) {
assert(0);
return;
}
m_image_create(dest, src->type, width, height, 1);
switch(src->type)
{
case M_BYTE:
case M_UBYTE:
M_EXTRACT(uint8_t);
break;
case M_SHORT:
case M_USHORT:
case M_HALF:
M_EXTRACT(uint16_t);
break;
case M_INT:
case M_UINT:
M_EXTRACT(uint32_t);
break;
case M_FLOAT:
M_EXTRACT(float);
break;
default:
assert(0);
break;
}
}
#undef M_EXTRACT
}
MIAPI void m_image_reframe_zero(struct m_image *dest, const struct m_image *src, int left, int top, int right, int bottom)
{
#define M_REFRAME(T)\
{\
T *src_data;\
T *src_pixel;\
T *dest_pixel;\
int c;\
int x, y;\
m_image_create(dest, src->type, width2, height2, comp);\
src_data = (T *)src->data;\
dest_pixel = (T *)dest->data;\
for (y = 0; y < height2; y++) {\
int ys = y - top;\
for (x = 0; x < width2; x++) {\
int xs = x - left;\
if (ys >= 0 && ys < height && xs >= 0 && xs < width) {\
src_pixel = src_data + (ys * width + xs) * comp;\
for (c = 0; c < comp; c++)\
dest_pixel[c] = src_pixel[c];\
}\
else {\
for (c = 0; c < comp; c++)\
dest_pixel[c] = 0;\
}\
dest_pixel += comp;\
}\
}\
}
if(left != 0 || top != 0 || right != 0 || bottom != 0) {
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_reframe_zero(dest, &tmp, left, top, right, bottom);
m_image_destroy(&tmp);
}
else {
int comp = src->comp;
int width = src->width;
int height = src->height;
int width2 = width + left + right;
int height2 = height + top + bottom;
if(width2 > 0 && height2 > 0) {
switch(src->type) {
case M_BYTE:
case M_UBYTE:
M_REFRAME(uint8_t);
break;
case M_SHORT:
case M_USHORT:
case M_HALF:
M_REFRAME(uint16_t);
break;
case M_INT:
case M_UINT:
M_REFRAME(uint32_t);
break;
case M_FLOAT:
M_REFRAME(float);
break;
default:
assert(0);
break;
}
}
else {
assert(0);
}
}
}
else {
m_image_copy(dest, src);
}
#undef M_REFRAME
}
MIAPI void m_image_reframe(struct m_image *dest, const struct m_image *src, int left, int top, int right, int bottom)
{
#define M_REFRAME(T)\
{\
T *src_data;\
T *src_pixel;\
T *dest_pixel;\
int c;\
int x, y;\
m_image_create(dest, src->type, width2, height2, comp);\
src_data = (T *)src->data;\
dest_pixel = (T *)dest->data;\
for (y = 0; y < height2; y++) {\
T *src_y;\
int ys = y - top;\
src_y = src_data + M_CLAMP(ys, 0, hm1) * width * comp;\
for (x = 0; x < width2; x++) {\
int xs = x - left;\
src_pixel = src_y + M_CLAMP(xs, 0, wm1) * comp;\
for (c = 0; c < comp; c++)\
dest_pixel[c] = src_pixel[c];\
dest_pixel += comp;\
}\
}\
}
if(left != 0 || top != 0 || right != 0 || bottom != 0) {
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_reframe(dest, &tmp, left, top, right, bottom);
m_image_destroy(&tmp);
}
else {
int comp = src->comp;
int width = src->width;
int height = src->height;
int width2 = width + left + right;
int height2 = height + top + bottom;
int wm1 = width - 1;
int hm1 = height - 1;
if(width2 > 0 && height2 > 0) {
switch(src->type) {
case M_BYTE:
case M_UBYTE:
M_REFRAME(uint8_t);
break;
case M_SHORT:
case M_USHORT:
case M_HALF:
M_REFRAME(uint16_t);
break;
case M_INT:
case M_UINT:
M_REFRAME(uint32_t);
break;
case M_FLOAT:
M_REFRAME(float);
break;
default:
assert(0);
break;
}
}
else {
assert(0);
}
}
}
else {
m_image_copy(dest, src);
}
#undef M_REFRAME
}
MIAPI void m_image_rotate_left(struct m_image *dest, const struct m_image *src)
{
#define M_ROTATE_L(T)\
{\
T *src_data = (T *)src->data;\
T *dest_pixel = (T *)dest->data;\
for (y = 0; y < width; y++)\
for (x = 0; x < height; x++) {\
T *src_pixel = src_data + (x * width + (width - 1 - y)) * comp;\
for (c = 0; c < comp; c++)\
dest_pixel[c] = src_pixel[c];\
dest_pixel += comp;\
}\
}
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_rotate_left(dest, &tmp);
m_image_destroy(&tmp);
}
else {
int width = src->width;
int height = src->height;
int comp = src->comp;
int x, y, c;
m_image_create(dest, src->type, height, width, comp);
switch(src->type)
{
case M_BYTE:
case M_UBYTE:
M_ROTATE_L(uint8_t);
break;
case M_SHORT:
case M_USHORT:
case M_HALF:
M_ROTATE_L(uint16_t);
break;
case M_INT:
case M_UINT:
M_ROTATE_L(uint32_t);
break;
case M_FLOAT:
M_ROTATE_L(float);
break;
default:
assert(0);
break;
}
}
#undef M_ROTATE_L
}
MIAPI void m_image_rotate_right(struct m_image *dest, const struct m_image *src)
{
#define M_ROTATE_R(T)\
{\
T *src_data = (T *)src->data;\
T *dest_pixel = (T *)dest->data;\
for (y = 0; y < width; y++)\
for (x = 0; x < height; x++) {\
T *src_pixel = src_data + ((height - 1 - x) * width + y) * comp;\
for (c = 0; c < comp; c++)\
dest_pixel[c] = src_pixel[c];\
dest_pixel += comp;\
}\
}
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_rotate_right(dest, &tmp);
m_image_destroy(&tmp);
}
else {
int width = src->width;
int height = src->height;
int comp = src->comp;
int x, y, c;
m_image_create(dest, src->type, height, width, comp);
switch(src->type)
{
case M_BYTE:
case M_UBYTE:
M_ROTATE_R(uint8_t);
break;
case M_SHORT:
case M_USHORT:
case M_HALF:
M_ROTATE_R(uint16_t);
break;
case M_INT:
case M_UINT:
M_ROTATE_R(uint32_t);
break;
case M_FLOAT:
M_ROTATE_R(float);
break;
default:
assert(0);
break;
}
}
#undef M_ROTATE_R
}
MIAPI void m_image_rotate_180(struct m_image *dest, const struct m_image *src)
{
#define M_ROTATE_180(T)\
{\
T *src_data = (T *)src->data;\
T *dest_pixel = (T *)dest->data;\
for (y = 0; y < height; y++)\
for (x = 0; x < width; x++) {\
T *src_pixel = src_data + ((height - 1 - y) * width + (width - 1 - x)) * comp;\
for (c = 0; c < comp; c++)\
dest_pixel[c] = src_pixel[c];\
dest_pixel += comp;\
}\
}
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_rotate_180(dest, &tmp);
m_image_destroy(&tmp);
}
else {
int width = src->width;
int height = src->height;
int comp = src->comp;
int x, y, c;
m_image_create(dest, src->type, width, height, comp);
switch(src->type)
{
case M_BYTE:
case M_UBYTE:
M_ROTATE_180(uint8_t);
break;
case M_SHORT:
case M_USHORT:
case M_HALF:
M_ROTATE_180(uint16_t);
break;
case M_INT:
case M_UINT:
M_ROTATE_180(uint32_t);
break;
case M_FLOAT:
M_ROTATE_180(float);
break;
default:
assert(0);
break;
}
}
#undef M_ROTATE_180
}
MIAPI void m_image_mirror_x(struct m_image *dest, const struct m_image *src)
{
#define M_MIRROR_X(T)\
{\
T *src_data = (T *)src->data;\
T *dest_pixel = (T *)dest->data;\
for (y = 0; y < height; y++)\
for (x = 0; x < width; x++) {\
T *src_pixel = src_data + (y * width + (width - 1 - x)) * comp;\
for (c = 0; c < comp; c++)\
dest_pixel[c] = src_pixel[c];\
dest_pixel += comp;\
}\
}
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_mirror_x(dest, &tmp);
m_image_destroy(&tmp);
}
else {
int width = src->width;
int height = src->height;
int comp = src->comp;
int x, y, c;
m_image_create(dest, src->type, width, height, comp);
switch(src->type)
{
case M_BYTE:
case M_UBYTE:
M_MIRROR_X(uint8_t);
break;
case M_SHORT:
case M_USHORT:
case M_HALF:
M_MIRROR_X(uint16_t);
break;
case M_INT:
case M_UINT:
M_MIRROR_X(uint32_t);
break;
case M_FLOAT:
M_MIRROR_X(float);
break;
default:
assert(0);
break;
}
}
#undef M_MIRROR_X
}
MIAPI void m_image_mirror_y(struct m_image *dest, const struct m_image *src)
{
#define M_MIRROR_Y(T)\
{\
T *src_data = (T *)src->data;\
T *dest_pixel = (T *)dest->data;\
for (y = 0; y < height; y++)\
for (x = 0; x < width; x++) {\
T *src_pixel = src_data + ((height - 1 - y) * width + x) * comp;\
for (c = 0; c < comp; c++)\
dest_pixel[c] = src_pixel[c];\
dest_pixel += comp;\
}\
}
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_mirror_y(dest, &tmp);
m_image_destroy(&tmp);
}
else {
int width = src->width;
int height = src->height;
int comp = src->comp;
int x, y, c;
m_image_create(dest, src->type, width, height, comp);
switch(src->type)
{
case M_BYTE:
case M_UBYTE:
M_MIRROR_Y(uint8_t);
break;
case M_SHORT:
case M_USHORT:
case M_HALF:
M_MIRROR_Y(uint16_t);
break;
case M_INT:
case M_UINT:
M_MIRROR_Y(uint32_t);
break;
case M_FLOAT:
M_MIRROR_Y(float);
break;
default:
assert(0);
break;
}
}
#undef M_MIRROR_Y
}
MIAPI void m_image_premultiply(struct m_image *dest, const struct m_image *src)
{
float *dest_p, *src_p;
int i;
assert(src->size > 0 && src->type == M_FLOAT && src->comp == 4);
m_image_create(dest, M_FLOAT, src->width, src->height, 4);
dest_p = (float *)dest->data;
src_p = (float *)src->data;
for (i = 0; i < src->size; i+=4) {
dest_p[0] = src_p[0] * src_p[3];
dest_p[1] = src_p[1] * src_p[3];
dest_p[2] = src_p[2] * src_p[3];
dest_p[3] = src_p[3];
dest_p += 4;
src_p += 4;
}
}
MIAPI void m_image_unpremultiply(struct m_image *dest, const struct m_image *src)
{
float *dest_p, *src_p;
int i;
assert(src->size > 0 && src->type == M_FLOAT && src->comp == 4);
m_image_create(dest, M_FLOAT, src->width, src->height, 4);
dest_p = (float *)dest->data;
src_p = (float *)src->data;
for (i = 0; i < src->size; i+=4) {
if (src_p[3] > 0.0f) {
float x = 1.0f / src_p[3];
dest_p[0] = src_p[0] * x;
dest_p[1] = src_p[1] * x;
dest_p[2] = src_p[2] * x;
}
else {
dest_p[0] = 0;
dest_p[1] = 0;
dest_p[2] = 0;
}
dest_p[3] = src_p[3];
dest_p += 4;
src_p += 4;
}
}
MIAPI void m_image_sRGB_to_linear(struct m_image *dest, const struct m_image *src)
{
float *dest_p, *src_p;
int i, c, comp3 = M_MIN(src->comp, 3);
assert(src->size > 0 && src->type == M_FLOAT);
m_image_create(dest, M_FLOAT, src->width, src->height, src->comp);
dest_p = (float *)dest->data;
src_p = (float *)src->data;
if (dest == src) {
#pragma omp parallel for schedule(dynamic, 8)
for (i = 0; i < src->size; i+=src->comp) {
m_sRGB_to_linear(dest_p+i, src_p+i, comp3);
}
}
else {
#pragma omp parallel for schedule(dynamic, 8)
for (i = 0; i < src->size; i+=src->comp) {
m_sRGB_to_linear(dest_p+i, src_p+i, comp3);
for (c = comp3; c < src->comp; c++)
dest_p[i+c] = src_p[i+c];
}
}
}
MIAPI void m_image_linear_to_sRGB(struct m_image *dest, const struct m_image *src)
{
float *dest_p, *src_p;
int i, c, comp3 = M_MIN(src->comp, 3);
assert(src->size > 0 && src->type == M_FLOAT);
m_image_create(dest, M_FLOAT, src->width, src->height, src->comp);
dest_p = (float *)dest->data;
src_p = (float *)src->data;
if (dest == src) {
#pragma omp parallel for schedule(dynamic, 8)
for (i = 0; i < src->size; i+=src->comp) {
m_linear_to_sRGB(dest_p+i, src_p+i, comp3);
}
}
else {
#pragma omp parallel for schedule(dynamic, 8)
for (i = 0; i < src->size; i+=src->comp) {
m_linear_to_sRGB(dest_p+i, src_p+i, comp3);
for (c = comp3; c < src->comp; c++)
dest_p[i+c] = src_p[i+c];
}
}
}
MIAPI void m_image_summed_area(struct m_image *dest, const struct m_image *src)
{
float *src_pixel;
float *dest_pixel;
int width = src->width;
int height = src->height;
int comp = src->comp;
int x, y, c;
assert(src->size > 0 && src->type == M_FLOAT);
if (dest != src)
m_image_copy(dest, src);
/* horiz sum */
dest_pixel = (float *)dest->data;
for (y = 0; y < height; y++) {
float *prev_pixel = dest_pixel;
dest_pixel += comp;
for (x = 1; x < width; x++) {
for (c = 0; c < comp; c++)
dest_pixel[c] += prev_pixel[c];
prev_pixel = dest_pixel;
dest_pixel += comp;
}
}
/* vertical sum */
src_pixel = (float *)dest->data;
dest_pixel = (float *)dest->data + width * comp;
for (y = 1; y < height; y++)
for (x = 0; x < width; x++) {
for (c = 0; c < comp; c++)
dest_pixel[c] += src_pixel[c];
src_pixel += comp;
dest_pixel += comp;
}
}
MIAPI void m_image_convolution_h_raw(struct m_image *dest, const struct m_image *src, float *kernel, int size)
{
float *src_data;
float *dest_data;
int radius = (size - 1) / 2;
int width = src->width - radius * 2;
int height = src->height;
int comp = src->comp;
int y, ystep, ystepc;
assert(src->size > 0 && src->type == M_FLOAT);
/* create destination images */
m_image_create(dest, M_FLOAT, width, height, comp);
/* clear */
memset(dest->data, 0, dest->size * sizeof(float));
src_data = (float *)src->data;
dest_data = (float *)dest->data;
ystep = width * comp;
ystepc = src->width * comp;
#pragma omp parallel for schedule(dynamic, 8)
for (y = 0; y < height; y++) {
float *dest_pixel = dest_data + y * ystep;
float *src_pixel_y = src_data + y * ystepc;
int x;
for (x = 0; x < width; x++) {
float *src_pixel;
int i, k;
src_pixel = src_pixel_y + (x * comp);
/* apply kernel */
for (k = 0; k < size; k++) {
float v = kernel[k];
for (i = 0; i < comp; i++)
dest_pixel[i] += (*src_pixel++) * v;
}
dest_pixel += comp;
}
}
}
MIAPI void m_image_convolution_v_raw(struct m_image *dest, const struct m_image *src, float *kernel, int size)
{
float *src_data;
float *dest_data;
int radius = (size - 1) / 2;
int width = src->width;
int height = src->height - radius * 2;
int comp = src->comp;
int y, ystep;
assert(src->size > 0 && src->type == M_FLOAT);
/* create destination images */
m_image_create(dest, M_FLOAT, width, height, comp);
/* clear */
memset(dest->data, 0, dest->size * sizeof(float));
src_data = (float *)src->data;
dest_data = (float *)dest->data;
ystep = width * comp;
#pragma omp parallel for schedule(dynamic, 8)
for (y = 0; y < height; y++) {
float *dest_pixel = dest_data + y * ystep;
int x;
for (x = 0; x < width; x++) {
float *src_pixel;
int i, k;
src_pixel = src_data + (y * width + x) * comp;
/* apply kernel */
for (k = 0; k < size; k++) {
float v = kernel[k];
for (i = 0; i < comp; i++)
dest_pixel[i] += src_pixel[i] * v;
src_pixel += ystep;
}
dest_pixel += comp;
}
}
}
MIAPI void m_image_convolution_h(struct m_image *dest, const struct m_image *src, float *kernel, int size)
{
struct m_image mask = M_IMAGE_IDENTITY();
struct m_image tmp = M_IMAGE_IDENTITY();
float *destp;
int radius = (size - 1) / 2;
int x, y, c;
assert(src->size > 0 && src->type == M_FLOAT);
/* create source and destination images */
m_image_reframe_zero(&tmp, src, radius, 0, radius, 0); /* apply clamped margin */
m_image_convolution_h_raw(dest, &tmp, kernel, size);
/* create gaussian mask */
m_image_create(&tmp, M_FLOAT, src->width + radius * 2, 1, 1);
for (x = 0; x < radius; x++)
((float *)tmp.data)[x] = 0;
for (; x < (tmp.width - radius); x++)
((float *)tmp.data)[x] = 1;
for (; x < tmp.width; x++)
((float *)tmp.data)[x] = 0;
m_image_convolution_h_raw(&mask, &tmp, kernel, size);
/* mask */
for (x = 0; x < mask.width; x++)
((float *)mask.data)[x] = 1.0f / ((float *)mask.data)[x];
destp = (float *)dest->data;
for (y = 0; y < dest->height; y++) {
for (x = 0; x < dest->width; x++) {
for (c = 0; c < dest->comp; c++)
destp[c] *= ((float *)mask.data)[x];
destp += dest->comp;
}
}
m_image_destroy(&mask);
m_image_destroy(&tmp);
}
MIAPI void m_image_convolution_v(struct m_image *dest, const struct m_image *src, float *kernel, int size)
{
struct m_image tmp = M_IMAGE_IDENTITY();
struct m_image mask = M_IMAGE_IDENTITY();
float *destp;
int radius = (size - 1) / 2;
int x, y, c;
assert(src->size > 0 && src->type == M_FLOAT);
/* create source and destination images */
m_image_reframe_zero(&tmp, src, 0, radius, 0, radius); /* apply clamped margin */
m_image_convolution_v_raw(dest, &tmp, kernel, size);
/* create gaussian mask */
m_image_create(&tmp, M_FLOAT, 1, src->height + radius * 2, 1);
for (y = 0; y < radius; y++)
((float *)tmp.data)[y] = 0;
for (; y < (tmp.height - radius); y++)
((float *)tmp.data)[y] = 1;
for (; y < tmp.height; y++)
((float *)tmp.data)[y] = 0;
m_image_convolution_v_raw(&mask, &tmp, kernel, size);
/* mask */
destp = (float *)dest->data;
for (y = 0; y < dest->height; y++) {
float idiv = 1.0f / ((float *)mask.data)[y];
for (x = 0; x < dest->width; x++) {
for (c = 0; c < dest->comp; c++)
destp[c] *= idiv;
destp += dest->comp;
}
}
m_image_destroy(&mask);
m_image_destroy(&tmp);
}
MIAPI void m_image_gaussian_blur(struct m_image *dest, const struct m_image *src, float dx, float dy)
{
struct m_image tmp = M_IMAGE_IDENTITY();
float *kernelx = NULL, *kernely = NULL;
int kernelx_size = (int)(dx / 0.65f + 0.5f) * 2 + 1;
int kernely_size = (int)(dy / 0.65f + 0.5f) * 2 + 1;
assert(src->size > 0 && src->type == M_FLOAT);
/* exit */
if (dx < FLT_EPSILON && dy < FLT_EPSILON) {
if (dest != src) m_image_copy(dest, src);
return;
}
/* x blur */
if (dx > 0) {
kernelx = (float *)malloc(kernelx_size * sizeof(float));
m_gaussian_kernel(kernelx, kernelx_size, dx);
if (dy > 0)
m_image_convolution_h(&tmp, src, kernelx, kernelx_size);
else
m_image_convolution_h(dest, src, kernelx, kernelx_size);
}
/* y blur */
if (dy > 0) {
kernely = (float *)malloc(kernely_size * sizeof(float));
m_gaussian_kernel(kernely, kernely_size, dy);
if (dx > 0)
m_image_convolution_v(dest, &tmp, kernely, kernely_size);
else
m_image_convolution_v(dest, src, kernely, kernely_size);
}
m_image_destroy(&tmp);
if(kernely) free(kernely);
if(kernelx) free(kernelx);
}
MIAPI void m_image_grey(struct m_image *dest, const struct m_image *src)
{
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_grey(dest, &tmp);
m_image_destroy(&tmp);
}
else {
float *src_pixel;
float *dest_pixel;
int size = src->size;
int i, c = src->comp;
assert(src->size > 0 && src->type == M_FLOAT && src->comp > 2);
m_image_create(dest, M_FLOAT, src->width, src->height, 1);
src_pixel = (float *)src->data;
dest_pixel = (float *)dest->data;
for (i = 0; i < size; i+=c) {
float v = src_pixel[0] * 0.3f + src_pixel[1] * 0.5f + src_pixel[2] * 0.2f;
*dest_pixel = v;
dest_pixel++;
src_pixel+=c;
}
}
}
MIAPI void m_image_max(struct m_image *dest, const struct m_image *src)
{
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_max(dest, &tmp);
m_image_destroy(&tmp);
}
else {
float *src_pixel;
float *dest_pixel;
int size = src->size;
int i, j, c = src->comp;
assert(src->size > 0 && src->type == M_FLOAT);
m_image_create(dest, M_FLOAT, src->width, src->height, 1);
src_pixel = (float *)src->data;
dest_pixel = (float *)dest->data;
for (i = 0; i < size; i+=c) {
float v = src_pixel[0];
for (j = 1; j < c; j++)
v = M_MAX(v, src_pixel[j]);
*dest_pixel = v;
dest_pixel++;
src_pixel+=c;
}
}
}
MIAPI void m_image_max_abs(struct m_image *dest, const struct m_image *src)
{
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m_image_max_abs(dest, &tmp);
m_image_destroy(&tmp);
}
else {
float *src_pixel;
float *dest_pixel;
int size = src->size;
int i, j, c = src->comp;
assert(src->size > 0 && src->type == M_FLOAT);
m_image_create(dest, M_FLOAT, src->width, src->height, 1);
src_pixel = (float *)src->data;
dest_pixel = (float *)dest->data;
for (i = 0; i < size; i+=c) {
float v = fabsf(src_pixel[0]);
for (j = 1; j < c; j++)
v = M_MAX(v, fabsf(src_pixel[j]));
*dest_pixel = v;
dest_pixel++;
src_pixel+=c;
}
}
}
static float m__convolve_pixel(float *data, int width, float *kernel)
{
float sum = 0; int i, j;
for (i = 0; i < 3; i++) {
float *pixel = data + width * i;
for (j = 0; j < 3; j++) {
sum += (*pixel) * (*kernel);
pixel++;
kernel++;
}
}
return sum;
}
MIAPI void m_image_sobel(struct m_image *dest, const struct m_image *src)
{
struct m_image copy = M_IMAGE_IDENTITY();
float ky[9] = {-1, -2, -1, 0, 0, 0, 1, 2, 1};
float kx[9] = {-1, 0, 1, -2, 0, 2, -1, 0, 1};
int width = src->width;
int height = src->height;
int w2 = width + 2;
int y;
assert(src->size > 0 && src->type == M_FLOAT && src->comp == 1);
/* create source and destination images */
m_image_reframe(©, src, 1, 1, 1, 1); /* apply clamped margin */
m_image_create(dest, M_FLOAT, width, height, 2);
#pragma omp parallel for schedule(dynamic, 8)
for (y = 0; y < height; y++) {
float * src_pixel = (float*)copy.data + y * w2;
float * dest_pixel = (float*)dest->data + y * width * 2;
int x;
for (x = 0; x < width; x++) {
dest_pixel[0] = m__convolve_pixel(src_pixel, w2, kx);
dest_pixel[1] = m__convolve_pixel(src_pixel, w2, ky);
src_pixel++;
dest_pixel += 2;
}
}
m_image_destroy(©);
}
MIAPI void m_image_harris(struct m_image *dest, const struct m_image *src, float radius)
{
struct m_image tmp1 = M_IMAGE_IDENTITY();
struct m_image tmp2 = M_IMAGE_IDENTITY();
/* sobel */
m_image_sobel(&tmp1, src);
/* sst */
m_image_create(&tmp2, M_FLOAT, src->width, src->height, 3);
m_sst((float *)tmp2.data, (float *)tmp1.data, src->width * src->height);
/* blur */
m_image_copy(&tmp1, &tmp2);
m_image_gaussian_blur(&tmp2, &tmp1, radius, radius);
/* harris response */
m_image_create(dest, M_FLOAT, src->width, src->height, 1);
m_harris_response((float *)dest->data, (float *)tmp2.data, src->width * src->height);
m_image_destroy(&tmp1);
m_image_destroy(&tmp2);
}
#define M_WRITE_PIXEL(dest, x0, y0, v) {*(dest + w * (y0) + (x0)) = v;}
#define M_PUSH_PIXEL(x2, y2) if((stack_i+3) < stack_size && m__test_pixel(data, w, h, x2, y2, ref)) {\
stack_i+=2;\
stack[stack_i] = (uint16_t)(x2);\
stack[stack_i+1] = (uint16_t)(y2);\
M_WRITE_PIXEL(data, x2, y2, value);\
}
static int m__test_pixel(uint8_t *src, int w, int h, int x, int y, uint8_t ref)
{
if (! (x >= 0 && x < w && y >= 0 && y < h))
return 0;
return (*(src + w * y + x) == ref);
}
MIAPI int m_image_floodfill_4x(struct m_image *dest, int x, int y, uint8_t ref, uint8_t value, uint16_t *stack, int stack_size)
{
uint8_t *data = (uint8_t *)dest->data;
int w = dest->width;
int h = dest->height;
int stack_i = 0;
assert(dest->size > 0 && dest->type == M_UBYTE);
if(! m__test_pixel(data, w, h, x, y, ref))
return 0;
stack[0] = (uint16_t)x;
stack[1] = (uint16_t)y;
M_WRITE_PIXEL(data, x, y, value);
while (stack_i >= 0) {
x = stack[stack_i];
y = stack[stack_i+1];
stack_i-=2;
M_PUSH_PIXEL(x + 1, y)
M_PUSH_PIXEL(x - 1, y)
M_PUSH_PIXEL(x, y + 1)
M_PUSH_PIXEL(x, y - 1)
}
return 1;
}
MIAPI int m_image_floodfill_8x(struct m_image *dest, int x, int y, uint8_t ref, uint8_t value, uint16_t *stack, int stack_size)
{
uint8_t *data = (uint8_t *)dest->data;
int w = dest->width;
int h = dest->height;
int stack_i = 0;
assert(dest->size > 0 && dest->type == M_UBYTE);
if(! m__test_pixel(data, w, h, x, y, ref))
return 0;
stack[0] = (uint16_t)x;
stack[1] = (uint16_t)y;
M_WRITE_PIXEL(data, x, y, value);
while (stack_i >= 0) {
x = stack[stack_i];
y = stack[stack_i+1];
stack_i-=2;
M_PUSH_PIXEL(x + 1, y)
M_PUSH_PIXEL(x - 1, y)
M_PUSH_PIXEL(x, y + 1)
M_PUSH_PIXEL(x, y - 1)
M_PUSH_PIXEL(x + 1, y + 1)
M_PUSH_PIXEL(x + 1, y - 1)
M_PUSH_PIXEL(x - 1, y + 1)
M_PUSH_PIXEL(x - 1, y - 1)
}
return 1;
}
#undef M_WRITE_PIXEL
#undef M_PUSH_PIXEL
static void m__dilate_erode(struct m_image *dest, const struct m_image *src, uint8_t ref, uint8_t value, int copy)
{
uint8_t *src_data = (uint8_t *)src->data;
uint8_t *src_pixel = src_data;
uint8_t *dest_pixel;
int w = src->width;
int h = src->height;
int y;
assert(src->size > 0 && src->type == M_UBYTE);
m_image_create(dest, M_UBYTE, w, h, 1);
dest_pixel = (uint8_t *)dest->data;
if (copy)
memcpy(dest_pixel, src_data, dest->size * sizeof(char));
else
memset(dest_pixel, 0, dest->size * sizeof(char));
for (y=0; y<h; y++) {
int x;
for (x=0; x<w; x++) {
uint8_t c1, c2, c3, c4, c5;
c1 = *src_pixel;
if (c1 == ref) {
c2 = x > 0 ? *(src_data + y * w + (x - 1)) : c1;
c3 = y > 0 ? *(src_data + (y - 1) * w + x) : c1;
c4 = (x + 1) < w ? *(src_data + y * w + x + 1) : c1;
c5 = (y + 1) < h ? *(src_data + (y + 1) * w + x) : c1;
if (c2 != c1 || c3 != c1 || c4 != c1 || c5 != c1)
*dest_pixel = value;
}
src_pixel++;
dest_pixel++;
}
}
}
MIAPI void m_image_dilate(struct m_image *dest, const struct m_image *src)
{
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m__dilate_erode(dest, &tmp, 0, 255, 1);
m_image_destroy(&tmp);
}
else {
m__dilate_erode(dest, src, 0, 255, 1);
}
}
MIAPI void m_image_erode(struct m_image *dest, const struct m_image *src)
{
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m__dilate_erode(dest, &tmp, 255, 0, 1);
m_image_destroy(&tmp);
}
else {
m__dilate_erode(dest, src, 255, 0, 1);
}
}
MIAPI void m_image_edge_4x(struct m_image *dest, const struct m_image *src, uint8_t ref)
{
if (dest == src) {
struct m_image tmp = M_IMAGE_IDENTITY();
m_image_copy(&tmp, src);
m__dilate_erode(dest, &tmp, ref, 255, 0);
m_image_destroy(&tmp);
}
else {
m__dilate_erode(dest, src, ref, 255, 0);
}
}
/* Following C code from the article
"Efficient Binary Image Thinning using Neighborhood Maps"
by Joseph M. Cychosz, in "Graphics Gems IV", Academic Press, 1994
Thins the image using Rosenfeld's parallel thinning algorithm.
*/
/* Direction m__masks:
N S W E
*/
static int m__masks[] = {0200, 0002, 0040, 0010};
/* True if pixel neighbor map indicates the pixel is 8-simple and
not an end point and thus can be deleted. The neighborhood
map is defined as an integer of bits abcdefghi with a non-zero
bit representing a non-zero pixel. The bit assignment for the
neighborhood is:
a b c
d e f
g h i
*/
static uint8_t m__delete_map[512] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
MIAPI void m_image_thin(struct m_image *dest)
{
uint8_t *data; /* image data */
uint8_t ** ip; /* scanline pointers, ip[y][x] */
uint8_t * qb; /* Neighborhood maps of previous scanline */
int xsize, ysize; /* Image resolution */
int x, y; /* Pixel location */
int i; /* Pass index */
int pc = 0; /* Pass count */
int count = 1; /* Deleted pixel count */
int p, q; /* Neighborhood maps of adjacent cells */
int m; /* Deletion direction mask */
assert(dest->size > 0 && dest->type == M_UBYTE);
data = (uint8_t *)dest->data;
xsize = dest->width;
ysize = dest->height;
qb = (uint8_t *)malloc(xsize * sizeof(char));
qb[xsize-1] = 0; /* Used for lower-right pixel */
/* alloc scanline pointers */
ip = (uint8_t **)malloc(sizeof(void *) * ysize);
/* set scanline pointers */
for (y=0; y<ysize; y++) {
ip[y] = data + y*xsize;
}
while (count) { /* Scan image while deletions */
pc++;
count = 0;
for (i=0; i<4; i++) {
m = m__masks[i];
/* Build initial previous scan buffer */
p = ip[0][0] != 0;
for (x=0; x<xsize-1; x++) {
p = ((p<<1)&0006) | (ip[0][x+1] != 0);
qb[x] = (uint8_t)p;
}
/* Scan image for pixel deletion candidates */
for (y=0; y<ysize-1; y++) {
q = qb[0];
p = ((q<<3)&0110) | (ip[y+1][0] != 0);
for (x=0; x<xsize-1; x++) {
q = qb[x];
p = ((p<<1)&0666) | ((q<<3)&0110) | (ip[y+1][x+1] != 0);
qb[x] = (uint8_t)p;
if (((p&m) == 0) && m__delete_map[p]) {
if (ip[y][x] != 0) {
count++;
ip[y][x] = 0;
}
}
}
/* Process right edge pixel */
p = (p<<1)&0666;
if ((p&m) == 0 && m__delete_map[p]) {
if (ip[y][xsize-1] != 0) {
count++;
ip[y][xsize-1] = 0;
}
}
}
/* Process bottom scan line */
for (x=0; x<xsize; x++) {
q = qb[x];
p = ((p<<1)&0666) | ((q<<3)&0110);
if ((p&m) == 0 && m__delete_map[p]) {
if (ip[ysize-1][x] != 0) {
count++;
ip[ysize-1][x] = 0;
}
}
}
}
}
free(qb);
free(ip);
}
MIAPI void m_image_non_max_supp(struct m_image *dest, const struct m_image *src, int radius, float threshold)
{
float *src_data, *dest_data;
float *src_pixel, *dest_pixel;
int width = src->width;
int height = src->height;
int x, y;
assert(src->size > 0 && src->type == M_FLOAT && src->comp == 1);
m_image_copy(dest, src);
src_data = (float *)src->data;
dest_data = (float *)dest->data;
src_pixel = src_data;
dest_pixel = dest_data;
for (y = 0; y < height; y++)
for (x = 0; x < width; x++) {
int minx, miny, maxx, maxy, xx, yy;
if (*src_pixel < threshold) {
*dest_pixel = 0;
goto end;
}
minx = M_MAX(0, x - radius);
miny = M_MAX(0, y - radius);
maxx = M_MIN(width - 1, x + radius);
maxy = M_MIN(height - 1, y + radius);
for (yy = miny; yy <= maxy; yy++)
for (xx = minx; xx <= maxx; xx++) {
float *src_pixel2 = src_data + yy*width + xx;
if (*src_pixel2 > *src_pixel) {
*dest_pixel = 0;
goto end;
}
}
end:
src_pixel++;
dest_pixel++;
}
}
MIAPI int m_image_corner_harris(const struct m_image *src, int margin, float radius, float threshold, int *corners, int max_count)
{
struct m_image harris = M_IMAGE_IDENTITY();
struct m_image nms = M_IMAGE_IDENTITY();
float *pixel;
int width = src->width;
int height = src->height;
int wm = width - margin;
int hm = height - margin;
int x, y, count;
if (width <= (margin * 2) || height <= (margin * 2))
return 0;
m_image_harris(&harris, src, radius);
m_image_non_max_supp(&nms, &harris, (int)(radius) + 1, threshold);
count = 0;
pixel = (float *)nms.data;
for (y = 0; y < height; y++)
for (x = 0; x < width; x++) {
if (count == max_count)
goto end;
if ((*pixel) > 0 && x >= margin && y >= margin && x < wm && y < hm) {
corners[count*2] = x;
corners[count*2+1] = y;
count++;
}
pixel++;
}
end:
m_image_destroy(&nms);
m_image_destroy(&harris);
return count;
}
MIAPI void m_image_sub_pixel(const struct m_image *src, float x, float y, float *result)
{
float *colors0, *colors1, *colors2, *colors3;
float *src_data = (float *)src->data;
int width = src->width;
int height = src->height;
int comp = src->comp;
int c;
float fx, fy;
int wm = width - 1;
int hm = height - 1;
int ix, iy, ix2, iy2;
ix = (int)x;
iy = (int)y;
fx = x - (float)ix;
fy = y - (float)iy;
fx = M_MAX(fx, 0);
fy = M_MAX(fy, 0);
ix = M_CLAMP(ix, 0, wm);
iy = M_CLAMP(iy, 0, hm);
ix2 = ix + 1;
iy2 = iy + 1;
ix2 = M_MIN(ix2, wm);
iy2 = M_MIN(iy2, hm);
colors0 = src_data + (width * iy + ix) * comp;
colors1 = src_data + (width * iy + ix2) * comp;
colors2 = src_data + (width * iy2 + ix) * comp;
colors3 = src_data + (width * iy2 + ix2) * comp;
for(c = 0; c < comp; c++) {
float A = colors0[c] + (colors2[c] - colors0[c]) * fy;
float B = colors1[c] + (colors3[c] - colors1[c]) * fy;
result[c] = A + (B - A) * fx;
}
}
/* slow TODO better */
static void m__bilinear(struct m_image *dest, const struct m_image *src, float dx, float dy, float offset)
{
float *dest_data = (float *)dest->data;
int width = dest->width;
int height = dest->height;
int comp = src->comp;
int y, ystep = width * comp;
#pragma omp parallel for schedule(dynamic, 8)
for (y = 0; y < height; y++) {
float *dest_pixel = dest_data + y * ystep; int x;
for (x = 0; x < width; x++) {
m_image_sub_pixel(src, ((float)x + 0.5f) * dx + offset, ((float)y + 0.5f) * dy + offset, dest_pixel);
dest_pixel += comp;
}
}
}
MIAPI void m_image_pyrdown(struct m_image *dest, const struct m_image *src)
{
struct m_image tmp = M_IMAGE_IDENTITY();
float *src_data;
float *dest_pixel;
int width = src->width;
int height = src->height;
int comp = src->comp;
int comp2 = comp * 2;
int ystep = width * comp * 2;
int w2 = width / 2;
int h2 = height / 2;
int x, y, i;
m_image_gaussian_blur(&tmp, src, 1.5f, 1.5f);
m_image_create(dest, M_FLOAT, w2, h2, comp);
src_data = (float *)tmp.data;
dest_pixel = (float *)dest->data;
for (y = 0; y < h2; y++) {
float *src_pixel = src_data + y * ystep;
for (x = 0; x < w2; x++) {
for (i = 0; i < comp; i++)
dest_pixel[i] = src_pixel[i];
dest_pixel += comp;
src_pixel += comp2;
}
}
m_image_destroy(&tmp);
}
MIAPI void m_image_resize(struct m_image *dest, const struct m_image *src, int new_width, int new_height)
{
struct m_image tmp = M_IMAGE_IDENTITY();
int width = src->width;
int height = src->height;
int comp = src->comp;
float rx = (float)width / (float)new_width;
float ry = (float)height / (float)new_height;
assert(src->size > 0 && src->type == M_FLOAT);
if (rx > 1.0f || ry > 1.0f) {
m_image_gaussian_blur(&tmp, src, M_MAX(0.0f, rx - 1.0f), M_MAX(0.0f, ry - 1.0f));
m_image_create(dest, M_FLOAT, new_width, new_height, comp);
m__bilinear(dest, &tmp, rx, ry, -0.5f);
}
else {
if (dest == src) {
m_image_copy(&tmp, src);
src = &tmp;
}
m_image_create(dest, M_FLOAT, new_width, new_height, comp);
m__bilinear(dest, src, rx, ry, -0.5f);
}
m_image_destroy(&tmp);
}
#endif /* M_IMAGE_IMPLEMENTATION */
================================================
FILE: include/m_math.h
================================================
/*======================================================================
Maratis Tiny C Library
version 1.0
------------------------------------------------------------------------
Copyright (c) 2015 Anael Seghezzi <www.maratis3d.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would
be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
========================================================================*/
/*
Math with C/OpenCL portability:
- vector manipulation
- interpolation (cubic, catmullrom)
- quaternion basics
- matrix (projection, transformation...)
- random number generator
- 2d routines
- 3d routines:
- voxeliser (tri-box overlap)
- raytracing (sphere, plane, box, triangle)
to create the implementation,
#define M_MATH_IMPLEMENTATION
in *one* C/CPP file that includes this file.
*/
#ifndef M_MATH_H
#define M_MATH_H
#define M_MATH_VERSION 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef MMAPI
#define MMAPI extern
#endif
/* basic math */
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#define M_DEG_TO_RAD 0.01745329251994329576
#define M_RAD_TO_DEG 57.29577951308232087679
#ifndef M_MIN
#define M_MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef M_MAX
#define M_MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef M_ABS
#define M_ABS(a) (((a) < 0) ? -(a) : (a))
#endif
#ifndef M_CLAMP
#define M_CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
#endif
#define M_ISPOWEROFTWO(x) (((x&(x - 1)) == 0) && (x != 0))
/* vector math */
typedef struct {float x, y, z;} float3; /* float3 (doesn't exist in opencl) */
/* opencl/c */
#ifdef __OPENCL_VERSION__
#define M_DOT2(A, B) dot((A).xy, (B).xy)
#define M_DOT3(A, B) dot((float4)((A).x, (A).y, (A).z, 0), (float4)((B).x, (B).y, (B).z, 0.0f))
#define M_DOT4(A, B) dot(A, B)
#define M_LENGHT2(src) length(src)
#define M_LENGHT3(src) length((float4)((src).x, (src).y, (src).z, 0.0f))
#define M_LENGHT4(src) length(src)
#define M_MIN2(dest, A, B) { (dest).xy = min(A.xy, B.xy); }
#define M_MIN3(dest, A, B) { (dest).x = M_MIN((A).x, (B).x); (dest).y = M_MIN((A).y, (B).y); (dest).z = M_MIN((A).z, (B).z); }
#define M_MIN4(dest, A, B) { (dest) = min(A, B); }
#define M_MAX2(dest, A, B) { (dest).xy = max(A.xy, B.xy); }
#define M_MAX3(dest, A, B) { (dest).x = M_MAX((A).x, (B).x); (dest).y = M_MAX((A).y, (B).y); (dest).z = M_MAX((A).z, (B).z); }
#define M_MAX4(dest, A, B) { (dest) = max(A, B); }
#define M_NORMALIZE2(dest, src) { (dest).xy = normalize((src).xy); }
#define M_NORMALIZE4(dest, src) { (dest) = normalize(src); }
#else
typedef struct {float x, y;} float2; /* float2 */
typedef struct {float x, y, z, w;} float4; /* float4 */
#define M_DOT2(A, B) ((A).x * (B).x + (A).y * (B).y)
#define M_DOT3(A, B) ((A).x * (B).x + (A).y * (B).y + (A).z * (B).z)
#define M_DOT4(A, B) ((A).x * (B).x + (A).y * (B).y + (A).z * (B).z + (A).w * (B).w)
#define M_LENGHT2(src) sqrtf((src).x * (src).x + (src).y * (src).y)
#define M_LENGHT3(src) sqrtf((src).x * (src).x + (src).y * (src).y + (src).z * (src).z)
#define M_LENGHT4(src) sqrtf((src).x * (src).x + (src).y * (src).y + (src).z * (src).z + (src).w * (src).w)
#define M_MIN2(dest, A, B) { (dest).x = M_MIN((A).x, (B).x); (dest).y = M_MIN((A).y, (B).y); }
#define M_MIN3(dest, A, B) { M_MIN2(dest, A, B); (dest).z = M_MIN((A).z, (B).z); }
#define M_MIN4(dest, A, B) { M_MIN3(dest, A, B); (dest).w = M_MIN((A).w, (B).w); }
#define M_MAX2(dest, A, B) { (dest).x = M_MAX((A).x, (B).x); (dest).y = M_MAX((A).y, (B).y); }
#define M_MAX3(dest, A, B) { M_MAX2(dest, A, B); (dest).z = M_MAX((A).z, (B).z); }
#define M_MAX4(dest, A, B) { M_MAX3(dest, A, B); (dest).w = M_MAX((A).w, (B).w); }
#define M_NORMALIZE2(dest, src){ float l = M_LENGHT2(src);\
if (l > 0) { l = 1.0f / l; (dest).x = (src).x * l; (dest).y = (src).y * l; }\
else { (dest).x = (dest).y = 0.0f; }}
#define M_NORMALIZE4(dest, src){ float l = M_LENGHT4(src);\
if (l > 0) { l = 1.0f / l; (dest).x = (src).x * l; (dest).y = (src).y * l; (dest).z = (src).z * l; (dest).w = (src).w * l; }\
else { (dest).x = (dest).y = (dest).z = (dest).w = 0.0f; }}
#endif
#define M_NORMALIZE3(dest, src){ float l = M_LENGHT3(src);\
if (l > 0) { l = 1.0f / l; (dest).x = (src).x * l; (dest).y = (src).y * l; (dest).z = (src).z * l; }\
else { (dest).x = (dest).y = (dest).z = 0.0f; }}
#define M_CROSS2(A, B) ((A).x * (B).y - (A).y * (B).x)
#define M_CROSS3(dest, A, B) { (dest).x = (A).y * (B).z - (A).z * (B).y; (dest).y = (A).z * (B).x - (A).x * (B).z; (dest).z = (A).x * (B).y - (A).y * (B).x; }
#define M_ADD2(dest, A, B) { (dest).x = (A).x + (B).x; (dest).y = (A).y + (B).y; }
#define M_ADD3(dest, A, B) { M_ADD2(dest, A, B) (dest).z = (A).z + (B).z; }
#define M_ADD4(dest, A, B) { M_ADD3(dest, A, B) (dest).w = (A).w + (B).w; }
#define M_SUB2(dest, A, B) { (dest).x = (A).x - (B).x; (dest).y = (A).y - (B).y; }
#define M_SUB3(dest, A, B) { M_SUB2(dest, A, B) (dest).z = (A).z - (B).z; }
#define M_SUB4(dest, A, B) { M_SUB3(dest, A, B) (dest).w = (A).w - (B).w; }
#define M_MUL2(dest, A, B) { (dest).x = (A).x * (B).x; (dest).y = (A).y * (B).y; }
#define M_MUL3(dest, A, B) { M_MUL2(dest, A, B) (dest).z = (A).z * (B).z; }
#define M_MUL4(dest, A, B) { M_MUL3(dest, A, B) (dest).w = (A).w * (B).w; }
#define M_DIV2(dest, A, B) { (dest).x = (A).x / (B).x; (dest).y = (A).y / (B).y; }
#define M_DIV3(dest, A, B) { M_DIV2(dest, A, B) (dest).z = (A).z / (B).z; }
#define M_DIV4(dest, A, B) { M_DIV3(dest, A, B) (dest).w = (A).w / (B).w; }
/* basic math */
MMAPI unsigned int m_next_power_of_two(unsigned int x);
/* rand (Marsaglia MWC generator) */
typedef struct {unsigned int z, w;} m_rand_desc;
#define M_RAND_DESC_DEFAULT() {362436069, 521288629}
MMAPI unsigned int m_rand_user(m_rand_desc *desc);
MMAPI float m_randf_user(m_rand_desc *desc);
MMAPI void m_srand(unsigned int z, unsigned int w);
MMAPI unsigned int m_rand(void);
MMAPI float m_randf(void);
/* interpolation */
MMAPI float m_interpolation_cubic(float y0, float y1, float y2, float y3, float mu);
MMAPI float m_interpolation_catmullrom(float y0, float y1, float y2, float y3, float mu);
/* quaternion, angles in radian */
#define M_QUAT_IDENTITY() {0.0f, 0.0f, 0.0f, 0.99999999f}
MMAPI void m_quat_identity(float4 *dest);
MMAPI void m_quat_normalize(float4 *dest, const float4 *src);
MMAPI void m_quat_rotation_axis(float4 *dest, const float3 *axis, float angle);
MMAPI void m_quat_rotation_euler(float4 *dest, const float3 *euler);
MMAPI void m_quat_mul(float4 *dest, const float4 *A, const float4 *B);
MMAPI void m_quat_slerp(float4 *dest, const float4 *A, const float4 *B, float mu);
MMAPI void m_quat_extract_axis_angle(float3 *axis, float *angle, const float4 *quat);
/* matrix 4x4 (float 16), angles in radian */
#define M_MAT4_IDENTITY() {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}
MMAPI void m_mat4_identity(float *dest);
MMAPI void m_mat4_perspective(float *dest, float fov, float ratio, float znear, float zfar);
MMAPI void m_mat4_ortho(float *dest, float left, float right, float bottom, float top, float znear, float zfar);
MMAPI void m_mat4_lookat(float *dest, const float3 *pos, const float3 *dir, const float3 *up);
MMAPI void m_mat4_translation(float *dest, const float3 *translation);
MMAPI void m_mat4_rotation_axis(float *dest, const float3 *axis, float angle);
MMAPI void m_mat4_rotation_euler(float *dest, const float3 *euler);
MMAPI void m_mat4_scale(float *dest, const float3 *scale);
MMAPI void m_mat4_mul(float *dest, const float *A, const float *B);
MMAPI void m_mat4_transpose(float *dest, const float *src);
MMAPI void m_mat4_inverse_transpose(float *dest, const float *src);
MMAPI void m_mat4_inverse(float *dest, const float *src);
MMAPI void m_mat4_extract_euler(float3 *dest, const float *matrix);
MMAPI void m_mat4_rotate3(float3 *dest, const float *matrix, const float3 *src);
MMAPI void m_mat4_inverse_rotate3(float3 *dest, const float *matrix, const float3 *src);
MMAPI void m_mat4_transform3(float3 *dest, const float *matrix, const float3 *src);
MMAPI void m_mat4_transform4(float4 *dest, const float *matrix, const float4 *src);
/* 2d */
MMAPI int m_2d_line_to_line_intersection(float2 *dest, float2 *p11, float2 *p12, float2 *p21, float2 *p22);
MMAPI int m_2d_box_to_box_collision(float2 *min1, float2 *max1, float2 *min2, float2 *max2);
MMAPI float m_2d_polygon_area(float2 *points, int count);
MMAPI float m_2d_polyline_length(float2 *points, int count);
/* 3d */
MMAPI int m_3d_box_to_box_collision(float3 *min1, float3 *max1, float3 *min2, float3 *max2);
MMAPI int m_3d_ray_box_intersection_in_out(float3 *ray_origin, float3 *ray_direction, float3 *box_min, float3 *box_max, float *in, float *out);
MMAPI int m_3d_ray_sphere_intersection_in_out(float3 *ray_origin, float3 *ray_direction, float3 *sphere_origin, float sphere_radius2, float *in, float *out);
MMAPI int m_3d_tri_box_overlap(float3 *box_center, float3 *box_half_size, float3 *vert1, float3 *vert2, float3 *vert3);
MMAPI float m_3d_polyline_length(float3 *points, int count);
MMAPI float m_3d_ray_plane_intersection(float3 *ray_origin, float3 *ray_direction, float3 *plane_origin, float3 *plane_normal);
MMAPI float m_3d_ray_sphere_intersection(float3 *ray_origin, float3 *ray_direction, float3 *sphere_origin, float sphere_radius2);
MMAPI float m_3d_ray_box_intersection(float3 *ray_origin, float3 *ray_direction, float3 *box_min, float3 *box_max);
MMAPI float m_3d_ray_triangle_intersection(float3 *ray_origin, float3 *ray_direction, float3 *vert1, float3 *vert2, float3 *vert3, float *u, float *v);
#ifdef __cplusplus
}
#endif
/*
----------------------------------------------------------------------*/
#endif /* M_MATH_H */
#ifdef M_MATH_IMPLEMENTATION
#ifndef __OPENCL_VERSION__
#include <math.h>
#endif
static m_rand_desc m__rand_global_desc = M_RAND_DESC_DEFAULT();
MMAPI unsigned int m_next_power_of_two(unsigned int x)
{
if (x == 0)
return 0;
x--;
x |= x >> 1;
x |= x >> 2;
x |= x >> 4;
x |= x >> 8;
x |= x >> 16;
x++;
return x;
}
MMAPI unsigned int m_rand_user(m_rand_desc *desc)
{
desc->z = 36969 * (desc->z & 65535) + (desc->z >> 16);
desc->w = 18000 * (desc->w & 65535) + (desc->w >> 16);
return (desc->z << 16) + desc->w;
}
MMAPI float m_randf_user(m_rand_desc *desc)
{
unsigned int u = m_rand_user(desc);
return (u + 1.0) * 2.328306435454494e-10;
}
MMAPI void m_srand(unsigned int z, unsigned int w)
{
m__rand_global_desc.z = z;
m__rand_global_desc.w = w;
}
MMAPI unsigned int m_rand(void)
{
return m_rand_user(&m__rand_global_desc);
}
MMAPI float m_randf(void)
{
return m_randf_user(&m__rand_global_desc);
}
MMAPI float m_interpolation_cubic(float y0, float y1, float y2, float y3, float mu)
{
float a0, a1, a2, a3, mu2;
mu2 = mu * mu;
a0 = y3 - y2 - y0 + y1;
a1 = y0 - y1 - a0;
a2 = y2 - y0;
a3 = y1;
return (a0 * mu * mu2 + a1 * mu2 + a2 * mu + a3);
}
MMAPI float m_interpolation_catmullrom(float y0, float y1, float y2, float y3, float mu)
{
float a0, a1, a2, a3, mu2;
mu2 = mu * mu;
a0 = -0.5f * y0 + 1.5f * y1 - 1.5f * y2 + 0.5f * y3;
a1 = y0 - 2.5f * y1 + 2.0f * y2 - 0.5f * y3;
a2 = -0.5f * y0 + 0.5f * y2;
a3 = y1;
return (a0 * mu * mu2 + a1 * mu2 + a2 * mu + a3);
}
MMAPI void m_quat_identity(float4 *dest)
{
static float4 ident = M_QUAT_IDENTITY();
dest->x = ident.x;
dest->y = ident.y;
dest->z = ident.z;
dest->w = ident.w;
}
MMAPI void m_quat_normalize(float4 *dest, const float4 *src)
{
float l = M_LENGHT4(*src);
if (l > 0.00000001f) {
float m = 1.0f / l;
dest->x = src->x * m;
dest->y = src->y * m;
dest->z = src->z * m;
dest->w = src->w * m;
}
else {
m_quat_identity(dest);
}
}
MMAPI void m_quat_rotation_axis(float4 *dest, const float3 *axis, float angle)
{
float ha = angle * 0.5f;
float sina = sinf(ha);
float cosa = cosf(ha);
dest->x = sina * axis->x;
dest->y = sina * axis->y;
dest->z = sina * axis->z;
dest->w = cosa;
m_quat_normalize(dest, dest);
}
MMAPI void m_quat_rotation_euler(float4 *dest, const float3 *euler)
{
float ti = euler->x * 0.5f;
float tj = euler->y * 0.5f;
float th = euler->z * 0.5f;
float ci = cosf(ti);
float cj = cosf(tj);
float ch = cosf(th);
float si = sinf(ti);
float sj = sinf(tj);
float sh = sinf(th);
float cc = ci*ch;
float cs = ci*sh;
float sc = si*ch;
float ss = si*sh;
dest->x = cj*sc - sj*cs;
dest->y = cj*ss + sj*cc;
dest->z = cj*cs - sj*sc;
dest->w = cj*cc + sj*ss;
}
MMAPI void m_quat_mul(float4 *dest, const float4 *A, const float4 *B)
{
dest->x = (B->w * A->x) + (B->x * A->w) + (B->y * A->z) - (B->z * A->y);
dest->y = (B->w * A->y) + (B->y * A->w) + (B->z * A->x) - (B->x * A->z);
dest->z = (B->w * A->z) + (B->z * A->w) + (B->x * A->y) - (B->y * A->x);
dest->w = (B->w * A->w) - (B->x * A->x) - (B->y * A->y) - (B->z * A->z);
}
MMAPI void m_quat_slerp(float4 *dest, const float4 *A, const float4 *B, float mu)
{
float4 C;
float dot = A->x * B->x + A->y * B->y + A->z * B->z + A->w * B->w;
if (dot < 0) {
dot = -dot;
C.x = -B->x;
C.y = -B->y;
C.z = -B->z;
C.w = -B->w;
}
else {
C.x = B->x;
C.y = B->y;
C.z = B->z;
C.w = B->w;
}
if (dot < 0.95f) {
float a = acosf(dot);
float f1 = sinf(a * (1.0f - mu));
float f2 = sinf(a * mu);
float f3 = sinf(a);
dest->x = (A->x * f1 + C.x * f2) / f3;
dest->y = (A->y * f1 + C.y * f2) / f3;
dest->z = (A->z * f1 + C.z * f2) / f3;
dest->w = (A->w * f1 + C.w * f2) / f3;
}
/* linear interpolation */
else {
float imu = 1.0f - mu;
dest->x = A->x * imu + C.x * mu;
dest->y = A->y * imu + C.y * mu;
dest->z = A->z * imu + C.z * mu;
dest->w = A->w * imu + C.w * mu;
m_quat_normalize(dest, dest);
}
}
MMAPI void m_quat_extract_axis_angle(float3 *axis, float *angle, const float4 *quat)
{
float a, s;
float v = M_CLAMP(quat->w, -1.0f, 1.0f);
a = acosf(v);
s = sinf(a);
if (s != 0) {
float m = 1.0f / s;
axis->x = quat->x * m;
axis->y = quat->y * m;
axis->z = quat->z * m;
}
else {
axis->x = 0.0f;
axis->y = 1.0f;
axis->z = 0.0f;
}
*angle = a * 2.0f;
}
MMAPI void m_mat4_identity(float *dest)
{
static float ident[16] = M_MAT4_IDENTITY(); int i;
for (i = 0; i < 16; i++)
dest[i] = ident[i];
}
MMAPI void m_mat4_perspective(float *dest, float fov, float ratio, float znear, float zfar)
{
float ymax, xmax;
float left, right, bottom, top;
float temp, temp2, temp3, temp4;
ymax = znear * tanf(fov);
xmax = ymax * ratio;
left = -xmax;
right = xmax;
bottom = -ymax;
top = ymax;
temp = 2.0f * znear;
temp2 = right - left;
temp3 = top - bottom;
temp4 = zfar - znear;
dest[0] = temp / temp2;
dest[1] = 0.0f;
dest[2] = 0.0f;
dest[3] = 0.0f;
dest[4] = 0.0f;
dest[5] = temp / temp3;
dest[6] = 0.0f;
dest[7] = 0.0f;
dest[8] = (right + left) / temp2;
dest[9] = (top + bottom) / temp3;
dest[10] = (-zfar - znear) / temp4;
dest[11] = -1.0f;
dest[12] = 0.0f;
dest[13] = 0.0f;
dest[14] = (-temp * zfar) / temp4;
dest[15] = 0.0f;
}
MMAPI void m_mat4_ortho(float *dest, float left, float right, float bottom, float top, float znear, float zfar)
{
if (right == left || top == bottom || zfar == znear) // invalid
return;
dest[0] = 2.0f / (right-left);
dest[1] = 0.0f;
dest[2] = 0.0f;
dest[3] = 0.0f;
dest[4] = 0.0f;
dest[5] = 2.0f / (top-bottom);
dest[6] = 0.0f;
dest[7] = 0.0f;
dest[8] = 0.0f;
dest[9] = 0.0f;
dest[10] = -2.0f / (zfar-znear);
dest[11] = 0.0f;
dest[12] = -(right + left) / (right - left);
dest[13] = -(top + bottom) / (top - bottom);
dest[14] = -(zfar + znear) / (zfar - znear);
dest[15] = 1.0f;
}
MMAPI void m_mat4_lookat(float *dest, const float3 *pos, const float3 *dir, const float3 *up)
{
float3 lftn, upn, dirn;
M_CROSS3(lftn, *dir, *up);
M_CROSS3(upn, lftn, *dir);
M_NORMALIZE3(lftn, lftn);
M_NORMALIZE3(upn, upn);
M_NORMALIZE3(dirn, *dir);
dest[0] = lftn.x;
dest[1] = upn.x;
dest[2] = -dirn.x;
dest[3] = 0.0f;
dest[4] = lftn.y;
dest[5] = upn.y;
dest[6] = -dirn.y;
dest[7] = 0.0f;
dest[8] = lftn.z;
dest[9] = upn.z;
dest[10] = -dirn.z;
dest[11] = 0.0f;
dest[12] = -M_DOT3(lftn, *pos);
dest[13] = -M_DOT3(upn, *pos);
dest[14] = M_DOT3(dirn, *pos);
dest[15] = 1.0f;
}
MMAPI void m_mat4_translation(float *dest, const float3 *translation)
{
dest[12] = translation->x;
dest[13] = translation->y;
dest[14] = translation->z;
}
MMAPI void m_mat4_rotation_axis(float *dest, const float3 *axis, float angle)
{
float sina = sinf(angle);
float cosa = cosf(angle);
float icosa = 1.0f - cosa;
dest[0] = axis->x * axis->x + cosa * (1.0f - axis->x * axis->x);
dest[1] = axis->x * axis->y * icosa + sina * axis->z;
dest[2] = axis->x * axis->z * icosa - sina * axis->y;
dest[4] = axis->x * axis->y * icosa - sina * axis->z;
dest[5] = axis->y * axis->y + cosa * (1.0f - axis->y * axis->y);
dest[6] = axis->y * axis->z * icosa + sina * axis->x;
dest[8] = axis->x * axis->z * icosa + sina * axis->y;
dest[9] = axis->y * axis->z * icosa - sina * axis->x;
dest[10] = axis->z * axis->z + cosa * (1.0f - axis->z * axis->z);
}
MMAPI void m_mat4_rotation_euler(float *dest, const float3 *euler)
{
float cr = cosf(euler->x);
float sr = sinf(euler->x);
float cp = cosf(euler->y);
float sp = sinf(euler->y);
float cy = cosf(euler->z);
float sy = sinf(euler->z);
float srsp = sr * sp;
float crsp = cr * sp;
dest[0] = cp * cy;
dest[1] = cp * sy;
dest[2] = -sp;
dest[4] = srsp * cy - cr * sy;
dest[5] = srsp * sy + cr * cy;
dest[6] = sr * cp;
dest[8] = crsp * cy + sr * sy;
dest[9] = crsp * sy - sr * cy;
dest[10]= cr * cp;
}
MMAPI void m_mat4_scale(float *dest, const float3 *scale)
{
dest[0] = scale->x;
dest[5] = scale->y;
dest[10] = scale->z;
}
MMAPI void m_mat4_mul(float *dest, const float *A, const float *B)
{
dest[0] = A[0] * B[0] + A[4] * B[1] + A[8] * B[2] + A[12] * B[3];
dest[1] = A[1] * B[0] + A[5] * B[1] + A[9] * B[2] + A[13] * B[3];
dest[2] = A[2] * B[0] + A[6] * B[1] + A[10] * B[2] + A[14] * B[3];
dest[3] = A[3] * B[0] + A[7] * B[1] + A[11] * B[2] + A[15] * B[3];
dest[4] = A[0] * B[4] + A[4] * B[5] + A[8] * B[6] + A[12] * B[7];
dest[5] = A[1] * B[4] + A[5] * B[5] + A[9] * B[6] + A[13] * B[7];
dest[6] = A[2] * B[4] + A[6] * B[5] + A[10] * B[6] + A[14] * B[7];
dest[7] = A[3] * B[4] + A[7] * B[5] + A[11] * B[6] + A[15] * B[7];
dest[8] = A[0] * B[8] + A[4] * B[9] + A[8] * B[10] + A[12] * B[11];
dest[9] = A[1] * B[8] + A[5] * B[9] + A[9] * B[10] + A[13] * B[11];
dest[10] = A[2] * B[8] + A[6] * B[9] + A[10] * B[10] + A[14] * B[11];
dest[11] = A[3] * B[8] + A[7] * B[9] + A[11] * B[10] + A[15] * B[11];
dest[12] = A[0] * B[12] + A[4] * B[13] + A[8] * B[14] + A[12] * B[15];
dest[13] = A[1] * B[12] + A[5] * B[13] + A[9] * B[14] + A[13] * B[15];
dest[14] = A[2] * B[12] + A[6] * B[13] + A[10] * B[14] + A[14] * B[15];
dest[15] = A[3] * B[12] + A[7] * B[13] + A[11] * B[14] + A[15] * B[15];
}
MMAPI void m_mat4_transpose(float *dest, const float *src)
{
dest[0] = src[0]; dest[1] = src[4]; dest[2] = src[8]; dest[3] = src[12];
dest[4] = src[1]; dest[5] = src[5]; dest[6] = src[9]; dest[7] = src[13];
dest[8] = src[2]; dest[9] = src[6]; dest[10] = src[10]; dest[11] = src[14];
dest[12] = src[3]; dest[13] = src[7]; dest[14] = src[11]; dest[15] = src[15];
}
MMAPI void m_mat4_inverse_transpose(float *dest, const float *src)
{
float tmp[12];
float det;
// calculate pairs for first 8 elements (cofactors)
tmp[0] = src[10] * src[15];
tmp[1] = src[11] * src[14];
tmp[2] = src[9] * src[15];
tmp[3] = src[11] * src[13];
tmp[4] = src[9] * src[14];
tmp[5] = src[10] * src[13];
tmp[6] = src[8] * src[15];
tmp[7] = src[11] * src[12];
tmp[8] = src[8] * src[14];
tmp[9] = src[10] * src[12];
tmp[10] = src[8] * src[13];
tmp[11] = src[9] * src[12];
// calculate first 8 elements (cofactors)
dest[0] = tmp[0]*src[5] + tmp[3]*src[6] + tmp[4]*src[7]
- tmp[1]*src[5] - tmp[2]*src[6] - tmp[5]*src[7];
dest[1] = tmp[1]*src[4] + tmp[6]*src[6] + tmp[9]*src[7]
-tmp[0]*src[4] - tmp[7]*src[6] - tmp[8]*src[7];
dest[2] = tmp[2]*src[4] + tmp[7]*src[5] + tmp[10]*src[7]
-tmp[3]*src[4] - tmp[6]*src[5] - tmp[11]*src[7];
dest[3] = tmp[5]*src[4] + tmp[8]*src[5] + tmp[11]*src[6]
-tmp[4]*src[4] - tmp[9]*src[5] - tmp[10]*src[6];
dest[4] = tmp[1]*src[1] + tmp[2]*src[2] + tmp[5]*src[3]
-tmp[0]*src[1] - tmp[3]*src[2] - tmp[4]*src[3];
dest[5] = tmp[0]*src[0] + tmp[7]*src[2] + tmp[8]*src[3]
-tmp[1]*src[0] - tmp[6]*src[2] - tmp[9]*src[3];
dest[6] = tmp[3]*src[0] + tmp[6]*src[1] + tmp[11]*src[3]
-tmp[2]*src[0] - tmp[7]*src[1] - tmp[10]*src[3];
dest[7] = tmp[4]*src[0] + tmp[9]*src[1] + tmp[10]*src[2]
-tmp[5]*src[0] - tmp[8]*src[1] - tmp[11]*src[2];
// calculate pairs for second 8 elements (cofactors)
tmp[0] = src[2] * src[7];
tmp[1] = src[3] * src[6];
tmp[2] = src[1] * src[7];
tmp[3] = src[3] * src[5];
tmp[4] = src[1] * src[6];
tmp[5] = src[2] * src[5];
tmp[6] = src[0] * src[7];
tmp[7] = src[3] * src[4];
tmp[8] = src[0] * src[6];
tmp[9] = src[2] * src[4];
tmp[10] = src[0] * src[5];
tmp[11] = src[1] * src[4];
// calculate second 8 elements (cofactors)
dest[8] = tmp[0]*src[13] + tmp[3]*src[14] + tmp[4]*src[15]
-tmp[1]*src[13] - tmp[2]*src[14] - tmp[5]*src[15];
dest[9] = tmp[1]*src[12] + tmp[6]*src[14] + tmp[9]*src[15]
-tmp[0]*src[12] - tmp[7]*src[14] - tmp[8]*src[15];
dest[10] = tmp[2]*src[12] + tmp[7]*src[13] + tmp[10]*src[15]
-tmp[3]*src[12] - tmp[6]*src[13] - tmp[11]*src[15];
dest[11] = tmp[5]*src[12] + tmp[8]*src[13] + tmp[11]*src[14]
-tmp[4]*src[12] - tmp[9]*src[13] - tmp[10]*src[14];
dest[12] = tmp[2]*src[10] + tmp[5]*src[11] + tmp[1]*src[9]
-tmp[4]*src[11] - tmp[0]*src[9] - tmp[3]*src[10];
dest[13] = tmp[8]*src[11] + tmp[0]*src[8] + tmp[7]*src[10]
-tmp[6]*src[10] - tmp[9]*src[11] - tmp[1]*src[8];
dest[14] = tmp[6]*src[9] + tmp[11]*src[11] + tmp[3]*src[8]
-tmp[10]*src[11] - tmp[2]*src[8] - tmp[7]*src[9];
dest[15] = tmp[10]*src[10] + tmp[4]*src[8] + tmp[9]*src[9]
-tmp[8]*src[9] - tmp[11]*src[10] - tmp[5]*src[8];
// calculate determinant
det = src[0] * dest[0]
+ src[1] * dest[1]
+ src[2] * dest[2]
+ src[3] * dest[3];
if (det == 0.0f) {
m_mat4_identity(dest);
}
else {
float m = 1.0f / det; int i;
for (i = 0; i < 16; i++)
dest[i] *= m;
}
}
MMAPI void m_mat4_inverse(float *dest, const float *src)
{
float tmp[16];
m_mat4_inverse_transpose(tmp, src);
m_mat4_transpose(dest, tmp);
}
MMAPI void m_mat4_extract_euler(float3 *dest, const float *matrix)
{
float cy = sqrtf(matrix[0] * matrix[0] + matrix[1] * matrix[1]);
if (cy > (16.0 * 1.192092896e-07F)) {
float3 euler1;
float3 euler2;
euler1.x = atan2f( matrix[6], matrix[10]);
euler1.y = atan2f(-matrix[2], cy);
euler1.z = atan2f( matrix[1], matrix[0]);
euler2.x = atan2f(-matrix[6], -matrix[10]);
euler2.y = atan2f(-matrix[2], -cy);
euler2.z = atan2f(-matrix[1], -matrix[0]);
if ((M_ABS(euler1.x) + M_ABS(euler1.y) + M_ABS(euler1.z)) >
(M_ABS(euler2.x) + M_ABS(euler2.y) + M_ABS(euler2.z)))
{
dest->x = euler2.x;
dest->y = euler2.y;
dest->z = euler2.z;
}
else
{
dest->x = euler1.x;
dest->y = euler1.y;
dest->z = euler1.z;
}
}
else {
dest->x = atan2f(-matrix[9], matrix[5]);
dest->y = atan2f(-matrix[2], cy);
dest->z = 0.0f;
}
}
MMAPI void m_mat4_rotate3(float3 *dest, const float *matrix, const float3 *src)
{
dest->x = matrix[0] * src->x + matrix[4] * src->y + matrix[8] * src->z;
dest->y = matrix[1] * src->x + matrix[5] * src->y + matrix[9] * src->z;
dest->z = matrix[2] * src->x + matrix[6] * src->y + matrix[10] * src->z;
}
MMAPI void m_mat4_inverse_rotate3(float3 *dest, const float *matrix, const float3 *src)
{
dest->x = matrix[0] * src->x + matrix[1] * src->y + matrix[2] * src->z;
dest->y = matrix[4] * src->x + matrix[5] * src->y + matrix[6] * src->z;
dest->z = matrix[8] * src->x + matrix[9] * src->y + matrix[10] * src->z;
}
MMAPI void m_mat4_transform3(float3 *dest, const float *matrix, const float3 *src)
{
dest->x = matrix[0] * src->x + matrix[4] * src->y + matrix[8] * src->z + matrix[12];
dest->y = matrix[1] * src->x + matrix[5] * src->y + matrix[9] * src->z + matrix[13];
dest->z = matrix[2] * src->x + matrix[6] * src->y + matrix[10] * src->z + matrix[14];
}
MMAPI void m_mat4_transform4(float4 *dest, const float *matrix, const float4 *src)
{
dest->x = matrix[0] * src->x + matrix[4] * src->y + matrix[8] * src->z + matrix[12] * src->w;
dest->y = matrix[1] * src->x + matrix[5] * src->y + matrix[9] * src->z + matrix[13] * src->w;
dest->z = matrix[2] * src->x + matrix[6] * src->y + matrix[10] * src->z + matrix[14] * src->w;
dest->w = matrix[3] * src->x + matrix[7] * src->y + matrix[11] * src->z + matrix[15] * src->w;
}
MMAPI float m_2d_polygon_area(float2 *points, int count)
{
float fx, fy, a; int p;
if (count < 3)
return 0;
fx = points[count - 1].x * points[0].y;
fy = points[count - 1].y * points[0].x;
for (p = 1; p < count; p++) {
fx += points[p - 1].x * points[p].y;
fy += points[p - 1].y * points[p].x;
}
a = (fx - fy) * 0.5f;
return M_ABS(a);
}
MMAPI float m_2d_polyline_length(float2 *points, int count)
{
float l = 0; int p;
for (p = 1; p < count; p++) {
float2 v; M_SUB2(v, points[p], points[p - 1]);
l += M_LENGHT2(v);
}
return l;
}
MMAPI int m_2d_line_to_line_intersection(float2 *dest, float2 *p11, float2 *p12, float2 *p21, float2 *p22)
{
float2 DP, QA, QB;
float d, la, lb;
DP.x = p21->x - p11->x ; DP.y = p21->y - p11->y;
QA.x = p12->x - p11->x ; QA.y = p12->y - p11->y;
QB.x = p22->x - p21->x ; QB.y = p22->y - p21->y;
d = QA.y * QB.x - QB.y * QA.x;
if (d == 0)
return 0;
la = (QB.x * DP.y - QB.y * DP.x) / d;
if (la < 0 || la > 1)
return 0;
lb = (QA.x * DP.y - QA.y * DP.x) / d;
if (lb < 0 || lb > 1)
return 0;
dest->x = p11->x + la * QA.x;
dest->y = p11->y + la * QA.y;
return 1;
}
MMAPI int m_2d_box_to_box_collision(float2 *min1, float2 *max1, float2 *min2, float2 *max2)
{
return !(
(min1->x > max2->x) || (max1->x < min2->x) ||
(min1->y > max2->y) || (max1->y < min2->y));
}
MMAPI float m_3d_polyline_length(float3 *points, int count)
{
float l = 0; int p;
for (p = 1; p < count; p++) {
float3 v; M_ADD3(v, points[p], points[p - 1]);
l += M_LENGHT3(v);
}
return l;
}
MMAPI int m_3d_box_to_box_collision(float3 *min1, float3 *max1, float3 *min2, float3 *max2)
{
return !(
(min1->x > max2->x) || (max1->x < min2->x) ||
(min1->y > max2->y) || (max1->y < min2->y) ||
(min1->z > max2->z) || (max1->z < min2->z));
}
MMAPI int m_3d_ray_box_intersection_in_out(float3 *ray_origin, float3 *ray_direction, float3 *box_min, float3 *box_max, float *in, float *out)
{
float3 idir;
float3 tmin, tmax;
float3 tnear, tfar;
float tnx, tny, tfy;
float in0, out0;
idir.x = 1.0f / ray_direction->x;
idir.y = 1.0f / ray_direction->y;
idir.z = 1.0f / ray_direction->z;
tmin.x = (box_min->x - ray_origin->x) * idir.x;
tmin.y = (box_min->y - ray_origin->y) * idir.y;
tmin.z = (box_min->z - ray_origin->z) * idir.z;
tmax.x = (box_max->x - ray_origin->x) * idir.x;
tmax.y = (box_max->y - ray_origin->y) * idir.y;
tmax.z = (box_max->z - ray_origin->z) * idir.z;
M_MIN3(tnear, tmin, tmax);
M_MAX3(tfar, tmin, tmax);
tnx = M_MAX(tnear.x, 0.0f);
tny = M_MAX(tnear.y, tnear.z);
tfy = M_MIN(tfar.y, tfar.z);
in0 = M_MAX(tnx, tny);
out0 = M_MIN(tfar.x, tfy);
if (out0 > 0.0f && in0 < out0) {
*in = in0;
*out = out0;
return 1;
}
return 0;
}
MMAPI int m_3d_ray_sphere_intersection_in_out(float3 *ray_origin, float3 *ray_direction, float3 *sphere_origin, float sphere_radius2, float *in, float *out)
{
float3 vec;
float b, det;
M_SUB3(vec, *sphere_origin, *ray_origin);
b = M_DOT3(vec, *ray_direction);
det = b * b - M_DOT3(vec, vec) + sphere_radius2;
if (det < 0) return 0;
else det = sqrtf(det);
*in = b - det;
*out = b + det;
return 1;
}
MMAPI float m_3d_ray_plane_intersection(float3 *ray_origin, float3 *ray_direction, float3 *plane_origin, float3 *plane_normal)
{
float constant = -M_DOT3(*plane_normal, *plane_origin);
float normal_dot = M_DOT3(*plane_normal, *ray_direction);
float plane_dist = M_DOT3(*plane_normal, *ray_origin) + constant;
return -plane_dist / normal_dot;
}
MMAPI float m_3d_ray_sphere_intersection(float3 *ray_origin, float3 *ray_direction, float3 *sphere_origin, float sphere_radius2)
{
float3 vec;
float b, det;
M_SUB3(vec, *sphere_origin, *ray_origin);
b = M_DOT3(vec, *ray_direction);
det = b * b - M_DOT3(vec, vec) + sphere_radius2;
if (det < 0) return 0;
else det = sqrtf(det);
return b - det;
}
/* Ray-box intersection using IEEE numerical properties to ensure that the
test is both robust and efficient, as described in:
Amy Williams, Steve Barrus, R. Keith Morley, and Peter Shirley
"An Efficient and Robust Ray-Box Intersection Algorithm"
Journal of graphics tools, 10(1):49-54, 2005
*/
MMAPI float m_3d_ray_box_intersection(float3 *ray_origin, float3 *ray_direction, float3 *box_min, float3 *box_max)
{
float tmin, tmax, tymin, tymax, tzmin, tzmax;
float3 parameters[2];
float3 inv_direction = {
1 / ray_direction->x,
1 / ray_direction->y,
1 / ray_direction->z
};
int sign[3];
parameters[0] = *box_min;
parameters[1] = *box_max;
sign[0] = (inv_direction.x < 0);
sign[1] = (inv_direction.y < 0);
sign[2] = (inv_direction.z < 0);
tmin = (parameters[sign[0]].x - ray_origin->x) * inv_direction.x;
tymin = (parameters[sign[1]].y - ray_origin->y) * inv_direction.y;
tmax = (parameters[1 - sign[0]].x - ray_origin->x) * inv_direction.x;
tymax = (parameters[1 - sign[1]].y - ray_origin->y) * inv_direction.y;
if ((tmin > tymax) || (tymin > tmax))
return 0;
if (tymin > tmin) tmin = tymin;
if (tymax < tmax) tmax = tymax;
tzmin = (parameters[sign[2]].z - ray_origin->z) * inv_direction.z;
tzmax = (parameters[1 - sign[2]].z - ray_origin->z) * inv_direction.z;
if ((tmin > tzmax) || (tzmin > tmax))
return 0;
if (tzmin > tmin) tmin = tzmin;
if (tzmax < tmax) tmax = tzmax;
return tmin;
}
MMAPI float m_3d_ray_triangle_intersection(float3 *ray_origin, float3 *ray_direction, float3 *vert1, float3 *vert2, float3 *vert3, float *u, float *v)
{
float3 edge1, edge2;
float3 pvec, tvec, qvec;
float det, inv_det;
M_SUB3(edge1, *vert2, *vert1);
M_SUB3(edge2, *vert3, *vert1);
M_CROSS3(pvec, *ray_direction, edge2);
det = M_DOT3(edge1, pvec);
if (det == 0)
return 0;
inv_det = 1.0f / det;
M_SUB3(tvec, *ray_origin, *vert1);
/* u parameter */
*u = M_DOT3(tvec, pvec) * inv_det;
if (*u < 0.0f || *u > 1.0f)
return 0;
M_CROSS3(qvec, tvec, edge1);
/* v parameter */
*v = M_DOT3(*ray_direction, qvec) * inv_det;
/* inverted comparison (to catch NaNs) */
if (*v >= 0.0f && ((*u) + (*v)) <= 1.0f)
return M_DOT3(edge2, qvec) * inv_det;
return 0;
}
/********************************************************/
/* AABB-triangle overlap test code */
/* by Tomas Akenine-Mller */
/* Function: int triBoxOverlap(float boxcenter[3], */
/* float boxhalfsize[3],float triverts[3][3]); */
/* History: */
/* 2001-03-05: released the code in its first version */
/* 2001-06-18: changed the order of the tests, faster */
/* */
/* Acknowledgement: Many thanks to Pierre Terdiman for */
/* suggestions and discussions on how to optimize code. */
/* Thanks to David Hunt for finding a ">="-bug! */
/********************************************************/
#ifndef M_FIND_MIN_MAX_3
#define M_FIND_MIN_MAX_3(x0, x1, x2, min, max)\
min = max = x0;\
if (x1 < min) min=x1;\
if (x1 > max) max=x1;\
if (x2 < min) min=x2;\
if (x2 > max) max=x2;
#endif
static int m__plane_box_overlap(float3 *normal, float3 *vert, float3 *maxbox)
{
float3 vmin, vmax;
if (normal->x > 0.0f) { vmin.x = -maxbox->x - vert->x; vmax.x = maxbox->x - vert->x; }
else { vmin.x = maxbox->x - vert->x; vmax.x = -maxbox->x - vert->x; }
if (normal->y > 0.0f) { vmin.y = -maxbox->y - vert->y; vmax.y = maxbox->y - vert->y; }
else { vmin.y = maxbox->y - vert->y; vmax.y = -maxbox->y - vert->y; }
if (normal->z > 0.0f) { vmin.z = -maxbox->z - vert->z; vmax.z = maxbox->z - vert->z; }
else { vmin.z = maxbox->z - vert->z; vmax.z = -maxbox->z - vert->z; }
if (M_DOT3(*normal, vmin) > 0.0f) return 0;
if (M_DOT3(*normal, vmax) >= 0.0f) return 1;
return 0;
}
/*======================== X-tests ========================*/
#define M_AXISTEST_X01(a, b, fa, fb)\
p0 = a*v0.y - b*v0.z;\
p2 = a*v2.y - b*v2.z;\
if(p0<p2) {min=p0; max=p2;} else {min=p2; max=p0;}\
rad = fa * boxhalfsize->y + fb * boxhalfsize->z;\
if(min>rad || max<-rad) return 0;
#define M_AXISTEST_X2(a, b, fa, fb)\
p0 = a*v0.y - b*v0.z;\
p1 = a*v1.y - b*v1.z;\
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;}\
rad = fa * boxhalfsize->y + fb * boxhalfsize->z;\
if(min>rad || max<-rad) return 0;
/*======================== Y-tests ========================*/
#define M_AXISTEST_Y02(a, b, fa, fb)\
p0 = -a*v0.x + b*v0.z;\
p2 = -a*v2.x + b*v2.z;\
if(p0<p2) {min=p0; max=p2;} else {min=p2; max=p0;}\
rad = fa * boxhalfsize->x + fb * boxhalfsize->z;\
if(min>rad || max<-rad) return 0;
#define M_AXISTEST_Y1(a, b, fa, fb)\
p0 = -a*v0.x + b*v0.z;\
p1 = -a*v1.x + b*v1.z;\
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;}\
rad = fa * boxhalfsize->x + fb * boxhalfsize->z;\
if(min>rad || max<-rad) return 0;
/*======================== Z-tests ========================*/
#define M_AXISTEST_Z12(a, b, fa, fb)\
p1 = a*v1.x - b*v1.y;\
p2 = a*v2.x - b*v2.y;\
if(p2<p1) {min=p2; max=p1;} else {min=p1; max=p2;}\
rad = fa * boxhalfsize->x + fb * boxhalfsize->y;\
if(min>rad || max<-rad) return 0;
#define M_AXISTEST_Z0(a, b, fa, fb)\
p0 = a*v0.x - b*v0.y;\
p1 = a*v1.x - b*v1.y;\
if(p0<p1) {min=p0; max=p1;} else {min=p1; max=p0;}\
rad = fa * boxhalfsize->x + fb * boxhalfsize->y;\
if(min>rad || max<-rad) return 0;
MMAPI int m_3d_tri_box_overlap(float3 *boxcenter, float3 *boxhalfsize, float3 *vert1, float3 *vert2, float3 *vert3)
{
/* use separating axis theorem to test overlap between triangle and box */
/* need to test for overlap in these directions: */
/* 1) the {x,y,z}-directions (actually, since we use the AABB of the triangle */
/* we do not even need to test these) */
/* 2) normal of the triangle */
/* 3) crossproduct(edge from tri, {x,y,z}-directin) */
/* this gives 3x3=9 more tests */
float3 v0, v1, v2;
float3 normal, e0, e1, e2;
float min, max, p0, p1, p2, rad, fex, fey, fez;
/* This is the fastest branch on Sun */
/* move everything so that the boxcenter is in (0,0,0) */
M_SUB3(v0, *vert1, *boxcenter);
M_SUB3(v1, *vert2, *boxcenter);
M_SUB3(v2, *vert3, *boxcenter);
/* compute triangle edges */
M_SUB3(e0, v1, v0); /* tri edge 0 */
M_SUB3(e1, v2, v1); /* tri edge 1 */
M_SUB3(e2, v0, v2); /* tri edge 2 */
/* Bullet 3: */
/* test the 9 tests first (this was faster) */
fex = M_ABS(e0.x);
fey = M_ABS(e0.y);
fez = M_ABS(e0.z);
M_AXISTEST_X01(e0.z, e0.y, fez, fey);
M_AXISTEST_Y02(e0.z, e0.x, fez, fex);
M_AXISTEST_Z12(e0.y, e0.x, fey, fex);
fex = M_ABS(e1.x);
fey = M_ABS(e1.y);
fez = M_ABS(e1.z);
M_AXISTEST_X01(e1.z, e1.y, fez, fey);
M_AXISTEST_Y02(e1.z, e1.x, fez, fex);
M_AXISTEST_Z0(e1.y, e1.x, fey, fex);
fex = M_ABS(e2.x);
fey = M_ABS(e2.y);
fez = M_ABS(e2.z);
M_AXISTEST_X2(e2.z, e2.y, fez, fey);
M_AXISTEST_Y1(e2.z, e2.x, fez, fex);
M_AXISTEST_Z12(e2.y, e2.x, fey, fex);
/* Bullet 1: */
/* first test overlap in the {x,y,z}-directions */
/* find min, max of the triangle each direction, and test for overlap in */
/* that direction -- this is equivalent to testing a minimal AABB around */
/* the triangle against the AABB */
/* test in X-direction */
M_FIND_MIN_MAX_3(v0.x, v1.x, v2.x, min, max);
if (min > boxhalfsize->x || max < -boxhalfsize->x) return 0;
/* test in Y-direction */
M_FIND_MIN_MAX_3(v0.y, v1.y, v2.y, min, max);
if (min > boxhalfsize->y || max < -boxhalfsize->y) return 0;
/* test in Z-direction */
M_FIND_MIN_MAX_3(v0.z, v1.z, v2.z, min, max);
if (min > boxhalfsize->z || max < -boxhalfsize->z) return 0;
/* Bullet 2: */
/* test if the box intersects the plane of the triangle */
/* compute plane equation of triangle: normal*x+d=0 */
M_CROSS3(normal, e0, e1);
if (! m__plane_box_overlap(&normal, &v0, boxhalfsize)) return 0;
return 1; /* box and triangle overlaps */
}
#undef M_AXISTEST_X01
#undef M_AXISTEST_X2
#undef M_AXISTEST_Y02
#undef M_AXISTEST_Y1
#undef M_AXISTEST_Z12
#undef M_AXISTEST_Z0
#endif /* M_MATH_IMPLEMENTATION */
================================================
FILE: include/m_path_finding.h
================================================
/*======================================================================
Maratis Tiny C Library
version 1.0
------------------------------------------------------------------------
Copyright (c) 2016 Anael Seghezzi <www.maratis3d.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would
be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
========================================================================*/
/*
Floodfill-based path finding:
to create the implementation,
#define M_PF_IMPLEMENTATION
in *one* C/CPP file that includes this file.
*/
#ifndef M_PF_H
#define M_PF_H
#define M_PF_VERSION 1
#ifndef MPFAPI
#ifdef __cplusplus
#define MPFAPI extern "C"
#else
#define MPFAPI extern
#endif
#endif
struct m_pf_point
{
unsigned short x, y;
};
/* floodfill a score map from destination (x, y)
the input map is filled with this two values: 0 = ground, UINT_MAX = wall
*stack should be at least of size (w * h) */
MPFAPI void m_pf_floodfill(unsigned int *map, int w, int h, int x, int y, struct m_pf_point *stack);
/* backtrace a path from start (x, y) */
MPFAPI int m_pf_backtrace(struct m_pf_point *dest, const unsigned int *map, int w, int h, int x, int y);
#endif /* M_PF_H */
#ifdef M_PF_IMPLEMENTATION
#include <limits.h>
#define M_PF_PUSH_PIXEL(x2, y2)\
if(map[w * (y2) + (x2)] == 0) {\
stack[stack_n].x = (x2);\
stack[stack_n].y = (y2);\
stack_n++;\
map[w * (y2) + (x2)] = i;\
}
MPFAPI void m_pf_floodfill(unsigned int *map, int w, int h, int x, int y, struct m_pf_point *stack)
{
unsigned int i = 0;
int stack_c = 0;
int stack_n = 0;
M_PF_PUSH_PIXEL(x, y)
while (stack_c < stack_n) {
x = stack[stack_c].x;
y = stack[stack_c].y;
i = map[w * y + x] + 1;
stack_c++;
if (y > 0)
M_PF_PUSH_PIXEL(x, y - 1)
if (x > 0)
M_PF_PUSH_PIXEL(x - 1, y)
if (x < (w - 1))
M_PF_PUSH_PIXEL(x + 1, y)
if (y < (h - 1))
M_PF_PUSH_PIXEL(x, y + 1)
}
}
MPFAPI int m_pf_backtrace(struct m_pf_point *dest, const unsigned int *map, int w, int h, int x, int y)
{
const unsigned int *p = map + (y * w + x);
int i, s = w * h;
if (*p == 0 || *p == UINT_MAX)
return 0;
for (i = 0; i < s; i++) {
unsigned int min = UINT_MAX;
int minx, miny;
int maxx, maxy;
int xi, yi;
minx = (x - 1) < 0 ? 0 : (x - 1);
miny = (y - 1) < 0 ? 0 : (y - 1);
maxx = (x + 2) > w ? w : (x + 2);
maxy = (y + 2) > h ? h : (y + 2);
for (yi = miny; yi < maxy; yi++) {
p = map + (yi * w + minx);
for (xi = minx; xi < maxx; xi++) {
if (*p < min) {
min = *p;
y = yi;
x = xi;
}
p++;
}
}
dest[i].x = x;
dest[i].y = y;
if (min == 1)
return i + 1;
}
return 0;
}
#undef M_PF_PUSH_PIXEL
#endif /* M_PF_IMPLEMENTATION */
================================================
FILE: include/m_raster.h
================================================
/*======================================================================
Maratis Tiny C Library
version 1.0
------------------------------------------------------------------------
Copyright (c) 2015 Anael Seghezzi <www.maratis3d.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would
be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
========================================================================*/
/*
Simple rasterization:
- triangle with perspective correct interpolation
- basic line, circle and polygon
to create the implementation,
#define M_RASTER_IMPLEMENTATION
in *one* C/CPP file that includes this file.
*/
#ifndef M_RASTER_H
#define M_RASTER_H
#define M_RASTER_VERSION 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef MRAPI
#define MRAPI extern
#endif
/* inverse bilinear interpolation */
MRAPI void m_raster_inv_bilerp(float *dest, float x, float y, const float *v0, const float *v1, const float *v2, const float *v3);
/* triangle with 4 components attributes (float 4 vertices and attributes) */
MRAPI void m_raster_triangle_bbox_att4(float *dest, int width, int height, int minx, int miny, int maxx, int maxy, float *v0, float *v1, float *v2, float *a0, float *a1, float *a2);
MRAPI void m_raster_triangle_att4(float *dest, int width, int height, float *v0, float *v1, float *v2, float *a0, float *a1, float *a2);
/* basic 2d rasterization (float 2 points) */
MRAPI void m_raster_line(float *dest, int width, int height, int comp, float *p0, float *p1, float *color);
MRAPI void m_raster_circle(float *dest, int width, int height, int comp, float *p, float r, float *color);
MRAPI void m_raster_polygon(float *dest, int width, int height, int comp, float *points, int count, float *color);
#ifdef __cplusplus
}
#endif
/*
----------------------------------------------------------------------*/
#endif /* M_RASTER_H */
#ifdef M_RASTER_IMPLEMENTATION
#ifndef M_MIN
#define M_MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef M_MAX
#define M_MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef M_ABS
#define M_ABS(a) (((a) < 0) ? -(a) : (a))
#endif
#ifndef M_FIND_MIN_MAX_3
#define M_FIND_MIN_MAX_3(x0, x1, x2, min, max)\
min = max = x0;\
if (x1 < min) min=x1;\
if (x1 > max) max=x1;\
if (x2 < min) min=x2;\
if (x2 > max) max=x2;
#endif
MRAPI void m_raster_inv_bilerp(float *dest, float x, float y, const float *v0, const float *v1, const float *v2, const float *v3)
{
float vec1[2], vec2[2], vecp1[2], vecp2[2];
float vA, vC, vB;
float s, is, t, am2bpc, tdenom_x, tdenom_y;
vec1[0] = v0[0] - v2[0];
vec1[1] = v0[1] - v2[1];
vec2[0] = v1[0] - v3[0];
vec2[1] = v1[1] - v3[1];
vecp1[0] = v0[0] - x;
vecp1[1] = v0[1] - y;
vecp2[0] = v1[0] - x;
vecp2[1] = v1[1] - y;
vA = vecp1[0] * vec1[1] - vecp1[1] * vec1[0];
vC = vecp2[0] * vec2[1] - vecp2[1] * vec2[0];
vB = ((vecp1[0] * vec2[1] - vecp1[1] * vec2[0]) +
(vecp2[0] * vec1[1] - vecp2[1] * vec1[0])) * 0.5f;
am2bpc = vA - 2.0f * vB + vC;
if (am2bpc > -0.0001f && am2bpc < 0.0001f)
s = vA / (vA - vC);
else
s = ((vA - vB) + sqrtf(vB * vB - vA * vC)) / am2bpc;
is = 1.0f - s;
tdenom_x = is * vec1[0] + s * vec2[0];
tdenom_y = is * vec1[1] + s * vec2[1];
if (M_ABS(tdenom_x) > M_ABS(tdenom_y))
t = (is * vecp1[0] + s * vecp2[0]) / tdenom_x;
else
t = (is * vecp1[1] + s * vecp2[1]) / tdenom_y;
dest[0] = is;
dest[1] = t;
}
MRAPI void m_raster_triangle_bbox_att4(float *dest, int width, int height, int minx, int miny, int maxx, int maxy, float *v0, float *v1, float *v2, float *a0, float *a1, float *a2)
{
float *data = dest;
float *yline;
float up0[4], up1[4], up2[4];
float denom, idenom;
float t0_row, t1_row;
float deltaX0, deltaX2, deltaY1, deltaY2;
int w = width;
int w4, mx4, y;
/* denominator */
denom = (v1[0] - v2[0]) * (v2[1] - v0[1]) - (v1[1] - v2[1]) * (v2[0] - v0[0]);
if (denom >= 0.0f)
return;
idenom = 1.0f / denom;
/* scanline */
t0_row = ((v2[0] - v1[0]) * (miny-v1[1]) - (v2[1] - v1[1]) * (minx - v1[0])) * idenom;
t1_row = ((v0[0] - v2[0]) * (miny-v2[1]) - (v0[1] - v2[1]) * (minx - v2[0])) * idenom;
deltaX0 = (v0[0] - v2[0]) * idenom;
deltaX2 = (v2[0] - v1[0]) * idenom;
deltaY1 = (v1[1] - v2[1]) * idenom;
deltaY2 = (v2[1] - v0[1]) * idenom;
up0[0] = a0[0] * v0[3]; up0[1] = a0[1] * v0[3]; up0[2] = a0[2] * v0[3]; up0[3] = a0[3] * v0[3];
up1[0] = a1[0] * v1[3]; up1[1] = a1[1] * v1[3]; up1[2] = a1[2] * v1[3]; up1[3] = a1[3] * v1[3];
up2[0] = a2[0] * v2[3]; up2[1] = a2[1] * v2[3]; up2[2] = a2[2] * v2[3]; up2[3] = a2[3] * v2[3];
w4 = w * 4;
mx4 = minx * 4;
yline = data + miny * w4;
for (y = miny; y <= maxy; y++) {
float *pixel = yline + mx4;
float t0 = t0_row;
float t1 = t1_row;
int x;
for (x = minx; x <= maxx; x++) {
float t2 = t0 + t1;
if (t0 >= 0.0f && t1 >= 0.0f && t2 <= 1.0f) {
float it2 = 1.0f - t2;
float w = 1.0f / (t0 * v0[3] + t1 * v1[3] + it2 * v2[3]);
pixel[0] = (up0[0] * t0 + up1[0] * t1 + up2[0] * it2) * w;
pixel[1] = (up0[1] * t0 + up1[1] * t1 + up2[1] * it2) * w;
pixel[2] = (up0[2] * t0 + up1[2] * t1 + up2[2] * it2) * w;
pixel[3] = (up0[3] * t0 + up1[3] * t1 + up2[3] * it2) * w;
}
t0 += deltaY1;
t1 += deltaY2;
pixel += 4;
}
t0_row += deltaX2;
t1_row += deltaX0;
yline += w4;
}
}
MRAPI void m_raster_triangle_att4(float *dest, int width, int height, float *v0, float *v1, float *v2, float *a0, float *a1, float *a2)
{
int minx, maxx, miny, maxy;
int w = width;
int h = height;
if (v0[3] <= 0.0f || v1[3] <= 0.0f || v2[3] <= 0.0f) /* no clip */
return;
/* bounding box */
M_FIND_MIN_MAX_3((int)v0[0], (int)v1[0], (int)v2[0], minx, maxx);
M_FIND_MIN_MAX_3((int)v0[1], (int)v1[1], (int)v2[1], miny, maxy);
minx = M_MAX(minx, 0);
miny = M_MAX(miny, 0);
maxx = M_MIN(maxx, w - 1);
maxy = M_MIN(maxy, h - 1);
m_raster_triangle_bbox_att4(dest, width, height, minx, miny, maxx, maxy, v0, v1, v2, a0, a1, a2);
}
MRAPI void m_raster_line(float *dest, int width, int height, int comp, float *p0, float *p1, float *color)
{
float *data = dest;
int x0 = (int)p0[0];
int y0 = (int)p0[1];
int x1 = (int)p1[0];
int y1 = (int)p1[1];
int w = width;
int h = height;
int dx = M_ABS(x1 - x0), sx = x0 < x1 ? 1 : -1;
int dy = -M_ABS(y1 - y0), sy = y0 < y1 ? 1 : -1;
int err = dx + dy, e2;
while (1) {
if (x0 > -1 && y0 > -1 && x0 < w && y0 < h) { /* safe, but should be taken out of the loop for speed (clipping ?) */
float *pixel = data + (y0 * w + x0) * comp; int c;
for (c = 0; c < comp; c++)
pixel[c] = color[c];
}
if (x0 == x1 && y0 == y1)
break;
e2 = 2 * err;
if (e2 >= dy) { err += dy; x0 += sx; }
if (e2 <= dx) { err += dx; y0 += sy; }
}
}
// Midpoint Circle Algorithm : http://en[3]ikipedia.org/wiki/Midpoint_circle_algorithm
MRAPI void m_raster_circle(float *dest, int width, int height, int comp, float *p, float r, float *color)
{
#define M_CIRCLE_PIXEL(px, py)\
{\
int x2 = px;\
int y2 = py;\
if (x2 > -1 && y2 > -1 && x2 < w && y2 < h) {\
float *pixel = data + (y2 * w + x2) * comp; int c;\
for (c = 0; c < comp; c++)\
pixel[c] = color[c];\
}\
}
float *data = dest;
int x0 = (int)p[0];
int y0 = (int)p[1];
int radius = (int)r;
int w = width;
int h = height;
int x = radius, y = 0;
int radius_error = 1 - x;
while (x >= y) {
M_CIRCLE_PIXEL( x + x0, y + y0)
M_CIRCLE_PIXEL( y + x0, x + y0)
M_CIRCLE_PIXEL(-x + x0, y + y0)
M_CIRCLE_PIXEL(-y + x0, x + y0)
M_CIRCLE_PIXEL(-x + x0, -y + y0)
M_CIRCLE_PIXEL(-y + x0, -x + y0)
M_CIRCLE_PIXEL( x + x0, -y + y0)
M_CIRCLE_PIXEL( y + x0, -x + y0)
y++;
if (radius_error < 0)
radius_error += 2 * y + 1;
else {
x--;
radius_error += 2 * (y - x + 1);
}
}
#undef M_CIRCLE_PIXEL
}
/* adapted from : http://alienryderflex.com/polygon_fill/
public-domain code by Darel Rex Finley, 2007
*/
MRAPI void m_raster_polygon(float *dest, int width, int height, int comp, float *points, int count, float *color)
{
float *data = dest;
int *nodeX;
int w = width;
int h = height;
int pixelY;
int IMAGE_LEFT, IMAGE_RIGHT;
int IMAGE_TOP, IMAGE_BOT;
if (count < 3)
return;
nodeX = (int *)malloc(count * sizeof(int));
/* bounding box */
{
float *point = points;
float min[2], max[2]; int i;
min[0] = point[0];
max[0] = point[0];
min[1] = point[1];
max[1] = point[1];
point += 2;
for (i = 1; i < count; i++) {
min[0] = M_MIN(min[0], point[0]);
min[1] = M_MIN(min[1], point[1]);
max[0] = M_MAX(max[0], point[0]);
max[1] = M_MAX(max[1], point[1]);
point += 2;
}
IMAGE_LEFT = M_MAX(0, (int)min[0]);
IMAGE_TOP = M_MAX(0, (int)min[1]);
IMAGE_RIGHT = M_MIN(w - 1, (int)max[0] + 1);
IMAGE_BOT = M_MIN(h - 1, (int)max[1] + 1);
}
/* loop through the rows of the image. */
for (pixelY = IMAGE_TOP; pixelY < IMAGE_BOT; pixelY++) {
/* build a list of nodes. */
float *pointi, *pointj;
int nodes = 0;
int i, j;
pointi = points;
pointj = points + ((count - 1) * 2);
for (i = 0; i < count; i++) {
if ((pointi[1] < (float)pixelY && pointj[1] >= (float)pixelY) ||
(pointj[1] < (float)pixelY && pointi[1] >= (float)pixelY))
nodeX[nodes++] = (int)(pointi[0] + (pixelY - pointi[1]) / (pointj[1] - pointi[1]) * (pointj[0] - pointi[0]));
pointj = pointi;
pointi += 2;
}
/* sort the nodes, via a simple Bubble sort. */
i = 0;
while (i < (nodes - 1)) {
if (nodeX[i] > nodeX[i + 1]) {
int swap = nodeX[i]; nodeX[i] = nodeX[i + 1]; nodeX[i + 1] = swap; if (i) i--;
}
else i++;
}
/* fill the pixels between node pairs. */
for (i = 0; i < nodes; i += 2) {
if (nodeX[i] >= IMAGE_RIGHT)
break;
if (nodeX[i + 1] > IMAGE_LEFT) {
float *pixel;
nodeX[i] = M_MAX(nodeX[i], IMAGE_LEFT);
nodeX[i + 1] = M_MIN(nodeX[i + 1], IMAGE_RIGHT);
pixel = data + (pixelY * w + nodeX[i]) * comp;
for (j = nodeX[i]; j < nodeX[i + 1]; j++) {
int c;
for (c = 0; c < comp; c++)
pixel[c] = color[c];
pixel += comp;
}
}
}
}
free(nodeX);
}
#endif /* M_RASTER_IMPLEMENTATION */
================================================
FILE: tests/3rdparty/CMakeLists.txt
================================================
ADD_SUBDIRECTORY(tinycthread)
ADD_SUBDIRECTORY(glfw)
================================================
FILE: tests/3rdparty/glfw/CMakeLists.txt
================================================
## Find source and headers
FILE(GLOB SOURCES
src/clipboard.c
src/context.c
src/gamma.c
src/init.c
src/input.c
src/joystick.c
src/monitor.c
src/time.c
src/window.c
)
IF(WIN32)
FILE(GLOB OS_HEADERS src/win32_*.h src/wgl_*.h)
FILE(GLOB OS_SOURCES src/win32_*.c src/wgl_*.c)
ADD_DEFINITIONS(-D_GLFW_WIN32)
ADD_DEFINITIONS(-D_GLFW_WGL)
ENDIF(WIN32)
IF(APPLE)
FILE(GLOB OS_HEADERS src/cocoa_*.h src/nsgl_*.h)
FILE(GLOB OS_SOURCES src/cocoa_*.c src/nsgl_*.c src/cocoa_*.m src/nsgl_*.m)
ADD_DEFINITIONS(-D_GLFW_COCOA)
ADD_DEFINITIONS(-D_GLFW_NSGL)
ENDIF(APPLE)
IF(UNIX AND NOT APPLE)
FILE(GLOB OS_HEADERS src/x11_*.h src/glx_*.h)
FILE(GLOB OS_SOURCES src/x11_*.c src/glx_*.c)
ADD_DEFINITIONS(-D_GLFW_X11)
ADD_DEFINITIONS(-D_GLFW_GLX)
ADD_DEFINITIONS(-D_GLFW_HAS_GLXGETPROCADDRESS)
ENDIF(UNIX AND NOT APPLE)
IF(CMAKE_HAS_SORT)
LIST(SORT SOURCES)
LIST(SORT OS_HEADERS)
LIST(SORT OS_SOURCES)
ENDIF(CMAKE_HAS_SORT)
## Build
ADD_DEFINITIONS(-D_GLFW_USE_OPENGL)
ADD_DEFINITIONS(-D_GLFW_USE_MENUBAR)
ADD_DEFINITIONS(-D_GLFW_USE_CHDIR)
INCLUDE_DIRECTORIES(
include
)
ADD_LIBRARY(glfw ${SOURCES} ${OS_HEADERS} ${OS_SOURCES})
================================================
FILE: tests/3rdparty/glfw/COPYING.txt
================================================
Copyright (c) 2002-2006 Marcus Geelnard
Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would
be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
================================================
FILE: tests/3rdparty/glfw/deps/EGL/eglext.h
================================================
#ifndef __eglext_h_
#define __eglext_h_
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright (c) 2007-2013 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
#include <EGL/eglplatform.h>
/*************************************************************/
/* Header file version number */
/* Current version at http://www.khronos.org/registry/egl/ */
/* $Revision: 20690 $ on $Date: 2013-02-22 17:15:05 -0800 (Fri, 22 Feb 2013) $ */
#define EGL_EGLEXT_VERSION 15
#ifndef EGL_KHR_config_attribs
#define EGL_KHR_config_attribs 1
#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */
#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */
#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */
#endif
#ifndef EGL_KHR_lock_surface
#define EGL_KHR_lock_surface 1
#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */
#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */
#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */
#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */
#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */
#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */
#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */
#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */
#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */
#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */
#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */
#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */
#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */
#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */
#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
#endif
#ifndef EGL_KHR_image
#define EGL_KHR_image 1
#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
typedef void *EGLImageKHR;
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
#endif
#ifndef EGL_KHR_vg_parent_image
#define EGL_KHR_vg_parent_image 1
#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */
#endif
#ifndef EGL_KHR_gl_texture_2D_image
#define EGL_KHR_gl_texture_2D_image 1
#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */
#endif
#ifndef EGL_KHR_gl_texture_cubemap_image
#define EGL_KHR_gl_texture_cubemap_image 1
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */
#endif
#ifndef EGL_KHR_gl_texture_3D_image
#define EGL_KHR_gl_texture_3D_image 1
#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */
#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */
#endif
#ifndef EGL_KHR_gl_renderbuffer_image
#define EGL_KHR_gl_renderbuffer_image 1
#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */
#endif
#if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */
#ifndef EGL_KHR_reusable_sync
#define EGL_KHR_reusable_sync 1
typedef void* EGLSyncKHR;
typedef khronos_utime_nanoseconds_t EGLTimeKHR;
#define EGL_SYNC_STATUS_KHR 0x30F1
#define EGL_SIGNALED_KHR 0x30F2
#define EGL_UNSIGNALED_KHR 0x30F3
#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
#define EGL_CONDITION_SATISFIED_KHR 0x30F6
#define EGL_SYNC_TYPE_KHR 0x30F7
#define EGL_SYNC_REUSABLE_KHR 0x30FA
#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR <flags> bitfield */
#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
#endif
#endif
#ifndef EGL_KHR_image_base
#define EGL_KHR_image_base 1
/* Most interfaces defined by EGL_KHR_image_pixmap above */
#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */
#endif
#ifndef EGL_KHR_image_pixmap
#define EGL_KHR_image_pixmap 1
/* Interfaces defined by EGL_KHR_image above */
#endif
#ifndef EGL_IMG_context_priority
#define EGL_IMG_context_priority 1
#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
#endif
#ifndef EGL_KHR_lock_surface2
#define EGL_KHR_lock_surface2 1
#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
#endif
#ifndef EGL_NV_coverage_sample
#define EGL_NV_coverage_sample 1
#define EGL_COVERAGE_BUFFERS_NV 0x30E0
#define EGL_COVERAGE_SAMPLES_NV 0x30E1
#endif
#ifndef EGL_NV_depth_nonlinear
#define EGL_NV_depth_nonlinear 1
#define EGL_DEPTH_ENCODING_NV 0x30E2
#define EGL_DEPTH_ENCODING_NONE_NV 0
#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
#endif
#if KHRONOS_SUPPORT_INT64 /* EGLTimeNV requires 64-bit uint support */
#ifndef EGL_NV_sync
#define EGL_NV_sync 1
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
#define EGL_SYNC_STATUS_NV 0x30E7
#define EGL_SIGNALED_NV 0x30E8
#define EGL_UNSIGNALED_NV 0x30E9
#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
#define EGL_ALREADY_SIGNALED_NV 0x30EA
#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
#define EGL_CONDITION_SATISFIED_NV 0x30EC
#define EGL_SYNC_TYPE_NV 0x30ED
#define EGL_SYNC_CONDITION_NV 0x30EE
#define EGL_SYNC_FENCE_NV 0x30EF
#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
typedef void* EGLSyncNV;
typedef khronos_utime_nanoseconds_t EGLTimeNV;
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
#endif
#endif
#if KHRONOS_SUPPORT_INT64 /* Dependent on EGL_KHR_reusable_sync which requires 64-bit uint support */
#ifndef EGL_KHR_fence_sync
#define EGL_KHR_fence_sync 1
/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
#define EGL_SYNC_CONDITION_KHR 0x30F8
#define EGL_SYNC_FENCE_KHR 0x30F9
#endif
#endif
#ifndef EGL_HI_clientpixmap
#define EGL_HI_clientpixmap 1
/* Surface Attribute */
#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
/*
* Structure representing a client pixmap
* (pixmap's data is in client-space memory).
*/
struct EGLClientPixmapHI
{
void* pData;
EGLint iWidth;
EGLint iHeight;
EGLint iStride;
};
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
#endif /* EGL_HI_clientpixmap */
#ifndef EGL_HI_colorformats
#define EGL_HI_colorformats 1
/* Config Attribute */
#define EGL_COLOR_FORMAT_HI 0x8F70
/* Color Formats */
#define EGL_COLOR_RGB_HI 0x8F71
#define EGL_COLOR_RGBA_HI 0x8F72
#define EGL_COLOR_ARGB_HI 0x8F73
#endif /* EGL_HI_colorformats */
#ifndef EGL_MESA_drm_image
#define EGL_MESA_drm_image 1
#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 /* CreateDRMImageMESA attribute */
#define EGL_DRM_BUFFER_USE_MESA 0x31D1 /* CreateDRMImageMESA attribute */
#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 /* EGL_IMAGE_FORMAT_MESA attribute value */
#define EGL_DRM_BUFFER_MESA 0x31D3 /* eglCreateImageKHR target */
#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 /* EGL_DRM_BUFFER_USE_MESA bits */
#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 /* EGL_DRM_BUFFER_USE_MESA bits */
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
#endif
#ifndef EGL_NV_post_sub_buffer
#define EGL_NV_post_sub_buffer 1
#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
#endif
#ifndef EGL_ANGLE_query_surface_pointer
#define EGL_ANGLE_query_surface_pointer 1
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
#endif
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
#endif
#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
#endif
#ifndef EGL_NV_coverage_sample_resolve
#define EGL_NV_coverage_sample_resolve 1
#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
#endif
#if KHRONOS_SUPPORT_INT64 /* EGLuint64NV requires 64-bit uint support */
#ifndef EGL_NV_system_time
#define EGL_NV_system_time 1
typedef khronos_utime_nanoseconds_t EGLuint64NV;
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
#endif
#endif
#if KHRONOS_SUPPORT_INT64 /* EGLuint64KHR requires 64-bit uint support */
#ifndef EGL_KHR_stream
#define EGL_KHR_stream 1
typedef void* EGLStreamKHR;
typedef khronos_uint64_t EGLuint64KHR;
#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
#define EGL_PRODUCER_FRAME_KHR 0x3212
#define EGL_CONSUMER_FRAME_KHR 0x3213
#define EGL_STREAM_STATE_KHR 0x3214
#define EGL_STREAM_STATE_CREATED_KHR 0x3215
#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
#define EGL_BAD_STREAM_KHR 0x321B
#define EGL_BAD_STATE_KHR 0x321C
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream);
EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC)(EGLDisplay dpy, const EGLint *attrib_list);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
#endif
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_consumer_gltexture
#define EGL_KHR_stream_consumer_gltexture 1
#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream);
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream);
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
#endif
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_producer_eglsurface
#define EGL_KHR_stream_producer_eglsurface 1
#define EGL_STREAM_BIT_KHR 0x0800
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
#endif
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_producer_aldatalocator
#define EGL_KHR_stream_producer_aldatalocator 1
#endif
#endif
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
#ifndef EGL_KHR_stream_fifo
#define EGL_KHR_stream_fifo 1
/* reuse EGLTimeKHR */
#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
#define EGL_STREAM_TIME_NOW_KHR 0x31FD
#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
#
gitextract_a32ni6ry/
├── .gitignore
├── CMake/
│ └── OutOfSourceBuild.cmake
├── CMakeLists.txt
├── LICENSE
├── README.md
├── build_tests_unix.sh
├── build_tests_vs.bat
├── include/
│ ├── m_dist.h
│ ├── m_image.h
│ ├── m_math.h
│ ├── m_path_finding.h
│ └── m_raster.h
└── tests/
├── 3rdparty/
│ ├── CMakeLists.txt
│ ├── glfw/
│ │ ├── CMakeLists.txt
│ │ ├── COPYING.txt
│ │ ├── deps/
│ │ │ ├── EGL/
│ │ │ │ └── eglext.h
│ │ │ ├── GL/
│ │ │ │ ├── glext.h
│ │ │ │ ├── glxext.h
│ │ │ │ └── wglext.h
│ │ │ ├── getopt.c
│ │ │ ├── getopt.h
│ │ │ ├── tinycthread.c
│ │ │ └── tinycthread.h
│ │ ├── include/
│ │ │ └── GLFW/
│ │ │ ├── glfw3.h
│ │ │ └── glfw3native.h
│ │ └── src/
│ │ ├── CMakeLists.txt
│ │ ├── clipboard.c
│ │ ├── cocoa_clipboard.m
│ │ ├── cocoa_gamma.c
│ │ ├── cocoa_init.m
│ │ ├── cocoa_joystick.m
│ │ ├── cocoa_monitor.m
│ │ ├── cocoa_platform.h
│ │ ├── cocoa_time.c
│ │ ├── cocoa_window.m
│ │ ├── config.h
│ │ ├── config.h.in
│ │ ├── context.c
│ │ ├── egl_context.c
│ │ ├── egl_platform.h
│ │ ├── gamma.c
│ │ ├── glfw3.pc.in
│ │ ├── glfwConfig.cmake.in
│ │ ├── glfwConfigVersion.cmake.in
│ │ ├── glx_context.c
│ │ ├── glx_platform.h
│ │ ├── init.c
│ │ ├── input.c
│ │ ├── internal.h
│ │ ├── joystick.c
│ │ ├── monitor.c
│ │ ├── nsgl_context.m
│ │ ├── nsgl_platform.h
│ │ ├── time.c
│ │ ├── wgl_context.c
│ │ ├── wgl_platform.h
│ │ ├── win32_clipboard.c
│ │ ├── win32_gamma.c
│ │ ├── win32_init.c
│ │ ├── win32_joystick.c
│ │ ├── win32_monitor.c
│ │ ├── win32_platform.h
│ │ ├── win32_time.c
│ │ ├── win32_window.c
│ │ ├── window.c
│ │ ├── x11_clipboard.c
│ │ ├── x11_gamma.c
│ │ ├── x11_init.c
│ │ ├── x11_joystick.c
│ │ ├── x11_monitor.c
│ │ ├── x11_platform.h
│ │ ├── x11_time.c
│ │ ├── x11_unicode.c
│ │ └── x11_window.c
│ ├── stb/
│ │ └── stb_image.h
│ └── tinycthread/
│ ├── CMakeLists.txt
│ ├── README.txt
│ └── source/
│ ├── tinycthread.c
│ └── tinycthread.h
├── dataset/
│ └── lena.tga
├── raster/
│ ├── CMakeLists.txt
│ └── main.c
├── raytracing/
│ ├── CMakeLists.txt
│ └── main.c
├── test.h
├── vorogen/
│ ├── CMakeLists.txt
│ └── main.c
└── voronoi/
├── CMakeLists.txt
└── main.c
SYMBOL INDEX (1007 symbols across 58 files)
FILE: include/m_dist.h
type m_image (line 66) | struct m_image
type m_image (line 66) | struct m_image
type m_image (line 67) | struct m_image
type m_image (line 67) | struct m_image
type m_image (line 68) | struct m_image
type m_image (line 68) | struct m_image
type m_image (line 68) | struct m_image
type m_image (line 69) | struct m_image
type m_image (line 69) | struct m_image
type m_image (line 69) | struct m_image
function m_dist_transform_1d (line 111) | void m_dist_transform_1d(float *dest, float *src, int count)
function m_voronoi_transform_1d (line 129) | void m_voronoi_transform_1d(float *destd, int *desti, float *src, int co...
function m_dist_transform_2d (line 148) | void m_dist_transform_2d(float *dest, float *src, int width, int height)
function m_voronoi_transform_2d (line 180) | void m_voronoi_transform_2d(float *destd, int *desti, float *src, int wi...
function m_image_dist_mask_init (line 230) | void m_image_dist_mask_init(struct m_image *dest, const struct m_image *...
function m_image_dist_transform (line 250) | void m_image_dist_transform(struct m_image *dest, const struct m_image *...
function m_image_voronoi_transform (line 269) | void m_image_voronoi_transform(struct m_image *destd, struct m_image *de...
function m_image_voronoi_fill (line 289) | void m_image_voronoi_fill(struct m_image *dest, const struct m_image *sr...
FILE: include/m_image.h
type m_image (line 90) | struct m_image
type m_image (line 108) | struct m_image
type m_image (line 109) | struct m_image
type m_image (line 111) | struct m_image
type m_image (line 111) | struct m_image
type m_image (line 112) | struct m_image
type m_image (line 112) | struct m_image
type m_image (line 113) | struct m_image
type m_image (line 113) | struct m_image
type m_image (line 114) | struct m_image
type m_image (line 114) | struct m_image
type m_image (line 115) | struct m_image
type m_image (line 115) | struct m_image
type m_image (line 116) | struct m_image
type m_image (line 116) | struct m_image
type m_image (line 118) | struct m_image
type m_image (line 118) | struct m_image
type m_image (line 119) | struct m_image
type m_image (line 119) | struct m_image
type m_image (line 120) | struct m_image
type m_image (line 120) | struct m_image
type m_image (line 121) | struct m_image
type m_image (line 121) | struct m_image
type m_image (line 122) | struct m_image
type m_image (line 122) | struct m_image
type m_image (line 123) | struct m_image
type m_image (line 123) | struct m_image
type m_image (line 124) | struct m_image
type m_image (line 124) | struct m_image
type m_image (line 125) | struct m_image
type m_image (line 125) | struct m_image
type m_image (line 126) | struct m_image
type m_image (line 126) | struct m_image
type m_image (line 127) | struct m_image
type m_image (line 127) | struct m_image
type m_image (line 129) | struct m_image
type m_image (line 129) | struct m_image
type m_image (line 130) | struct m_image
type m_image (line 130) | struct m_image
type m_image (line 131) | struct m_image
type m_image (line 131) | struct m_image
type m_image (line 132) | struct m_image
type m_image (line 132) | struct m_image
type m_image (line 158) | struct m_image
type m_image (line 158) | struct m_image
type m_image (line 159) | struct m_image
type m_image (line 159) | struct m_image
type m_image (line 160) | struct m_image
type m_image (line 160) | struct m_image
type m_image (line 163) | struct m_image
type m_image (line 163) | struct m_image
type m_image (line 167) | struct m_image
type m_image (line 167) | struct m_image
type m_image (line 168) | struct m_image
type m_image (line 168) | struct m_image
type m_image (line 169) | struct m_image
type m_image (line 169) | struct m_image
type m_image (line 170) | struct m_image
type m_image (line 170) | struct m_image
type m_image (line 171) | struct m_image
type m_image (line 171) | struct m_image
type m_image (line 174) | struct m_image
type m_image (line 174) | struct m_image
type m_image (line 175) | struct m_image
type m_image (line 175) | struct m_image
type m_image (line 178) | struct m_image
type m_image (line 179) | struct m_image
type m_image (line 180) | struct m_image
type m_image (line 180) | struct m_image
type m_image (line 181) | struct m_image
type m_image (line 181) | struct m_image
type m_image (line 182) | struct m_image
type m_image (line 182) | struct m_image
type m_image (line 183) | struct m_image
type m_image (line 186) | struct m_image
type m_image (line 186) | struct m_image
type m_image (line 195) | struct m_image
type m_image (line 198) | struct m_image
type m_image (line 199) | struct m_image
type m_image (line 199) | struct m_image
type m_image (line 200) | struct m_image
type m_image (line 200) | struct m_image
function MIAPI (line 235) | MIAPI void m_linear_to_sRGB(float *dest, const float *src, int size)
function MIAPI (line 248) | MIAPI void m_sRGB_to_linear(float *dest, const float *src, int size)
function MIAPI (line 261) | MIAPI void m_RGB_to_HSV(float *dest, const float *src)
function MIAPI (line 300) | MIAPI void m_HSV_to_RGB(float *dest, const float *src)
function MIAPI (line 345) | MIAPI void m_RGB_to_HSL(float *dest, const float *src)
function MIAPI (line 387) | MIAPI void m_HSL_to_RGB(float *dest, const float *src)
function MIAPI (line 440) | MIAPI void m_gaussian_kernel(float *dest, int size, float radius)
function MIAPI (line 472) | MIAPI void m_sst(float *dest, const float *src, int count)
function MIAPI (line 488) | MIAPI void m_harris_response(float *dest, const float *src, int count)
function MIAPI (line 501) | MIAPI void m_tfm(float *dest, const float *src, int count)
function MIAPI (line 530) | MIAPI float m_chi_squared_distance(const float *src1, const float *src2,...
function MIAPI (line 549) | MIAPI float m_convolution(const float *src1, const float *src2, int size)
function MIAPI (line 557) | MIAPI void m_normalize(float *dest, const float *src, int size)
function MIAPI (line 573) | MIAPI void m_normalize_sum(float *dest, const float *src, int size)
function MIAPI (line 589) | MIAPI float m_mean(const float *src, int size)
function MIAPI (line 597) | MIAPI float m_squared_distance(const float *src1, const float *src2, int...
function MIAPI (line 1088) | MIAPI float m_half2float(uint16_t h)
function MIAPI (line 1101) | MIAPI uint16_t m_float2half(float flt)
function MIAPI (line 1117) | MIAPI int m_type_sizeof(char type)
function MIAPI (line 1146) | MIAPI void m_image_create(struct m_image *image, char type, int width, i...
function MIAPI (line 1167) | MIAPI void m_image_destroy(struct m_image *image)
function MIAPI (line 1173) | MIAPI void m_image_copy(struct m_image *dest, const struct m_image *src)
function MIAPI (line 1200) | MIAPI void m_image_copy_sub_image(struct m_image *dest, const struct m_i...
function MIAPI (line 1260) | MIAPI void m_image_ubyte_to_float(struct m_image *dest, const struct m_i...
function MIAPI (line 1283) | MIAPI void m_image_ushort_to_float(struct m_image *dest, const struct m_...
function MIAPI (line 1306) | MIAPI void m_image_half_to_float(struct m_image *dest, const struct m_im...
function MIAPI (line 1328) | MIAPI void m_image_float_to_ubyte(struct m_image *dest, const struct m_i...
function MIAPI (line 1352) | MIAPI void m_image_float_to_ushort(struct m_image *dest, const struct m_...
function MIAPI (line 1376) | MIAPI void m_image_float_to_half(struct m_image *dest, const struct m_im...
function MIAPI (line 1398) | MIAPI void m_image_extract_component(struct m_image *dest, const struct ...
function MIAPI (line 1458) | MIAPI void m_image_reframe_zero(struct m_image *dest, const struct m_ima...
function MIAPI (line 1539) | MIAPI void m_image_reframe(struct m_image *dest, const struct m_image *s...
function MIAPI (line 1618) | MIAPI void m_image_rotate_left(struct m_image *dest, const struct m_imag...
function MIAPI (line 1674) | MIAPI void m_image_rotate_right(struct m_image *dest, const struct m_ima...
function MIAPI (line 1730) | MIAPI void m_image_rotate_180(struct m_image *dest, const struct m_image...
function MIAPI (line 1786) | MIAPI void m_image_mirror_x(struct m_image *dest, const struct m_image *...
function MIAPI (line 1842) | MIAPI void m_image_mirror_y(struct m_image *dest, const struct m_image *...
function MIAPI (line 1898) | MIAPI void m_image_premultiply(struct m_image *dest, const struct m_imag...
function MIAPI (line 1919) | MIAPI void m_image_unpremultiply(struct m_image *dest, const struct m_im...
function MIAPI (line 1948) | MIAPI void m_image_sRGB_to_linear(struct m_image *dest, const struct m_i...
function MIAPI (line 1975) | MIAPI void m_image_linear_to_sRGB(struct m_image *dest, const struct m_i...
function MIAPI (line 2002) | MIAPI void m_image_summed_area(struct m_image *dest, const struct m_imag...
function MIAPI (line 2044) | MIAPI void m_image_convolution_h_raw(struct m_image *dest, const struct ...
function MIAPI (line 2093) | MIAPI void m_image_convolution_v_raw(struct m_image *dest, const struct ...
function MIAPI (line 2142) | MIAPI void m_image_convolution_h(struct m_image *dest, const struct m_im...
function MIAPI (line 2183) | MIAPI void m_image_convolution_v(struct m_image *dest, const struct m_im...
function MIAPI (line 2222) | MIAPI void m_image_gaussian_blur(struct m_image *dest, const struct m_im...
function MIAPI (line 2262) | MIAPI void m_image_grey(struct m_image *dest, const struct m_image *src)
function MIAPI (line 2292) | MIAPI void m_image_max(struct m_image *dest, const struct m_image *src)
function MIAPI (line 2324) | MIAPI void m_image_max_abs(struct m_image *dest, const struct m_image *src)
function m__convolve_pixel (line 2356) | static float m__convolve_pixel(float *data, int width, float *kernel)
function MIAPI (line 2370) | MIAPI void m_image_sobel(struct m_image *dest, const struct m_image *src)
function MIAPI (line 2402) | MIAPI void m_image_harris(struct m_image *dest, const struct m_image *sr...
function m__test_pixel (line 2434) | static int m__test_pixel(uint8_t *src, int w, int h, int x, int y, uint8...
function MIAPI (line 2441) | MIAPI int m_image_floodfill_4x(struct m_image *dest, int x, int y, uint8...
function MIAPI (line 2472) | MIAPI int m_image_floodfill_8x(struct m_image *dest, int x, int y, uint8...
function m__dilate_erode (line 2510) | static void m__dilate_erode(struct m_image *dest, const struct m_image *...
function MIAPI (line 2551) | MIAPI void m_image_dilate(struct m_image *dest, const struct m_image *src)
function MIAPI (line 2564) | MIAPI void m_image_erode(struct m_image *dest, const struct m_image *src)
function MIAPI (line 2577) | MIAPI void m_image_edge_4x(struct m_image *dest, const struct m_image *s...
function MIAPI (line 2645) | MIAPI void m_image_thin(struct m_image *dest)
function MIAPI (line 2737) | MIAPI void m_image_non_max_supp(struct m_image *dest, const struct m_ima...
function MIAPI (line 2785) | MIAPI int m_image_corner_harris(const struct m_image *src, int margin, f...
function MIAPI (line 2825) | MIAPI void m_image_sub_pixel(const struct m_image *src, float x, float y...
function m__bilinear (line 2865) | static void m__bilinear(struct m_image *dest, const struct m_image *src,...
function MIAPI (line 2883) | MIAPI void m_image_pyrdown(struct m_image *dest, const struct m_image *src)
function MIAPI (line 2916) | MIAPI void m_image_resize(struct m_image *dest, const struct m_image *sr...
FILE: include/m_math.h
type float3 (line 80) | typedef struct {float x, y, z;} float3;
type float2 (line 99) | typedef struct {float x, y;} float2;
type float4 (line 100) | typedef struct {float x, y, z, w;} float4;
type m_rand_desc (line 148) | typedef struct {unsigned int z, w;} m_rand_desc;
function m_next_power_of_two (line 226) | MMAPI unsigned int m_next_power_of_two(unsigned int x)
function m_rand_user (line 240) | MMAPI unsigned int m_rand_user(m_rand_desc *desc)
function MMAPI (line 247) | MMAPI float m_randf_user(m_rand_desc *desc)
function MMAPI (line 253) | MMAPI void m_srand(unsigned int z, unsigned int w)
function m_rand (line 259) | MMAPI unsigned int m_rand(void)
function MMAPI (line 264) | MMAPI float m_randf(void)
function MMAPI (line 269) | MMAPI float m_interpolation_cubic(float y0, float y1, float y2, float y3...
function MMAPI (line 280) | MMAPI float m_interpolation_catmullrom(float y0, float y1, float y2, flo...
function MMAPI (line 291) | MMAPI void m_quat_identity(float4 *dest)
function MMAPI (line 300) | MMAPI void m_quat_normalize(float4 *dest, const float4 *src)
function MMAPI (line 315) | MMAPI void m_quat_rotation_axis(float4 *dest, const float3 *axis, float ...
function MMAPI (line 327) | MMAPI void m_quat_rotation_euler(float4 *dest, const float3 *euler)
function MMAPI (line 348) | MMAPI void m_quat_mul(float4 *dest, const float4 *A, const float4 *B)
function MMAPI (line 356) | MMAPI void m_quat_slerp(float4 *dest, const float4 *A, const float4 *B, ...
function MMAPI (line 396) | MMAPI void m_quat_extract_axis_angle(float3 *axis, float *angle, const f...
function MMAPI (line 418) | MMAPI void m_mat4_identity(float *dest)
function MMAPI (line 425) | MMAPI void m_mat4_perspective(float *dest, float fov, float ratio, float...
function MMAPI (line 465) | MMAPI void m_mat4_ortho(float *dest, float left, float right, float bott...
function MMAPI (line 491) | MMAPI void m_mat4_lookat(float *dest, const float3 *pos, const float3 *d...
function MMAPI (line 522) | MMAPI void m_mat4_translation(float *dest, const float3 *translation)
function MMAPI (line 529) | MMAPI void m_mat4_rotation_axis(float *dest, const float3 *axis, float a...
function MMAPI (line 548) | MMAPI void m_mat4_rotation_euler(float *dest, const float3 *euler)
function MMAPI (line 572) | MMAPI void m_mat4_scale(float *dest, const float3 *scale)
function MMAPI (line 579) | MMAPI void m_mat4_mul(float *dest, const float *A, const float *B)
function MMAPI (line 599) | MMAPI void m_mat4_transpose(float *dest, const float *src)
function MMAPI (line 607) | MMAPI void m_mat4_inverse_transpose(float *dest, const float *src)
function MMAPI (line 706) | MMAPI void m_mat4_inverse(float *dest, const float *src)
function MMAPI (line 713) | MMAPI void m_mat4_extract_euler(float3 *dest, const float *matrix)
function MMAPI (line 750) | MMAPI void m_mat4_rotate3(float3 *dest, const float *matrix, const float...
function MMAPI (line 757) | MMAPI void m_mat4_inverse_rotate3(float3 *dest, const float *matrix, con...
function MMAPI (line 764) | MMAPI void m_mat4_transform3(float3 *dest, const float *matrix, const fl...
function MMAPI (line 771) | MMAPI void m_mat4_transform4(float4 *dest, const float *matrix, const fl...
function MMAPI (line 779) | MMAPI float m_2d_polygon_area(float2 *points, int count)
function MMAPI (line 797) | MMAPI float m_2d_polyline_length(float2 *points, int count)
function MMAPI (line 807) | MMAPI int m_2d_line_to_line_intersection(float2 *dest, float2 *p11, floa...
function MMAPI (line 833) | MMAPI int m_2d_box_to_box_collision(float2 *min1, float2 *max1, float2 *...
function MMAPI (line 840) | MMAPI float m_3d_polyline_length(float3 *points, int count)
function MMAPI (line 850) | MMAPI int m_3d_box_to_box_collision(float3 *min1, float3 *max1, float3 *...
function MMAPI (line 858) | MMAPI int m_3d_ray_box_intersection_in_out(float3 *ray_origin, float3 *r...
function MMAPI (line 894) | MMAPI int m_3d_ray_sphere_intersection_in_out(float3 *ray_origin, float3...
function MMAPI (line 910) | MMAPI float m_3d_ray_plane_intersection(float3 *ray_origin, float3 *ray_...
function MMAPI (line 918) | MMAPI float m_3d_ray_sphere_intersection(float3 *ray_origin, float3 *ray...
function MMAPI (line 938) | MMAPI float m_3d_ray_box_intersection(float3 *ray_origin, float3 *ray_di...
function MMAPI (line 979) | MMAPI float m_3d_ray_triangle_intersection(float3 *ray_origin, float3 *r...
function m__plane_box_overlap (line 1036) | static int m__plane_box_overlap(float3 *normal, float3 *vert, float3 *ma...
function MMAPI (line 1095) | MMAPI int m_3d_tri_box_overlap(float3 *boxcenter, float3 *boxhalfsize, f...
FILE: include/m_path_finding.h
type m_pf_point (line 48) | struct m_pf_point
type m_pf_point (line 56) | struct m_pf_point
type m_pf_point (line 59) | struct m_pf_point
function MPFAPI (line 75) | MPFAPI void m_pf_floodfill(unsigned int *map, int w, int h, int x, int y...
function MPFAPI (line 101) | MPFAPI int m_pf_backtrace(struct m_pf_point *dest, const unsigned int *m...
FILE: include/m_raster.h
function MRAPI (line 90) | MRAPI void m_raster_inv_bilerp(float *dest, float x, float y, const floa...
function MRAPI (line 131) | MRAPI void m_raster_triangle_bbox_att4(float *dest, int width, int heigh...
function MRAPI (line 198) | MRAPI void m_raster_triangle_att4(float *dest, int width, int height, fl...
function MRAPI (line 218) | MRAPI void m_raster_line(float *dest, int width, int height, int comp, f...
function MRAPI (line 249) | MRAPI void m_raster_circle(float *dest, int width, int height, int comp,...
function MRAPI (line 297) | MRAPI void m_raster_polygon(float *dest, int width, int height, int comp...
FILE: tests/3rdparty/glfw/deps/EGL/eglext.h
type khronos_utime_nanoseconds_t (line 128) | typedef khronos_utime_nanoseconds_t EGLTimeKHR;
type khronos_utime_nanoseconds_t (line 209) | typedef khronos_utime_nanoseconds_t EGLTimeNV;
type EGLClientPixmapHI (line 246) | struct EGLClientPixmapHI
type EGLClientPixmapHI (line 254) | struct EGLClientPixmapHI
type EGLClientPixmapHI (line 256) | struct EGLClientPixmapHI
type khronos_utime_nanoseconds_t (line 318) | typedef khronos_utime_nanoseconds_t EGLuint64NV;
type khronos_uint64_t (line 332) | typedef khronos_uint64_t EGLuint64KHR;
type EGLNativeFileDescriptorKHR (line 446) | typedef int EGLNativeFileDescriptorKHR;
type khronos_ssize_t (line 499) | typedef khronos_ssize_t EGLsizeiANDROID;
type EGLsizeiANDROID (line 501) | typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsi...
FILE: tests/3rdparty/glfw/deps/GL/glext.h
type GLchar (line 6147) | typedef char GLchar;
type GLintptr (line 6152) | typedef ptrdiff_t GLintptr;
type GLsizeiptr (line 6153) | typedef ptrdiff_t GLsizeiptr;
type GLintptrARB (line 6158) | typedef ptrdiff_t GLintptrARB;
type GLsizeiptrARB (line 6159) | typedef ptrdiff_t GLsizeiptrARB;
type GLcharARB (line 6164) | typedef char GLcharARB;
type GLhalfARB (line 6170) | typedef unsigned short GLhalfARB;
type GLhalfNV (line 6174) | typedef unsigned short GLhalfNV;
type __int32 (line 6206) | typedef __int32 int32_t;
type __int64 (line 6207) | typedef __int64 int64_t;
type GLint64EXT (line 6216) | typedef int64_t GLint64EXT;
type GLuint64EXT (line 6217) | typedef uint64_t GLuint64EXT;
type GLint64 (line 6221) | typedef int64_t GLint64;
type GLuint64 (line 6222) | typedef uint64_t GLuint64;
type __GLsync (line 6223) | struct __GLsync
type _cl_context (line 6228) | struct _cl_context
type _cl_event (line 6229) | struct _cl_event
type GLintptr (line 6245) | typedef GLintptr GLvdpauSurfaceNV;
type GLvoid (line 6562) | typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum ac...
type GLubyte (line 6901) | typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GL...
type GLvoid (line 7441) | typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum...
type GLvoid (line 7713) | typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLin...
type GLchar (line 7902) | typedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, ...
type const (line 8137) | typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint ...
type const (line 8138) | typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, ...
type _cl_context (line 8404) | struct _cl_context
type _cl_event (line 8404) | struct _cl_event
type struct (line 8406) | typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl...
type const (line 8740) | typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint prog...
type const (line 8743) | typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint pr...
type const (line 8744) | typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLui...
type GLuint (line 9001) | typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n...
type GLuint (line 10291) | typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n,...
type GLvoid (line 10455) | typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, co...
type GLvoid (line 10995) | typedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer);
type GLvoid (line 11911) | typedef GLvoid* (APIENTRYP PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, G...
type GLvoid (line 11913) | typedef GLvoid* (APIENTRYP PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buff...
type const (line 12487) | typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC...
type const (line 12488) | typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPRO...
FILE: tests/3rdparty/glfw/deps/GL/glxext.h
type XID (line 459) | typedef XID GLXVideoSourceSGIX;
type XID (line 463) | typedef XID GLXFBConfigIDSGIX;
type __GLXFBConfigRec (line 464) | struct __GLXFBConfigRec
type XID (line 468) | typedef XID GLXPbufferSGIX;
type GLXBufferClobberEventSGIX (line 469) | typedef struct {
type GLXVideoDeviceNV (line 485) | typedef unsigned int GLXVideoDeviceNV;
type XID (line 489) | typedef XID GLXVideoCaptureDeviceNV;
type __int32 (line 521) | typedef __int32 int32_t;
type __int64 (line 522) | typedef __int64 int64_t;
type GLXFBConfig (line 551) | typedef GLXFBConfig * ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int scr...
type GLXFBConfig (line 552) | typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int s...
type XVisualInfo (line 554) | typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy...
type GLXWindow (line 555) | typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig...
type GLXPixmap (line 557) | typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig...
type GLXPbuffer (line 559) | typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConf...
type GLXContext (line 562) | typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBC...
type Bool (line 563) | typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawabl...
type GLXDrawable (line 564) | typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void);
type Display (line 565) | typedef Display * ( * PFNGLXGETCURRENTDISPLAYPROC) (void);
type __GLXextFuncPtr (line 576) | typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *pr...
type __GLXextFuncPtr (line 584) | typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte ...
type GLXContext (line 604) | typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy,...
type Bool (line 647) | typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawabl...
type GLXDrawable (line 648) | typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void);
type GLXVideoSourceSGIX (line 658) | typedef GLXVideoSourceSGIX ( * PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Disp...
type Display (line 676) | typedef Display * ( * PFNGLXGETCURRENTDISPLAYEXTPROC) (void);
type GLXContextID (line 678) | typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext co...
type GLXContext (line 679) | typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXCon...
type GLXFBConfigSGIX (line 694) | typedef GLXFBConfigSGIX * ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dp...
type GLXPixmap (line 695) | typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display ...
type GLXContext (line 696) | typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *...
type XVisualInfo (line 697) | typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display ...
type GLXFBConfigSGIX (line 698) | typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Displa...
type GLXPbufferSGIX (line 710) | typedef GLXPbufferSGIX ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy...
type Bool (line 747) | typedef Bool ( * PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbu...
type Bool (line 766) | typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int ...
type Status (line 774) | typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Wind...
type GLXPixmap (line 790) | typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVis...
type Bool (line 798) | typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawabl...
type Bool (line 806) | typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode);
type Bool (line 826) | typedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable ...
type Bool (line 827) | typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable dra...
type Bool (line 829) | typedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable dra...
type Bool (line 830) | typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable dra...
type GLXHyperpipeNetworkSGIX (line 840) | typedef struct {
type GLXHyperpipeConfigSGIX (line 845) | typedef struct {
type GLXPipeRect (line 853) | typedef struct {
type GLXPipeRectLimits (line 859) | typedef struct {
type GLXHyperpipeNetworkSGIX (line 874) | typedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPRO...
type GLXHyperpipeConfigSGIX (line 876) | typedef GLXHyperpipeConfigSGIX * ( * PFNGLXQUERYHYPERPIPECONFIGSGIXPROC)...
type Bool (line 948) | typedef Bool ( * PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable d...
type Bool (line 949) | typedef Bool ( * PFNGLXBINDSWAPBARRIERNVPROC) (Display *dpy, GLuint grou...
type Bool (line 950) | typedef Bool ( * PFNGLXQUERYSWAPGROUPNVPROC) (Display *dpy, GLXDrawable ...
type Bool (line 951) | typedef Bool ( * PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display *dpy, int scre...
type Bool (line 952) | typedef Bool ( * PFNGLXQUERYFRAMECOUNTNVPROC) (Display *dpy, int screen,...
type Bool (line 953) | typedef Bool ( * PFNGLXRESETFRAMECOUNTNVPROC) (Display *dpy, int screen);
type GLXVideoCaptureDeviceNV (line 966) | typedef GLXVideoCaptureDeviceNV * ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICES...
FILE: tests/3rdparty/glfw/deps/GL/wglext.h
type GPU_DEVICE (line 450) | typedef struct _GPU_DEVICE {
type const (line 495) | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, in...
type const (line 496) | typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, in...
type const (line 497) | typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const i...
type const (line 519) | typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int ...
type const (line 551) | typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGL...
type const (line 603) | typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int ...
type const (line 619) | typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const i...
type const (line 679) | typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC,...
type const (line 691) | typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, i...
type USHORT (line 693) | typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntrie...
type HANDLE (line 736) | typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC...
type LPVOID (line 737) | typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, ...
type const (line 873) | typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UI...
FILE: tests/3rdparty/glfw/deps/getopt.c
function increment_index (line 77) | static void increment_index()
function permute_argv_once (line 94) | static int permute_argv_once()
function getopt (line 114) | int getopt(int argc, char** argv, const char* optstr)
FILE: tests/3rdparty/glfw/deps/tinycthread.c
function mtx_init (line 55) | int mtx_init(mtx_t *mtx, int type)
function mtx_destroy (line 76) | void mtx_destroy(mtx_t *mtx)
function mtx_lock (line 85) | int mtx_lock(mtx_t *mtx)
function mtx_timedlock (line 100) | int mtx_timedlock(mtx_t *mtx, const struct timespec *ts)
function mtx_trylock (line 108) | int mtx_trylock(mtx_t *mtx)
function mtx_unlock (line 123) | int mtx_unlock(mtx_t *mtx)
function cnd_init (line 139) | int cnd_init(cnd_t *cond)
function cnd_destroy (line 168) | void cnd_destroy(cnd_t *cond)
function cnd_signal (line 185) | int cnd_signal(cnd_t *cond)
function cnd_broadcast (line 210) | int cnd_broadcast(cnd_t *cond)
function _cnd_timedwait_win32 (line 236) | static int _cnd_timedwait_win32(cnd_t *cond, mtx_t *mtx, DWORD timeout)
function cnd_wait (line 284) | int cnd_wait(cnd_t *cond, mtx_t *mtx)
function cnd_timedwait (line 293) | int cnd_timedwait(cnd_t *cond, mtx_t *mtx, const struct timespec *ts)
type _thread_start_info (line 318) | typedef struct {
function thrd_create (line 360) | int thrd_create(thrd_t *thr, thrd_start_t func, void *arg)
function thrd_t (line 392) | thrd_t thrd_current(void)
function thrd_detach (line 401) | int thrd_detach(thrd_t thr)
function thrd_equal (line 408) | int thrd_equal(thrd_t thr0, thrd_t thr1)
function thrd_exit (line 417) | void thrd_exit(int res)
function thrd_join (line 431) | int thrd_join(thrd_t thr, int *res)
function thrd_sleep (line 464) | int thrd_sleep(const struct timespec *time_point, struct timespec *remai...
function thrd_yield (line 511) | void thrd_yield(void)
function tss_create (line 520) | int tss_create(tss_t *key, tss_dtor_t dtor)
function tss_delete (line 542) | void tss_delete(tss_t key)
function tss_set (line 560) | int tss_set(tss_t key, void *val)
function _tthread_clock_gettime (line 577) | int _tthread_clock_gettime(clockid_t clk_id, struct timespec *ts)
FILE: tests/3rdparty/glfw/deps/tinycthread.h
type _ttherad_timespec (line 111) | struct _ttherad_timespec {
type _tthread_clockid_t (line 119) | typedef int _tthread_clockid_t;
type timespec (line 123) | struct timespec
type mtx_t (line 181) | typedef struct {
type pthread_mutex_t (line 187) | typedef pthread_mutex_t mtx_t;
type timespec (line 221) | struct timespec
type cnd_t (line 242) | typedef struct {
type pthread_cond_t (line 248) | typedef pthread_cond_t cnd_t;
type timespec (line 307) | struct timespec
type HANDLE (line 311) | typedef HANDLE thrd_t;
type pthread_t (line 313) | typedef pthread_t thrd_t;
type timespec (line 382) | struct timespec
type timespec (line 382) | struct timespec
type DWORD (line 392) | typedef DWORD tss_t;
type pthread_key_t (line 394) | typedef pthread_key_t tss_t;
FILE: tests/3rdparty/glfw/include/GLFW/glfw3.h
type GLFWmonitor (line 564) | typedef struct GLFWmonitor GLFWmonitor;
type GLFWwindow (line 572) | typedef struct GLFWwindow GLFWwindow;
type GLFWvidmode (line 793) | typedef struct
type GLFWgammaramp (line 823) | typedef struct
FILE: tests/3rdparty/glfw/src/clipboard.c
function GLFWAPI (line 40) | GLFWAPI void glfwSetClipboardString(GLFWwindow* handle, const char* string)
function GLFWAPI (line 47) | GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle)
FILE: tests/3rdparty/glfw/src/cocoa_gamma.c
function _glfwPlatformGetGammaRamp (line 43) | void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
function _glfwPlatformSetGammaRamp (line 67) | void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaram...
FILE: tests/3rdparty/glfw/src/cocoa_platform.h
type _GLFWwindowNS (line 67) | typedef struct _GLFWwindowNS
type _GLFWjoy (line 79) | typedef struct
type _GLFWlibraryNS (line 99) | typedef struct _GLFWlibraryNS
type _GLFWmonitorNS (line 122) | typedef struct _GLFWmonitorNS
FILE: tests/3rdparty/glfw/src/cocoa_time.c
function getRawTime (line 37) | static uint64_t getRawTime(void)
function _glfwInitTimer (line 49) | void _glfwInitTimer(void)
function _glfwPlatformGetTime (line 63) | double _glfwPlatformGetTime(void)
function _glfwPlatformSetTime (line 69) | void _glfwPlatformSetTime(double time)
FILE: tests/3rdparty/glfw/src/context.c
function GLboolean (line 41) | static GLboolean parseGLVersion(int* api, int* major, int* minor, int* rev)
function GLboolean (line 93) | GLboolean _glfwIsValidContextConfig(_GLFWwndconfig* wndconfig)
function _GLFWfbconfig (line 207) | const _GLFWfbconfig* _glfwChooseFBConfig(const _GLFWfbconfig* desired,
function GLboolean (line 364) | GLboolean _glfwRefreshContextAttribs(void)
function GLboolean (line 464) | GLboolean _glfwIsValidContext(_GLFWwndconfig* wndconfig)
function _glfwStringInExtensionString (line 486) | int _glfwStringInExtensionString(const char* string, const GLubyte* exte...
function GLFWAPI (line 520) | GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle)
function GLFWAPI (line 532) | GLFWAPI GLFWwindow* glfwGetCurrentContext(void)
function GLFWAPI (line 538) | GLFWAPI void glfwSwapBuffers(GLFWwindow* handle)
function GLFWAPI (line 545) | GLFWAPI void glfwSwapInterval(int interval)
function GLFWAPI (line 558) | GLFWAPI int glfwExtensionSupported(const char* extension)
function GLFWAPI (line 614) | GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname)
FILE: tests/3rdparty/glfw/src/egl_context.c
function getConfigAttrib (line 105) | static int getConfigAttrib(EGLConfig config, int attrib)
function GLboolean (line 114) | static GLboolean chooseFBConfigs(const _GLFWwndconfig* wndconfig,
function _glfwInitContextAPI (line 211) | int _glfwInitContextAPI(void)
function _glfwTerminateContextAPI (line 240) | void _glfwTerminateContextAPI(void)
function _glfwCreateContext (line 254) | int _glfwCreateContext(_GLFWwindow* window,
function _glfwDestroyContext (line 418) | void _glfwDestroyContext(_GLFWwindow* window)
function _glfwAnalyzeContext (line 443) | int _glfwAnalyzeContext(const _GLFWwindow* window,
function _glfwPlatformMakeContextCurrent (line 459) | void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
function _GLFWwindow (line 491) | _GLFWwindow* _glfwPlatformGetCurrentContext(void)
function _glfwPlatformSwapBuffers (line 496) | void _glfwPlatformSwapBuffers(_GLFWwindow* window)
function _glfwPlatformSwapInterval (line 501) | void _glfwPlatformSwapInterval(int interval)
function _glfwPlatformExtensionSupported (line 506) | int _glfwPlatformExtensionSupported(const char* extension)
function GLFWglproc (line 520) | GLFWglproc _glfwPlatformGetProcAddress(const char* procname)
function GLFWAPI (line 530) | GLFWAPI EGLDisplay glfwGetEGLDisplay(void)
function GLFWAPI (line 536) | GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* handle)
function GLFWAPI (line 543) | GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle)
FILE: tests/3rdparty/glfw/src/egl_platform.h
type _GLFWcontextEGL (line 58) | typedef struct _GLFWcontextEGL
type _GLFWlibraryEGL (line 73) | typedef struct _GLFWlibraryEGL
FILE: tests/3rdparty/glfw/src/gamma.c
function _glfwAllocGammaRamp (line 45) | void _glfwAllocGammaRamp(GLFWgammaramp* ramp, unsigned int size)
function _glfwFreeGammaRamp (line 53) | void _glfwFreeGammaRamp(GLFWgammaramp* ramp)
function GLFWAPI (line 67) | GLFWAPI void glfwSetGamma(GLFWmonitor* handle, float gamma)
function GLFWAPI (line 108) | GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle)
function GLFWAPI (line 120) | GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ...
FILE: tests/3rdparty/glfw/src/glx_context.c
function errorHandler (line 50) | static int errorHandler(Display *display, XErrorEvent* event)
function getFBConfigAttrib (line 59) | static int getFBConfigAttrib(GLXFBConfig fbconfig, int attrib)
function GLboolean (line 76) | static GLboolean chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfi...
function GLXContext (line 182) | static GLXContext createLegacyContext(_GLFWwindow* window,
function _glfwInitContextAPI (line 211) | int _glfwInitContextAPI(void)
function _glfwTerminateContextAPI (line 339) | void _glfwTerminateContextAPI(void)
function _glfwCreateContext (line 362) | int _glfwCreateContext(_GLFWwindow* window,
function _glfwDestroyContext (line 539) | void _glfwDestroyContext(_GLFWwindow* window)
function _glfwPlatformMakeContextCurrent (line 559) | void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
function _GLFWwindow (line 573) | _GLFWwindow* _glfwPlatformGetCurrentContext(void)
function _glfwPlatformSwapBuffers (line 578) | void _glfwPlatformSwapBuffers(_GLFWwindow* window)
function _glfwPlatformSwapInterval (line 583) | void _glfwPlatformSwapInterval(int interval)
function _glfwPlatformExtensionSupported (line 602) | int _glfwPlatformExtensionSupported(const char* extension)
function GLFWglproc (line 618) | GLFWglproc _glfwPlatformGetProcAddress(const char* procname)
function GLFWAPI (line 628) | GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* handle)
FILE: tests/3rdparty/glfw/src/glx_platform.h
type _GLFWcontextGLX (line 79) | typedef struct _GLFWcontextGLX
type _GLFWlibraryGLX (line 90) | typedef struct _GLFWlibraryGLX
FILE: tests/3rdparty/glfw/src/init.c
function _glfwInputError (line 87) | void _glfwInputError(int error, const char* format, ...)
function GLFWAPI (line 120) | GLFWAPI int glfwInit(void)
function GLFWAPI (line 149) | GLFWAPI void glfwTerminate(void)
function GLFWAPI (line 176) | GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev)
function GLFWAPI (line 188) | GLFWAPI const char* glfwGetVersionString(void)
function GLFWAPI (line 193) | GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun)
FILE: tests/3rdparty/glfw/src/input.c
function setCursorMode (line 39) | static void setCursorMode(_GLFWwindow* window, int newMode)
function setStickyKeys (line 78) | static void setStickyKeys(_GLFWwindow* window, int enabled)
function setStickyMouseButtons (line 100) | static void setStickyMouseButtons(_GLFWwindow* window, int enabled)
function _glfwInputKey (line 125) | void _glfwInputKey(_GLFWwindow* window, int key, int scancode, int actio...
function _glfwInputChar (line 150) | void _glfwInputChar(_GLFWwindow* window, unsigned int character)
function _glfwInputScroll (line 162) | void _glfwInputScroll(_GLFWwindow* window, double xoffset, double yoffset)
function _glfwInputMouseClick (line 168) | void _glfwInputMouseClick(_GLFWwindow* window, int button, int action, i...
function _glfwInputCursorMotion (line 183) | void _glfwInputCursorMotion(_GLFWwindow* window, double x, double y)
function _glfwInputCursorEnter (line 210) | void _glfwInputCursorEnter(_GLFWwindow* window, int entered)
function GLFWAPI (line 221) | GLFWAPI int glfwGetInputMode(GLFWwindow* handle, int mode)
function GLFWAPI (line 241) | GLFWAPI void glfwSetInputMode(GLFWwindow* handle, int mode, int value)
function GLFWAPI (line 264) | GLFWAPI int glfwGetKey(GLFWwindow* handle, int key)
function GLFWAPI (line 286) | GLFWAPI int glfwGetMouseButton(GLFWwindow* handle, int button)
function GLFWAPI (line 309) | GLFWAPI void glfwGetCursorPos(GLFWwindow* handle, double* xpos, double* ...
function GLFWAPI (line 322) | GLFWAPI void glfwSetCursorPos(GLFWwindow* handle, double xpos, double ypos)
function GLFWAPI (line 347) | GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* handle, GLFWkeyfun cbfun)
function GLFWAPI (line 359) | GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* handle, GLFWcharfun ...
function GLFWAPI (line 371) | GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* handle,
function GLFWAPI (line 384) | GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* handle,
function GLFWAPI (line 397) | GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* handle,
function GLFWAPI (line 410) | GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* handle,
FILE: tests/3rdparty/glfw/src/internal.h
type _GLFWhints (line 60) | typedef struct _GLFWhints _GLFWhints;
type _GLFWwndconfig (line 61) | typedef struct _GLFWwndconfig _GLFWwndconfig;
type _GLFWfbconfig (line 62) | typedef struct _GLFWfbconfig _GLFWfbconfig;
type _GLFWwindow (line 63) | typedef struct _GLFWwindow _GLFWwindow;
type _GLFWlibrary (line 64) | typedef struct _GLFWlibrary _GLFWlibrary;
type _GLFWmonitor (line 65) | typedef struct _GLFWmonitor _GLFWmonitor;
type _GLFWwndconfig (line 134) | struct _GLFWwndconfig
type _GLFWfbconfig (line 162) | struct _GLFWfbconfig
type _GLFWwindow (line 186) | struct _GLFWwindow
type _GLFWmonitor (line 243) | struct _GLFWmonitor
type _GLFWlibrary (line 264) | struct _GLFWlibrary
FILE: tests/3rdparty/glfw/src/joystick.c
function GLFWAPI (line 38) | GLFWAPI int glfwJoystickPresent(int joy)
function GLFWAPI (line 51) | GLFWAPI const float* glfwGetJoystickAxes(int joy, int* count)
function GLFWAPI (line 81) | GLFWAPI const char* glfwGetJoystickName(int joy)
FILE: tests/3rdparty/glfw/src/monitor.c
function compareVideoModes (line 45) | static int compareVideoModes(const void* firstPtr, const void* secondPtr)
function refreshVideoModes (line 78) | static int refreshVideoModes(_GLFWmonitor* monitor)
function _glfwInputMonitorChange (line 104) | void _glfwInputMonitorChange(void)
function _GLFWmonitor (line 181) | _GLFWmonitor* _glfwCreateMonitor(const char* name, int widthMM, int heig...
function _glfwDestroyMonitor (line 191) | void _glfwDestroyMonitor(_GLFWmonitor* monitor)
function _glfwDestroyMonitors (line 204) | void _glfwDestroyMonitors(_GLFWmonitor** monitors, int count)
function GLFWvidmode (line 214) | const GLFWvidmode* _glfwChooseVideoMode(_GLFWmonitor* monitor,
function _glfwCompareVideoModes (line 258) | int _glfwCompareVideoModes(const GLFWvidmode* first, const GLFWvidmode* ...
function _glfwSplitBPP (line 263) | void _glfwSplitBPP(int bpp, int* red, int* green, int* blue)
function GLFWAPI (line 287) | GLFWAPI GLFWmonitor** glfwGetMonitors(int* count)
function GLFWAPI (line 297) | GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void)
function GLFWAPI (line 303) | GLFWAPI void glfwGetMonitorPos(GLFWmonitor* handle, int* xpos, int* ypos)
function GLFWAPI (line 310) | GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* handle, int* width,...
function GLFWAPI (line 322) | GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle)
function GLFWAPI (line 329) | GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun)
function GLFWAPI (line 339) | GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* c...
function GLFWAPI (line 354) | GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* handle)
FILE: tests/3rdparty/glfw/src/nsgl_platform.h
type _GLFWcontextNSGL (line 46) | typedef struct _GLFWcontextNSGL
type _GLFWlibraryNSGL (line 56) | typedef struct _GLFWlibraryNSGL
FILE: tests/3rdparty/glfw/src/time.c
function GLFWAPI (line 38) | GLFWAPI double glfwGetTime(void)
function GLFWAPI (line 44) | GLFWAPI void glfwSetTime(double time)
FILE: tests/3rdparty/glfw/src/wgl_context.c
function initWGLExtensions (line 44) | static void initWGLExtensions(_GLFWwindow* window)
function getPixelFormatAttrib (line 130) | static int getPixelFormatAttrib(_GLFWwindow* window, int pixelFormat, in...
function GLboolean (line 147) | static GLboolean choosePixelFormat(_GLFWwindow* window,
function _glfwInitContextAPI (line 298) | int _glfwInitContextAPI(void)
function _glfwTerminateContextAPI (line 315) | void _glfwTerminateContextAPI(void)
function _glfwCreateContext (line 330) | int _glfwCreateContext(_GLFWwindow* window,
function _glfwDestroyContext (line 467) | void _glfwDestroyContext(_GLFWwindow* window)
function _glfwAnalyzeContext (line 484) | int _glfwAnalyzeContext(const _GLFWwindow* window,
function _glfwPlatformMakeContextCurrent (line 569) | void _glfwPlatformMakeContextCurrent(_GLFWwindow* window)
function _GLFWwindow (line 579) | _GLFWwindow* _glfwPlatformGetCurrentContext(void)
function _glfwPlatformSwapBuffers (line 584) | void _glfwPlatformSwapBuffers(_GLFWwindow* window)
function _glfwPlatformSwapInterval (line 589) | void _glfwPlatformSwapInterval(int interval)
function _glfwPlatformExtensionSupported (line 604) | int _glfwPlatformExtensionSupported(const char* extension)
function GLFWglproc (line 633) | GLFWglproc _glfwPlatformGetProcAddress(const char* procname)
function GLFWAPI (line 643) | GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* handle)
FILE: tests/3rdparty/glfw/src/wgl_platform.h
type _GLFWcontextWGL (line 52) | typedef struct _GLFWcontextWGL
type _GLFWlibraryWGL (line 78) | typedef struct _GLFWlibraryWGL
FILE: tests/3rdparty/glfw/src/win32_clipboard.c
function _glfwPlatformSetClipboardString (line 42) | void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* st...
FILE: tests/3rdparty/glfw/src/win32_gamma.c
function _glfwPlatformGetGammaRamp (line 39) | void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
function _glfwPlatformSetGammaRamp (line 60) | void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaram...
FILE: tests/3rdparty/glfw/src/win32_init.c
function BOOL (line 46) | BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
function GLboolean (line 55) | static GLboolean initLibraries(void)
function freeLibraries (line 101) | static void freeLibraries(void)
function BOOL (line 119) | BOOL _glfwIsCompositionEnabled(void)
function WCHAR (line 134) | WCHAR* _glfwCreateWideStringFromUTF8(const char* source)
function _glfwPlatformInit (line 181) | int _glfwPlatformInit(void)
function _glfwPlatformTerminate (line 213) | void _glfwPlatformTerminate(void)
FILE: tests/3rdparty/glfw/src/win32_joystick.c
function calcJoystickPos (line 42) | static float calcJoystickPos(DWORD pos, DWORD min, DWORD max)
function _glfwInitJoysticks (line 58) | void _glfwInitJoysticks(void)
function _glfwTerminateJoysticks (line 64) | void _glfwTerminateJoysticks(void)
function _glfwPlatformJoystickPresent (line 77) | int _glfwPlatformJoystickPresent(int joy)
FILE: tests/3rdparty/glfw/src/win32_monitor.c
function GLboolean (line 53) | GLboolean _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* de...
function _glfwRestoreVideoMode (line 92) | void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
function _GLFWmonitor (line 103) | _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
function GLboolean (line 184) | GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* ...
function _glfwPlatformGetMonitorPos (line 189) | void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* y...
function GLFWvidmode (line 206) | GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
function _glfwPlatformGetVideoMode (line 270) | void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
FILE: tests/3rdparty/glfw/src/win32_platform.h
type LPJOYCAPS (line 86) | typedef MMRESULT (WINAPI * JOYGETDEVCAPS_T) (UINT,LPJOYCAPS,UINT);
type _GLFWwindowWin32 (line 147) | typedef struct _GLFWwindowWin32
type _GLFWlibraryWin32 (line 165) | typedef struct _GLFWlibraryWin32
type _GLFWmonitorWin32 (line 214) | typedef struct _GLFWmonitorWin32
FILE: tests/3rdparty/glfw/src/win32_time.c
function _glfwInitTimer (line 40) | void _glfwInitTimer(void)
function _glfwPlatformGetTime (line 63) | double _glfwPlatformGetTime(void)
function _glfwPlatformSetTime (line 79) | void _glfwPlatformSetTime(double t)
FILE: tests/3rdparty/glfw/src/win32_window.c
function updateClipRect (line 42) | static void updateClipRect(_GLFWwindow* window)
function hideCursor (line 53) | static void hideCursor(_GLFWwindow* window)
function captureCursor (line 75) | static void captureCursor(_GLFWwindow* window)
function showCursor (line 89) | static void showCursor(_GLFWwindow* window)
function getKeyMods (line 111) | static int getKeyMods(void)
function getAsyncKeyMods (line 129) | static int getAsyncKeyMods(void)
function translateKey (line 147) | static int translateKey(WPARAM wParam, LPARAM lParam)
function LRESULT (line 371) | static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
function getFullWindowSize (line 725) | static void getFullWindowSize(_GLFWwindow* window,
function ATOM (line 738) | static ATOM registerWindowClass(void)
function createWindow (line 775) | static int createWindow(_GLFWwindow* window,
function destroyWindow (line 851) | static void destroyWindow(_GLFWwindow* window)
function _glfwPlatformCreateWindow (line 867) | int _glfwPlatformCreateWindow(_GLFWwindow* window,
function _glfwPlatformDestroyWindow (line 933) | void _glfwPlatformDestroyWindow(_GLFWwindow* window)
function _glfwPlatformSetWindowTitle (line 941) | void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
function _glfwPlatformGetWindowPos (line 955) | void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
function _glfwPlatformSetWindowPos (line 966) | void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
function _glfwPlatformGetWindowSize (line 975) | void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* he...
function _glfwPlatformSetWindowSize (line 986) | void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
function _glfwPlatformGetFramebufferSize (line 1009) | void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, in...
function _glfwPlatformIconifyWindow (line 1014) | void _glfwPlatformIconifyWindow(_GLFWwindow* window)
function _glfwPlatformRestoreWindow (line 1019) | void _glfwPlatformRestoreWindow(_GLFWwindow* window)
function _glfwPlatformShowWindow (line 1024) | void _glfwPlatformShowWindow(_GLFWwindow* window)
function _glfwPlatformHideWindow (line 1032) | void _glfwPlatformHideWindow(_GLFWwindow* window)
function _glfwPlatformPollEvents (line 1037) | void _glfwPlatformPollEvents(void)
function _glfwPlatformWaitEvents (line 1096) | void _glfwPlatformWaitEvents(void)
function _glfwPlatformSetCursorPos (line 1103) | void _glfwPlatformSetCursorPos(_GLFWwindow* window, double xpos, double ...
function _glfwPlatformSetCursorMode (line 1113) | void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
function GLFWAPI (line 1134) | GLFWAPI HWND glfwGetWin32Window(GLFWwindow* handle)
FILE: tests/3rdparty/glfw/src/window.c
function Max (line 43) | static int Max(int a, int b)
function _glfwInputWindowFocus (line 53) | void _glfwInputWindowFocus(_GLFWwindow* window, GLboolean focused)
function _glfwInputWindowPos (line 93) | void _glfwInputWindowPos(_GLFWwindow* window, int x, int y)
function _glfwInputWindowSize (line 99) | void _glfwInputWindowSize(_GLFWwindow* window, int width, int height)
function _glfwInputWindowIconify (line 105) | void _glfwInputWindowIconify(_GLFWwindow* window, int iconified)
function _glfwInputFramebufferSize (line 116) | void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height)
function _glfwInputWindowVisibility (line 122) | void _glfwInputWindowVisibility(_GLFWwindow* window, int visible)
function _glfwInputWindowDamage (line 127) | void _glfwInputWindowDamage(_GLFWwindow* window)
function _glfwInputWindowCloseRequest (line 133) | void _glfwInputWindowCloseRequest(_GLFWwindow* window)
function GLFWAPI (line 146) | GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
function glfwDefaultWindowHints (line 267) | void glfwDefaultWindowHints(void)
function GLFWAPI (line 291) | GLFWAPI void glfwWindowHint(int target, int hint)
function GLFWAPI (line 378) | GLFWAPI void glfwDestroyWindow(GLFWwindow* handle)
function GLFWAPI (line 415) | GLFWAPI int glfwWindowShouldClose(GLFWwindow* handle)
function GLFWAPI (line 422) | GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* handle, int value)
function GLFWAPI (line 429) | GLFWAPI void glfwSetWindowTitle(GLFWwindow* handle, const char* title)
function GLFWAPI (line 436) | GLFWAPI void glfwGetWindowPos(GLFWwindow* handle, int* xpos, int* ypos)
function GLFWAPI (line 443) | GLFWAPI void glfwSetWindowPos(GLFWwindow* handle, int xpos, int ypos)
function GLFWAPI (line 459) | GLFWAPI void glfwGetWindowSize(GLFWwindow* handle, int* width, int* height)
function GLFWAPI (line 466) | GLFWAPI void glfwSetWindowSize(GLFWwindow* handle, int width, int height)
function GLFWAPI (line 484) | GLFWAPI void glfwGetFramebufferSize(GLFWwindow* handle, int* width, int*...
function GLFWAPI (line 493) | GLFWAPI void glfwIconifyWindow(GLFWwindow* handle)
function GLFWAPI (line 505) | GLFWAPI void glfwRestoreWindow(GLFWwindow* handle)
function GLFWAPI (line 517) | GLFWAPI void glfwShowWindow(GLFWwindow* handle)
function GLFWAPI (line 529) | GLFWAPI void glfwHideWindow(GLFWwindow* handle)
function GLFWAPI (line 541) | GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
function GLFWAPI (line 581) | GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* handle)
function GLFWAPI (line 588) | GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* handle, void* pointer)
function GLFWAPI (line 595) | GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* handle)
function GLFWAPI (line 602) | GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* handle,
function GLFWAPI (line 615) | GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* handle,
function GLFWAPI (line 628) | GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* handle,
function GLFWAPI (line 641) | GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* ha...
function GLFWAPI (line 654) | GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* handle,
function GLFWAPI (line 667) | GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* ha...
function GLFWAPI (line 680) | GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow...
function GLFWAPI (line 693) | GLFWAPI void glfwPollEvents(void)
function GLFWAPI (line 699) | GLFWAPI void glfwWaitEvents(void)
FILE: tests/3rdparty/glfw/src/x11_clipboard.c
function Bool (line 40) | static Bool isSelectionMessage(Display* display, XEvent* event, XPointer...
function Atom (line 49) | static Atom writeTargetToProperty(const XSelectionRequestEvent* request)
function _glfwHandleSelectionClear (line 185) | void _glfwHandleSelectionClear(XEvent* event)
function _glfwHandleSelectionRequest (line 191) | void _glfwHandleSelectionRequest(XEvent* event)
function _glfwPushSelectionToManager (line 209) | void _glfwPushSelectionToManager(_GLFWwindow* window)
function _glfwPlatformSetClipboardString (line 257) | void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* st...
FILE: tests/3rdparty/glfw/src/x11_gamma.c
function _glfwInitGammaRamp (line 42) | void _glfwInitGammaRamp(void)
function _glfwPlatformGetGammaRamp (line 73) | void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
function _glfwPlatformSetGammaRamp (line 103) | void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaram...
FILE: tests/3rdparty/glfw/src/x11_init.c
function translateKey (line 42) | static int translateKey(int keyCode)
function updateKeyCodeLUT (line 220) | static void updateKeyCodeLUT(void)
function Atom (line 320) | static Atom getSupportedAtom(Atom* supportedAtoms,
function detectEWMH (line 341) | static void detectEWMH(void)
function GLboolean (line 423) | static GLboolean initDisplay(void)
function Cursor (line 559) | static Cursor createNULLCursor(void)
function terminateDisplay (line 587) | static void terminateDisplay(void)
function _glfwPlatformInit (line 601) | int _glfwPlatformInit(void)
function _glfwPlatformTerminate (line 623) | void _glfwPlatformTerminate(void)
FILE: tests/3rdparty/glfw/src/x11_joystick.c
function openJoystickDevice (line 50) | static int openJoystickDevice(int joy, const char* path)
function pollJoystickEvents (line 94) | static void pollJoystickEvents(void)
function _glfwInitJoysticks (line 162) | int _glfwInitJoysticks(void)
function _glfwTerminateJoysticks (line 212) | void _glfwTerminateJoysticks(void)
function _glfwPlatformJoystickPresent (line 237) | int _glfwPlatformJoystickPresent(int joy)
FILE: tests/3rdparty/glfw/src/x11_monitor.c
function calculateRefreshRate (line 38) | static int calculateRefreshRate(const XRRModeInfo* mi)
function XRRModeInfo (line 46) | static const XRRModeInfo* getModeInfo(const XRRScreenResources* sr, RRMo...
function _glfwSetVideoMode (line 66) | void _glfwSetVideoMode(_GLFWmonitor* monitor, const GLFWvidmode* desired)
function _glfwRestoreVideoMode (line 136) | void _glfwRestoreVideoMode(_GLFWmonitor* monitor)
function _GLFWmonitor (line 165) | _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
function GLboolean (line 262) | GLboolean _glfwPlatformIsSameMonitor(_GLFWmonitor* first, _GLFWmonitor* ...
function _glfwPlatformGetMonitorPos (line 267) | void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* y...
function GLFWvidmode (line 294) | GLFWvidmode* _glfwPlatformGetVideoModes(_GLFWmonitor* monitor, int* found)
function _glfwPlatformGetVideoMode (line 370) | void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
FILE: tests/3rdparty/glfw/src/x11_platform.h
type _GLFWwindowX11 (line 78) | typedef struct _GLFWwindowX11
type _GLFWlibraryX11 (line 104) | typedef struct _GLFWlibraryX11
type _GLFWmonitorX11 (line 209) | typedef struct _GLFWmonitorX11
FILE: tests/3rdparty/glfw/src/x11_time.c
function getRawTime (line 39) | static uint64_t getRawTime(void)
function _glfwInitTimer (line 66) | void _glfwInitTimer(void)
function _glfwPlatformGetTime (line 90) | double _glfwPlatformGetTime(void)
function _glfwPlatformSetTime (line 96) | void _glfwPlatformSetTime(double time)
FILE: tests/3rdparty/glfw/src/x11_unicode.c
type codepair (line 70) | struct codepair {
function _glfwKeySym2Unicode (line 860) | long _glfwKeySym2Unicode( KeySym keysym )
FILE: tests/3rdparty/glfw/src/x11_window.c
type MotifWmHints (line 49) | typedef struct
function translateState (line 63) | static int translateState(int state)
function translateKey (line 81) | static int translateKey(int keycode)
function translateChar (line 92) | static int translateChar(XKeyEvent* event)
function GLboolean (line 105) | static GLboolean createWindow(_GLFWwindow* window,
function hideCursor (line 302) | static void hideCursor(_GLFWwindow* window)
function captureCursor (line 322) | static void captureCursor(_GLFWwindow* window)
function showCursor (line 341) | static void showCursor(_GLFWwindow* window)
function enterFullscreenMode (line 362) | static void enterFullscreenMode(_GLFWwindow* window)
function leaveFullscreenMode (line 454) | static void leaveFullscreenMode(_GLFWwindow* window)
function processEvent (line 499) | static void processEvent(XEvent *event)
function _GLFWwindow (line 847) | _GLFWwindow* _glfwFindWindowByHandle(Window handle)
function _glfwGetWindowProperty (line 865) | unsigned long _glfwGetWindowProperty(Window window,
function _glfwPlatformCreateWindow (line 898) | int _glfwPlatformCreateWindow(_GLFWwindow* window,
function _glfwPlatformDestroyWindow (line 917) | void _glfwPlatformDestroyWindow(_GLFWwindow* window)
function _glfwPlatformSetWindowTitle (line 945) | void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
function _glfwPlatformGetWindowPos (line 980) | void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
function _glfwPlatformSetWindowPos (line 994) | void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
function _glfwPlatformGetWindowSize (line 1000) | void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* he...
function _glfwPlatformSetWindowSize (line 1011) | void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
function _glfwPlatformGetFramebufferSize (line 1045) | void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, in...
function _glfwPlatformIconifyWindow (line 1050) | void _glfwPlatformIconifyWindow(_GLFWwindow* window)
function _glfwPlatformRestoreWindow (line 1062) | void _glfwPlatformRestoreWindow(_GLFWwindow* window)
function _glfwPlatformShowWindow (line 1074) | void _glfwPlatformShowWindow(_GLFWwindow* window)
function _glfwPlatformHideWindow (line 1080) | void _glfwPlatformHideWindow(_GLFWwindow* window)
function _glfwPlatformPollEvents (line 1086) | void _glfwPlatformPollEvents(void)
function _glfwPlatformWaitEvents (line 1117) | void _glfwPlatformWaitEvents(void)
function _glfwPlatformSetCursorPos (line 1139) | void _glfwPlatformSetCursorPos(_GLFWwindow* window, double x, double y)
function _glfwPlatformSetCursorMode (line 1149) | void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
function GLFWAPI (line 1170) | GLFWAPI Display* glfwGetX11Display(void)
function GLFWAPI (line 1176) | GLFWAPI Window glfwGetX11Window(GLFWwindow* handle)
FILE: tests/3rdparty/stb/stb_image.h
type stbi_uc (line 396) | typedef unsigned char stbi_uc;
type stbi_io_callbacks (line 417) | typedef struct
type stbi__uint16 (line 582) | typedef unsigned short stbi__uint16;
type stbi__int16 (line 583) | typedef signed short stbi__int16;
type stbi__uint32 (line 584) | typedef unsigned int stbi__uint32;
type stbi__int32 (line 585) | typedef signed int stbi__int32;
type stbi__uint16 (line 588) | typedef uint16_t stbi__uint16;
type stbi__int16 (line 589) | typedef int16_t stbi__int16;
type stbi__uint32 (line 590) | typedef uint32_t stbi__uint32;
type stbi__int32 (line 591) | typedef int32_t stbi__int32;
function stbi__cpuid3 (line 643) | static int stbi__cpuid3(void)
function stbi__sse2_available (line 664) | static int stbi__sse2_available()
function stbi__sse2_available (line 672) | static int stbi__sse2_available()
type stbi__context (line 707) | typedef struct
function stbi__start_mem (line 727) | static void stbi__start_mem(stbi__context *s, stbi_uc const *buffer, int...
function stbi__start_callbacks (line 736) | static void stbi__start_callbacks(stbi__context *s, stbi_io_callbacks *c...
function stbi__stdio_read (line 748) | static int stbi__stdio_read(void *user, char *data, int size)
function stbi__stdio_skip (line 753) | static void stbi__stdio_skip(void *user, int n)
function stbi__stdio_eof (line 758) | static int stbi__stdio_eof(void *user)
function stbi__start_file (line 770) | static void stbi__start_file(stbi__context *s, FILE *f)
function stbi__rewind (line 779) | static void stbi__rewind(stbi__context *s)
function STBIDEF (line 844) | STBIDEF const char *stbi_failure_reason(void)
function stbi__err (line 849) | static int stbi__err(const char *str)
function STBIDEF (line 875) | STBIDEF void stbi_image_free(void *retval_from_stbi_load)
function FILE (line 930) | static FILE *stbi__fopen(char const *filename, char const *mode)
function STBIDEF (line 943) | STBIDEF stbi_uc *stbi_load(char const *filename, int *x, int *y, int *co...
function STBIDEF (line 953) | STBIDEF stbi_uc *stbi_load_from_file(FILE *f, int *x, int *y, int *comp,...
function STBIDEF (line 967) | STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, i...
function STBIDEF (line 974) | STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk,...
function STBIDEF (line 995) | STBIDEF float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, in...
function STBIDEF (line 1002) | STBIDEF float *stbi_loadf_from_callbacks(stbi_io_callbacks const *clbk, ...
function STBIDEF (line 1010) | STBIDEF float *stbi_loadf(char const *filename, int *x, int *y, int *com...
function STBIDEF (line 1020) | STBIDEF float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, ...
function STBIDEF (line 1034) | STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len)
function STBIDEF (line 1048) | STBIDEF int stbi_is_hdr (char const *filename)
function STBIDEF (line 1059) | STBIDEF int stbi_is_hdr_from_file(FILE *f)
function STBIDEF (line 1071) | STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clb...
function STBIDEF (line 1086) | STBIDEF void stbi_ldr_to_hdr_gamma(float gamma) { stbi__l2h_gamma = ga...
function STBIDEF (line 1087) | STBIDEF void stbi_ldr_to_hdr_scale(float scale) { stbi__l2h_scale = sc...
function STBIDEF (line 1090) | STBIDEF void stbi_hdr_to_ldr_gamma(float gamma) { stbi__h2l_gamma_i = ...
function STBIDEF (line 1091) | STBIDEF void stbi_hdr_to_ldr_scale(float scale) { stbi__h2l_scale_i = ...
function stbi__refill_buffer (line 1106) | static void stbi__refill_buffer(stbi__context *s)
function stbi_inline (line 1122) | stbi_inline static stbi_uc stbi__get8(stbi__context *s)
function stbi_inline (line 1133) | stbi_inline static int stbi__at_eof(stbi__context *s)
function stbi__skip (line 1145) | static void stbi__skip(stbi__context *s, int n)
function stbi__getn (line 1158) | static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n)
function stbi__get16be (line 1182) | static int stbi__get16be(stbi__context *s)
function stbi__uint32 (line 1188) | static stbi__uint32 stbi__get32be(stbi__context *s)
function stbi__get16le (line 1194) | static int stbi__get16le(stbi__context *s)
function stbi__uint32 (line 1200) | static stbi__uint32 stbi__get32le(stbi__context *s)
function stbi_uc (line 1220) | static stbi_uc stbi__compute_y(int r, int g, int b)
function stbi_uc (line 1290) | static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp)
type stbi__huffman (line 1342) | typedef struct
type stbi__jpeg (line 1353) | typedef struct
function stbi__build_huffman (line 1404) | static int stbi__build_huffman(stbi__huffman *h, int *count)
function stbi__build_fast_ac (line 1447) | static void stbi__build_fast_ac(stbi__int16 *fast_ac, stbi__huffman *h)
function stbi__grow_buffer_unsafe (line 1472) | static void stbi__grow_buffer_unsafe(stbi__jpeg *j)
function stbi_inline (line 1493) | stbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffm...
function stbi_inline (line 1547) | stbi_inline static int stbi__extend_receive(stbi__jpeg *j, int n)
function stbi_inline (line 1562) | stbi_inline static int stbi__jpeg_get_bits(stbi__jpeg *j, int n)
function stbi_inline (line 1573) | stbi_inline static int stbi__jpeg_get_bit(stbi__jpeg *j)
function stbi__jpeg_decode_block (line 1601) | static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__...
function stbi__jpeg_decode_block_prog_dc (line 1653) | static int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64]...
function stbi__jpeg_decode_block_prog_ac (line 1680) | static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64]...
function stbi_inline (line 1800) | stbi_inline static stbi_uc stbi__clamp(int x)
function stbi__idct_block (line 1851) | static void stbi__idct_block(stbi_uc *out, int out_stride, short data[64])
function stbi__idct_simd (line 1914) | static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
function stbi__idct_simd (line 2095) | static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
function stbi_uc (line 2303) | static stbi_uc stbi__get_marker(stbi__jpeg *j)
function stbi__jpeg_reset (line 2320) | static void stbi__jpeg_reset(stbi__jpeg *j)
function stbi__parse_entropy_coded_data (line 2333) | static int stbi__parse_entropy_coded_data(stbi__jpeg *z)
function stbi__jpeg_dequantize (line 2457) | static void stbi__jpeg_dequantize(short *data, stbi_uc *dequant)
function stbi__jpeg_finish (line 2464) | static void stbi__jpeg_finish(stbi__jpeg *z)
function stbi__process_marker (line 2483) | static int stbi__process_marker(stbi__jpeg *z, int m)
function stbi__process_scan_header (line 2547) | static int stbi__process_scan_header(stbi__jpeg *z)
function stbi__process_frame_header (line 2586) | static int stbi__process_frame_header(stbi__jpeg *z, int scan)
function stbi__decode_jpeg_header (line 2677) | static int stbi__decode_jpeg_header(stbi__jpeg *z, int scan)
function stbi__decode_jpeg_image (line 2700) | static int stbi__decode_jpeg_image(stbi__jpeg *j)
type stbi_uc (line 2735) | typedef stbi_uc *(*resample_row_func)(stbi_uc *out, stbi_uc *in0, stbi_u...
function stbi_uc (line 2740) | static stbi_uc *resample_row_1(stbi_uc *out, stbi_uc *in_near, stbi_uc *...
function stbi_uc (line 2749) | static stbi_uc* stbi__resample_row_v_2(stbi_uc *out, stbi_uc *in_near, s...
function stbi_uc (line 2759) | static stbi_uc* stbi__resample_row_h_2(stbi_uc *out, stbi_uc *in_near, ...
function stbi_uc (line 2789) | static stbi_uc *stbi__resample_row_hv_2(stbi_uc *out, stbi_uc *in_near, ...
function stbi_uc (line 2814) | static stbi_uc *stbi__resample_row_hv_2_simd(stbi_uc *out, stbi_uc *in_n...
function stbi_uc (line 2930) | static stbi_uc *stbi__resample_row_generic(stbi_uc *out, stbi_uc *in_nea...
function stbi__YCbCr_to_RGB_row (line 2945) | static void stbi__YCbCr_to_RGB_row(stbi_uc *out, const stbi_uc *y, const...
function stbi__YCbCr_to_RGB_row (line 2973) | static void stbi__YCbCr_to_RGB_row(stbi_uc *out, const stbi_uc *y, const...
function stbi__YCbCr_to_RGB_simd (line 3000) | static void stbi__YCbCr_to_RGB_simd(stbi_uc *out, stbi_uc const *y, stbi...
function stbi__setup_jpeg (line 3135) | static void stbi__setup_jpeg(stbi__jpeg *j)
function stbi__cleanup_jpeg (line 3161) | static void stbi__cleanup_jpeg(stbi__jpeg *j)
type stbi__resample (line 3182) | typedef struct
function stbi_uc (line 3192) | static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, i...
function stbi__jpeg_test (line 3297) | static int stbi__jpeg_test(stbi__context *s)
function stbi__jpeg_info_raw (line 3308) | static int stbi__jpeg_info_raw(stbi__jpeg *j, int *x, int *y, int *comp)
function stbi__jpeg_info (line 3320) | static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp)
type stbi__zhuffman (line 3343) | typedef struct
function stbi_inline (line 3353) | stbi_inline static int stbi__bitreverse16(int n)
function stbi_inline (line 3362) | stbi_inline static int stbi__bit_reverse(int v, int bits)
function stbi__zbuild_huffman (line 3370) | static int stbi__zbuild_huffman(stbi__zhuffman *z, stbi_uc *sizelist, in...
type stbi__zbuf (line 3422) | typedef struct
function stbi_inline (line 3436) | stbi_inline static stbi_uc stbi__zget8(stbi__zbuf *z)
function stbi__fill_bits (line 3442) | static void stbi__fill_bits(stbi__zbuf *z)
function stbi__zreceive (line 3451) | int stbi__zreceive(stbi__zbuf *z, int n)
function stbi__zhuffman_decode_slowpath (line 3461) | static int stbi__zhuffman_decode_slowpath(stbi__zbuf *a, stbi__zhuffman *z)
function stbi_inline (line 3479) | stbi_inline static int stbi__zhuffman_decode(stbi__zbuf *a, stbi__zhuffm...
function stbi__zexpand (line 3493) | static int stbi__zexpand(stbi__zbuf *z, char *zout, int n) // need to m...
function stbi__parse_huffman_block (line 3525) | static int stbi__parse_huffman_block(stbi__zbuf *a)
function stbi__compute_huffman_codes (line 3567) | static int stbi__compute_huffman_codes(stbi__zbuf *a)
function stbi__parse_uncomperssed_block (line 3613) | static int stbi__parse_uncomperssed_block(stbi__zbuf *a)
function stbi__parse_zlib_header (line 3642) | static int stbi__parse_zlib_header(stbi__zbuf *a)
function stbi__init_zdefaults (line 3657) | static void stbi__init_zdefaults(void)
function stbi__parse_zlib (line 3668) | static int stbi__parse_zlib(stbi__zbuf *a, int parse_header)
function stbi__do_zlib (line 3697) | static int stbi__do_zlib(stbi__zbuf *a, char *obuf, int olen, int exp, i...
function STBIDEF (line 3707) | STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int ...
function STBIDEF (line 3723) | STBIDEF char *stbi_zlib_decode_malloc(char const *buffer, int len, int *...
function STBIDEF (line 3728) | STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *b...
function STBIDEF (line 3744) | STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, char const ...
function STBIDEF (line 3755) | STBIDEF char *stbi_zlib_decode_noheader_malloc(char const *buffer, int l...
function STBIDEF (line 3771) | STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, co...
type stbi__pngchunk (line 3794) | typedef struct
function stbi__pngchunk (line 3800) | static stbi__pngchunk stbi__get_chunk_header(stbi__context *s)
function stbi__check_png_header (line 3808) | static int stbi__check_png_header(stbi__context *s)
type stbi__png (line 3817) | typedef struct
function stbi__paeth (line 3844) | static int stbi__paeth(int a, int b, int c)
function stbi__create_png_image_raw (line 3858) | static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__...
function stbi__create_png_image (line 4036) | static int stbi__create_png_image(stbi__png *a, stbi_uc *image_data, stb...
function stbi__compute_transparency (line 4078) | static int stbi__compute_transparency(stbi__png *z, stbi_uc tc[3], int o...
function stbi__expand_png_palette (line 4103) | static int stbi__expand_png_palette(stbi__png *a, stbi_uc *palette, int ...
function STBIDEF (line 4143) | STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpr...
function STBIDEF (line 4148) | STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_conv...
function stbi__de_iphone (line 4153) | static void stbi__de_iphone(stbi__png *z)
function stbi__parse_png_file (line 4197) | static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)
function stbi__png_test (line 4383) | static int stbi__png_test(stbi__context *s)
function stbi__png_info_raw (line 4391) | static int stbi__png_info_raw(stbi__png *p, int *x, int *y, int *comp)
function stbi__png_info (line 4403) | static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp)
function stbi__bmp_test_raw (line 4414) | static int stbi__bmp_test_raw(stbi__context *s)
function stbi__bmp_test (line 4429) | static int stbi__bmp_test(stbi__context *s)
function stbi__high_bit (line 4438) | static int stbi__high_bit(unsigned int z)
function stbi__bitcount (line 4450) | static int stbi__bitcount(unsigned int a)
function stbi__shiftsigned (line 4460) | static int stbi__shiftsigned(int v, int shift, int bits)
function stbi_uc (line 4477) | static stbi_uc *stbi__bmp_load(stbi__context *s, int *x, int *y, int *co...
function stbi__tga_info (line 4683) | static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp)
function stbi__tga_test (line 4720) | static int stbi__tga_test(stbi__context *s)
function stbi_uc (line 4745) | static stbi_uc *stbi__tga_load(stbi__context *s, int *x, int *y, int *co...
function stbi__psd_test (line 4944) | static int stbi__psd_test(stbi__context *s)
function stbi_uc (line 4951) | static stbi_uc *stbi__psd_load(stbi__context *s, int *x, int *y, int *co...
function stbi__pic_is4 (line 5118) | static int stbi__pic_is4(stbi__context *s,const char *str)
function stbi__pic_test_core (line 5128) | static int stbi__pic_test_core(stbi__context *s)
type stbi__pic_packet (line 5144) | typedef struct
function stbi_uc (line 5149) | static stbi_uc *stbi__readval(stbi__context *s, int channel, stbi_uc *dest)
function stbi__copyval (line 5163) | static void stbi__copyval(int channel,stbi_uc *dest,const stbi_uc *src)
function stbi_uc (line 5172) | static stbi_uc *stbi__pic_load_core(stbi__context *s,int width,int heigh...
function stbi_uc (line 5283) | static stbi_uc *stbi__pic_load(stbi__context *s,int *px,int *py,int *com...
function stbi__pic_test (line 5316) | static int stbi__pic_test(stbi__context *s)
type stbi__gif_lzw (line 5328) | typedef struct
type stbi__gif (line 5335) | typedef struct
function stbi__gif_test_raw (line 5352) | static int stbi__gif_test_raw(stbi__context *s)
function stbi__gif_test (line 5362) | static int stbi__gif_test(stbi__context *s)
function stbi__gif_parse_colortable (line 5369) | static void stbi__gif_parse_colortable(stbi__context *s, stbi_uc pal[256...
function stbi__gif_header (line 5380) | static int stbi__gif_header(stbi__context *s, stbi__gif *g, int *comp, i...
function stbi__gif_info_raw (line 5408) | static int stbi__gif_info_raw(stbi__context *s, int *x, int *y, int *comp)
function stbi__out_gif_code (line 5420) | static void stbi__out_gif_code(stbi__gif *g, stbi__uint16 code)
function stbi_uc (line 5454) | static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g)
function stbi__fill_gif_background (line 5533) | static void stbi__fill_gif_background(stbi__gif *g)
function stbi_uc (line 5548) | static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int ...
function stbi_uc (line 5648) | static stbi_uc *stbi__gif_load(stbi__context *s, int *x, int *y, int *co...
function stbi__gif_info (line 5664) | static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp)
function stbi__hdr_test_core (line 5674) | static int stbi__hdr_test_core(stbi__context *s)
function stbi__hdr_test (line 5684) | static int stbi__hdr_test(stbi__context* s)
function stbi__hdr_convert (line 5714) | static void stbi__hdr_convert(float *output, stbi_uc *input, int req_comp)
function stbi__hdr_info (line 5852) | static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp)
function stbi__bmp_info (line 5893) | static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp)
function stbi__psd_info (line 5923) | static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp)
function stbi__pic_info (line 5956) | static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp)
function stbi__pnm_test (line 6016) | static int stbi__pnm_test(stbi__context *s)
function stbi_uc (line 6028) | static stbi_uc *stbi__pnm_load(stbi__context *s, int *x, int *y, int *co...
function stbi__pnm_isspace (line 6048) | static int stbi__pnm_isspace(char c)
function stbi__pnm_skip_whitespace (line 6053) | static void stbi__pnm_skip_whitespace(stbi__context *s, char *c)
function stbi__pnm_isdigit (line 6059) | static int stbi__pnm_isdigit(char c)
function stbi__pnm_getinteger (line 6064) | static int stbi__pnm_getinteger(stbi__context *s, char *c)
function stbi__pnm_info (line 6076) | static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp)
function stbi__info_main (line 6111) | static int stbi__info_main(stbi__context *s, int *x, int *y, int *comp)
function STBIDEF (line 6154) | STBIDEF int stbi_info(char const *filename, int *x, int *y, int *comp)
function STBIDEF (line 6164) | STBIDEF int stbi_info_from_file(FILE *f, int *x, int *y, int *comp)
function STBIDEF (line 6176) | STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x...
function STBIDEF (line 6183) | STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *u...
FILE: tests/3rdparty/tinycthread/source/tinycthread.c
function mtx_init (line 50) | int mtx_init(mtx_t *mtx, int type)
function mtx_destroy (line 71) | void mtx_destroy(mtx_t *mtx)
function mtx_lock (line 80) | int mtx_lock(mtx_t *mtx)
function mtx_timedlock (line 95) | int mtx_timedlock(mtx_t *mtx, const struct timespec *ts)
function mtx_trylock (line 103) | int mtx_trylock(mtx_t *mtx)
function mtx_unlock (line 118) | int mtx_unlock(mtx_t *mtx)
function cnd_init (line 134) | int cnd_init(cnd_t *cond)
function cnd_destroy (line 163) | void cnd_destroy(cnd_t *cond)
function cnd_signal (line 180) | int cnd_signal(cnd_t *cond)
function cnd_broadcast (line 205) | int cnd_broadcast(cnd_t *cond)
function _cnd_timedwait_win32 (line 231) | static int _cnd_timedwait_win32(cnd_t *cond, mtx_t *mtx, DWORD timeout)
function cnd_wait (line 279) | int cnd_wait(cnd_t *cond, mtx_t *mtx)
function cnd_timedwait (line 288) | int cnd_timedwait(cnd_t *cond, mtx_t *mtx, const struct timespec *ts)
type _thread_start_info (line 313) | typedef struct {
function thrd_create (line 355) | int thrd_create(thrd_t *thr, thrd_start_t func, void *arg)
function thrd_t (line 387) | thrd_t thrd_current(void)
function thrd_detach (line 396) | int thrd_detach(thrd_t thr)
function thrd_equal (line 403) | int thrd_equal(thrd_t thr0, thrd_t thr1)
function thrd_exit (line 412) | void thrd_exit(int res)
function thrd_join (line 426) | int thrd_join(thrd_t thr, int *res)
function thrd_sleep (line 459) | int thrd_sleep(const struct timespec *time_point, struct timespec *remai...
function thrd_yield (line 506) | void thrd_yield(void)
function tss_create (line 515) | int tss_create(tss_t *key, tss_dtor_t dtor)
function tss_delete (line 537) | void tss_delete(tss_t key)
function tss_set (line 555) | int tss_set(tss_t key, void *val)
function _tthread_clock_gettime (line 572) | int _tthread_clock_gettime(clockid_t clk_id, struct timespec *ts)
FILE: tests/3rdparty/tinycthread/source/tinycthread.h
type _ttherad_timespec (line 117) | struct _ttherad_timespec {
type _tthread_clockid_t (line 125) | typedef int _tthread_clockid_t;
type timespec (line 129) | struct timespec
type mtx_t (line 187) | typedef struct {
type pthread_mutex_t (line 193) | typedef pthread_mutex_t mtx_t;
type timespec (line 227) | struct timespec
type cnd_t (line 248) | typedef struct {
type pthread_cond_t (line 254) | typedef pthread_cond_t cnd_t;
type timespec (line 313) | struct timespec
type HANDLE (line 317) | typedef HANDLE thrd_t;
type pthread_t (line 319) | typedef pthread_t thrd_t;
type timespec (line 388) | struct timespec
type timespec (line 388) | struct timespec
type DWORD (line 398) | typedef DWORD tss_t;
type pthread_key_t (line 400) | typedef pthread_key_t tss_t;
FILE: tests/raster/main.c
type m_image (line 39) | struct m_image
function draw (line 52) | void draw(void)
function main_loop (line 100) | void main_loop(void)
function main (line 107) | int main(int argc, char **argv)
FILE: tests/raytracing/main.c
type m_image (line 39) | struct m_image
type m_image (line 42) | struct m_image
type m_image (line 43) | struct m_image
function init_noise (line 45) | void init_noise(void)
function destroy_noise (line 53) | void destroy_noise(void)
function fast_noise (line 58) | float fast_noise(float x, float y, float z)
function draw (line 75) | static void draw(void)
function main_loop (line 211) | void main_loop(void)
function main (line 218) | int main(int argc, char **argv)
FILE: tests/test.h
function m_image_float_to_srgb (line 183) | static void m_image_float_to_srgb(struct m_image *dest, const struct m_i...
function close_callback (line 224) | static void close_callback(GLFWwindow * window)
function size_callback (line 229) | static void size_callback(GLFWwindow * window, int width, int height)
function cursorpos_callback (line 235) | static void cursorpos_callback(GLFWwindow * window, double x, double y)
function key_callback (line 241) | static void key_callback(GLFWwindow* window, int key, int scancode, int ...
function mousebutton_callback (line 249) | static void mousebutton_callback(GLFWwindow * window, int button, int ac...
function char_callback (line 257) | static void char_callback(GLFWwindow * window, unsigned int key)
function test_get_chars (line 265) | int test_get_chars(unsigned int dest[TEST_CHAR_MAX])
function test_key_press (line 272) | int test_key_press(int key)
function test_key_release (line 277) | int test_key_release(int key)
function test_key_pressed (line 282) | int test_key_pressed(int key)
function test_mouse_button_press (line 287) | int test_mouse_button_press(int button)
function test_mouse_button_release (line 292) | int test_mouse_button_release(int button)
function test_mouse_button_pressed (line 297) | int test_mouse_button_pressed(int button)
function draw_texture (line 302) | static void draw_texture(GLuint texture)
function updateGL (line 319) | static void updateGL(void)
function test_setup_texture (line 335) | void test_setup_texture(int width, int height)
function test_swap_buffer (line 345) | void test_swap_buffer(struct m_image *image)
function test_get_time (line 372) | double test_get_time(void)
function test_get_directory (line 377) | void test_get_directory(char *dest, const char *src)
function test_set_working_dir (line 389) | void test_set_working_dir(const char *dir)
function test_window_title (line 398) | void test_window_title(const char *title)
function test_window (line 404) | int test_window(const char *title, int fullscreen)
function test_create (line 448) | int test_create(const char *title, int width, int height)
function test_window_size (line 469) | void test_window_size(int width, int height)
function test_destroy (line 476) | void test_destroy(void)
function test_update (line 484) | void test_update(void)
FILE: tests/vorogen/main.c
type test_point (line 46) | struct test_point
type m_image (line 52) | struct m_image
type test_point (line 54) | struct test_point
type test_point (line 55) | struct test_point
type m_image (line 57) | struct m_image
type m_image (line 58) | struct m_image
type m_image (line 59) | struct m_image
type m_image (line 60) | struct m_image
function load_image (line 63) | static int load_image(struct m_image *dest, const char *filename)
function get_best_tournament (line 83) | static int get_best_tournament(float *error, int count, int tour_size)
function get_best_dual (line 96) | static int get_best_dual(float *error, float *energy, int POP_SIZE, floa...
function get_best_dual4 (line 125) | static int get_best_dual4(float *error, float *energy, int POP_SIZE, flo...
function mate (line 152) | static void mate(float *data, float *src1, float *src2, int s, int c)
function mutate (line 174) | static void mutate(struct test_point *pts, int size, struct m_image *src)
function gen (line 219) | static void gen(struct test_point *pts, struct m_image *src)
function get_originality (line 250) | static float get_originality(int id)
function get_score (line 275) | static float get_score(struct m_image *a, struct m_image *b)
function render (line 281) | static void render(struct m_image *dest, struct test_point *pts, int pts...
function init (line 317) | static void init(void)
function clear (line 340) | static void clear(void)
function draw (line 347) | static void draw(void)
function main_loop (line 403) | void main_loop(void)
function main (line 410) | int main(int argc, char **argv)
FILE: tests/voronoi/main.c
type test_point (line 42) | struct test_point
type m_image (line 49) | struct m_image
type test_point (line 50) | struct test_point
type m_image (line 51) | struct m_image
type m_image (line 52) | struct m_image
function init (line 55) | static void init(void)
function clear (line 69) | static void clear(void)
function animate (line 75) | static void animate(void)
function draw (line 106) | static void draw(void)
function main_loop (line 141) | void main_loop(void)
function main (line 149) | int main(int argc, char **argv)
Condensed preview — 89 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,985K chars).
[
{
"path": ".gitignore",
"chars": 257,
"preview": "# Object files\n*.o\n*.ko\n*.obj\n*.elf\n\n# Precompiled Headers\n*.gch\n*.pch\n\n# Libraries\n*.lib\n*.a\n*.la\n*.lo\n\n# Shared object"
},
{
"path": "CMake/OutOfSourceBuild.cmake",
"chars": 324,
"preview": "# Disallow in-source build\nSTRING(COMPARE EQUAL \"${CMAKE_SOURCE_DIR}\" \"${CMAKE_BINARY_DIR}\" BUILDING_IN_SOURCE)\nIF(BUILD"
},
{
"path": "CMakeLists.txt",
"chars": 3320,
"preview": "PROJECT(MTCL)\n\n## Let's use a reasonable modern version\nCMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)\nSET(CMAKE_HAS_SORT 1)\nSET"
},
{
"path": "LICENSE",
"chars": 935,
"preview": "Maratis Tiny C library\n\nCopyright (c) 2015 Anael Seghezzi <www.maratis3d.com>\r\n\r\n This software is provided 'as-is', wit"
},
{
"path": "README.md",
"chars": 3833,
"preview": "Maratis Tiny C library\r\n======================\r\n\r\nis a collection of small and efficient math and image processing routi"
},
{
"path": "build_tests_unix.sh",
"chars": 288,
"preview": "#!/bin/bash\n\ncur_dir=`dirname \"$0\"`; cur_dir=`eval \"cd \\\"$cur_dir\\\" && pwd\"`\nbuild_path=$cur_dir\"/Build\"\ninstall_path=$c"
},
{
"path": "build_tests_vs.bat",
"chars": 83,
"preview": "mkdir Build\ncd Build\ncmake -G \"Visual Studio 11\" ../ -DCMAKE_INSTALL_PREFIX=../bin\n"
},
{
"path": "include/m_dist.h",
"chars": 8940,
"preview": "/*======================================================================\n Maratis Tiny C Library\n version 1.0\n----------"
},
{
"path": "include/m_image.h",
"chars": 102420,
"preview": "/*======================================================================\r\n Maratis Tiny C Library\r\n version 1.0\r\n-------"
},
{
"path": "include/m_math.h",
"chars": 40369,
"preview": "/*======================================================================\r\n Maratis Tiny C Library\r\n version 1.0\r\n-------"
},
{
"path": "include/m_path_finding.h",
"chars": 3685,
"preview": "/*======================================================================\n Maratis Tiny C Library\n version 1.0\n----------"
},
{
"path": "include/m_raster.h",
"chars": 12103,
"preview": "/*======================================================================\r\n Maratis Tiny C Library\r\n version 1.0\r\n-------"
},
{
"path": "tests/3rdparty/CMakeLists.txt",
"chars": 52,
"preview": "ADD_SUBDIRECTORY(tinycthread)\nADD_SUBDIRECTORY(glfw)"
},
{
"path": "tests/3rdparty/glfw/CMakeLists.txt",
"chars": 1168,
"preview": "## Find source and headers\n\nFILE(GLOB SOURCES\n src/clipboard.c\n src/context.c\n src/gamma.c\n src/init.c\n src/input.c"
},
{
"path": "tests/3rdparty/glfw/COPYING.txt",
"chars": 934,
"preview": "Copyright (c) 2002-2006 Marcus Geelnard\nCopyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>\n\nThis softw"
},
{
"path": "tests/3rdparty/glfw/deps/EGL/eglext.h",
"chars": 26050,
"preview": "#ifndef __eglext_h_\n#define __eglext_h_\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n** Copyright (c) 2007-2013 The Khron"
},
{
"path": "tests/3rdparty/glfw/deps/GL/glext.h",
"chars": 726907,
"preview": "#ifndef __glext_h_\n#define __glext_h_\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n** Copyright (c) 2007-2012 The Khronos"
},
{
"path": "tests/3rdparty/glfw/deps/GL/glxext.h",
"chars": 44208,
"preview": "#ifndef __glxext_h_\n#define __glxext_h_\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n** Copyright (c) 2007-2012 The Khron"
},
{
"path": "tests/3rdparty/glfw/deps/GL/wglext.h",
"chars": 43288,
"preview": "#ifndef __wglext_h_\n#define __wglext_h_\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n** Copyright (c) 2007-2012 The Khron"
},
{
"path": "tests/3rdparty/glfw/deps/getopt.c",
"chars": 6907,
"preview": "/*****************************************************************************\n* getopt.c - competent and free getopt li"
},
{
"path": "tests/3rdparty/glfw/deps/getopt.h",
"chars": 2081,
"preview": "/*****************************************************************************\n* getopt.h - competent and free getopt li"
},
{
"path": "tests/3rdparty/glfw/deps/tinycthread.c",
"chars": 13021,
"preview": "/* -*- mode: c; tab-width: 2; indent-tabs-mode: nil; -*-\nCopyright (c) 2012 Marcus Geelnard\n\nThis software is provided '"
},
{
"path": "tests/3rdparty/glfw/deps/tinycthread.h",
"chars": 15577,
"preview": "/* -*- mode: c; tab-width: 2; indent-tabs-mode: nil; -*-\nCopyright (c) 2012 Marcus Geelnard\n\nThis software is provided '"
},
{
"path": "tests/3rdparty/glfw/include/GLFW/glfw3.h",
"chars": 79580,
"preview": "/*************************************************************************\n * GLFW - An OpenGL library\n * API version: 3"
},
{
"path": "tests/3rdparty/glfw/include/GLFW/glfw3native.h",
"chars": 5701,
"preview": "/*************************************************************************\n * GLFW - An OpenGL library\n * API version: 3"
},
{
"path": "tests/3rdparty/glfw/src/CMakeLists.txt",
"chars": 3251,
"preview": "\ninclude_directories(${GLFW_SOURCE_DIR}/src\n ${GLFW_BINARY_DIR}/src\n ${glfw_INCLUD"
},
{
"path": "tests/3rdparty/glfw/src/clipboard.c",
"chars": 1984,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: A"
},
{
"path": "tests/3rdparty/glfw/src/cocoa_clipboard.m",
"chars": 2619,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: C"
},
{
"path": "tests/3rdparty/glfw/src/cocoa_gamma.c",
"chars": 3158,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: C"
},
{
"path": "tests/3rdparty/glfw/src/cocoa_init.m",
"chars": 3873,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: C"
},
{
"path": "tests/3rdparty/glfw/src/cocoa_joystick.m",
"chars": 16684,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: C"
},
{
"path": "tests/3rdparty/glfw/src/cocoa_monitor.m",
"chars": 10983,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: C"
},
{
"path": "tests/3rdparty/glfw/src/cocoa_platform.h",
"chars": 4677,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: C"
},
{
"path": "tests/3rdparty/glfw/src/cocoa_time.c",
"chars": 2395,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: C"
},
{
"path": "tests/3rdparty/glfw/src/cocoa_window.m",
"chars": 31539,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: C"
},
{
"path": "tests/3rdparty/glfw/src/config.h",
"chars": 1945,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: A"
},
{
"path": "tests/3rdparty/glfw/src/config.h.in",
"chars": 3492,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: A"
},
{
"path": "tests/3rdparty/glfw/src/context.c",
"chars": 19772,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: A"
},
{
"path": "tests/3rdparty/glfw/src/egl_context.c",
"chars": 16934,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: E"
},
{
"path": "tests/3rdparty/glfw/src/egl_platform.h",
"chars": 2914,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: E"
},
{
"path": "tests/3rdparty/glfw/src/gamma.c",
"chars": 3829,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: A"
},
{
"path": "tests/3rdparty/glfw/src/glfw3.pc.in",
"chars": 359,
"preview": "prefix=@CMAKE_INSTALL_PREFIX@\nexec_prefix=${prefix}\nincludedir=${prefix}/include\nlibdir=${exec_prefix}/lib\n\nName: GLFW\nD"
},
{
"path": "tests/3rdparty/glfw/src/glfwConfig.cmake.in",
"chars": 447,
"preview": "# - Config file for the glfw package\n# It defines the following variables\n# GLFW_INCLUDE_DIR, the path where GLFW head"
},
{
"path": "tests/3rdparty/glfw/src/glfwConfigVersion.cmake.in",
"chars": 312,
"preview": "\nset(PACKAGE_VERSION \"@GLFW_VERSION_FULL@\")\n\nif (\"${PACKAGE_FIND_VERSION_MAJOR}\" EQUAL \"@GLFW_VERSION_MAJOR@\")\n\tset(PACK"
},
{
"path": "tests/3rdparty/glfw/src/glx_context.c",
"chars": 19991,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: X"
},
{
"path": "tests/3rdparty/glfw/src/glx_platform.h",
"chars": 4934,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: X"
},
{
"path": "tests/3rdparty/glfw/src/init.c",
"chars": 5647,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: A"
},
{
"path": "tests/3rdparty/glfw/src/input.c",
"chars": 11624,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: A"
},
{
"path": "tests/3rdparty/glfw/src/internal.h",
"chars": 24222,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: A"
},
{
"path": "tests/3rdparty/glfw/src/joystick.c",
"chars": 2729,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: A"
},
{
"path": "tests/3rdparty/glfw/src/monitor.c",
"chars": 10124,
"preview": "//========================================================================\n// GLFW - An OpenGL framework\n// Platform: "
},
{
"path": "tests/3rdparty/glfw/src/nsgl_context.m",
"chars": 9325,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: C"
},
{
"path": "tests/3rdparty/glfw/src/nsgl_platform.h",
"chars": 2471,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: N"
},
{
"path": "tests/3rdparty/glfw/src/time.c",
"chars": 1788,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: A"
},
{
"path": "tests/3rdparty/glfw/src/wgl_context.c",
"chars": 20596,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: W"
},
{
"path": "tests/3rdparty/glfw/src/wgl_platform.h",
"chars": 3632,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: W"
},
{
"path": "tests/3rdparty/glfw/src/win32_clipboard.c",
"chars": 3852,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: W"
},
{
"path": "tests/3rdparty/glfw/src/win32_gamma.c",
"chars": 3003,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: W"
},
{
"path": "tests/3rdparty/glfw/src/win32_init.c",
"chars": 7163,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: W"
},
{
"path": "tests/3rdparty/glfw/src/win32_joystick.c",
"chars": 5530,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: W"
},
{
"path": "tests/3rdparty/glfw/src/win32_monitor.c",
"chars": 8176,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: X"
},
{
"path": "tests/3rdparty/glfw/src/win32_platform.h",
"chars": 8191,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: W"
},
{
"path": "tests/3rdparty/glfw/src/win32_time.c",
"chars": 3007,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: W"
},
{
"path": "tests/3rdparty/glfw/src/win32_window.c",
"chars": 37168,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: W"
},
{
"path": "tests/3rdparty/glfw/src/window.c",
"chars": 20751,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: A"
},
{
"path": "tests/3rdparty/glfw/src/x11_clipboard.c",
"chars": 11022,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: X"
},
{
"path": "tests/3rdparty/glfw/src/x11_gamma.c",
"chars": 4888,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: X"
},
{
"path": "tests/3rdparty/glfw/src/x11_init.c",
"chars": 26114,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: X"
},
{
"path": "tests/3rdparty/glfw/src/x11_joystick.c",
"chars": 7238,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: X"
},
{
"path": "tests/3rdparty/glfw/src/x11_monitor.c",
"chars": 11491,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: X"
},
{
"path": "tests/3rdparty/glfw/src/x11_platform.h",
"chars": 8014,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: X"
},
{
"path": "tests/3rdparty/glfw/src/x11_time.c",
"chars": 2958,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: X"
},
{
"path": "tests/3rdparty/glfw/src/x11_unicode.c",
"chars": 21245,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: X"
},
{
"path": "tests/3rdparty/glfw/src/x11_window.c",
"chars": 36977,
"preview": "//========================================================================\n// GLFW - An OpenGL library\n// Platform: X"
},
{
"path": "tests/3rdparty/stb/stb_image.h",
"chars": 215882,
"preview": "/* stb_image - v2.02 - public domain image loader - http://nothings.org/stb_image.h\n "
},
{
"path": "tests/3rdparty/tinycthread/CMakeLists.txt",
"chars": 262,
"preview": "## Find source and headers\nFILE(GLOB HEADERS source/*.h)\nFILE(GLOB SOURCES source/*.c*)\n\nIF(CMAKE_HAS_SORT)\n LIST(SORT "
},
{
"path": "tests/3rdparty/tinycthread/README.txt",
"chars": 2065,
"preview": "TinyCThread v1.1\n================\n\nhttp://tinycthread.bitsnbites.eu\n\n\nAbout\n-----\n\nTinyCThread is a minimalist, portable"
},
{
"path": "tests/3rdparty/tinycthread/source/tinycthread.c",
"chars": 12852,
"preview": "/* -*- mode: c; tab-width: 2; indent-tabs-mode: nil; -*-\nCopyright (c) 2012 Marcus Geelnard\n\nThis software is provided '"
},
{
"path": "tests/3rdparty/tinycthread/source/tinycthread.h",
"chars": 15688,
"preview": "/* -*- mode: c; tab-width: 2; indent-tabs-mode: nil; -*-\nCopyright (c) 2012 Marcus Geelnard\n\nThis software is provided '"
},
{
"path": "tests/raster/CMakeLists.txt",
"chars": 957,
"preview": "## Find source and headers\nFILE(GLOB HEADERS\n *.h\n ${MTCL_INCLUDE_DIR}/*.h\n)\nFILE(GLOB SOURCES\n *.c*\n)\n\nIF(CMAKE_HAS_"
},
{
"path": "tests/raster/main.c",
"chars": 3307,
"preview": "/*======================================================================\n Maratis Tiny C Library\n version 1.0\n----------"
},
{
"path": "tests/raytracing/CMakeLists.txt",
"chars": 976,
"preview": "## Find source and headers\nFILE(GLOB HEADERS\n *.h\n ${MTCL_INCLUDE_DIR}/*.h\n)\nFILE(GLOB SOURCES\n *.c*\n)\n\nIF(CMAKE_HAS_"
},
{
"path": "tests/raytracing/main.c",
"chars": 6160,
"preview": "/*======================================================================\n Maratis Tiny C Library\n version 1.0\n----------"
},
{
"path": "tests/test.h",
"chars": 29070,
"preview": "/*======================================================================\n Maratis Tiny C Library\n version 1.0\n----------"
},
{
"path": "tests/vorogen/CMakeLists.txt",
"chars": 1049,
"preview": "## Find source and headers\nFILE(GLOB HEADERS\n *.h\n ${MTCL_INCLUDE_DIR}/*.h\n ${STB_INCLUDE_DIR}/*.h\n)\nFILE(GLOB SOURCE"
},
{
"path": "tests/vorogen/main.c",
"chars": 11036,
"preview": "/*======================================================================\n Maratis Tiny C Library\n version 1.0\n----"
},
{
"path": "tests/voronoi/CMakeLists.txt",
"chars": 961,
"preview": "## Find source and headers\nFILE(GLOB HEADERS\n *.h\n ${MTCL_INCLUDE_DIR}/*.h\n)\nFILE(GLOB SOURCES\n *.c*\n)\n\nIF(CMAKE_HAS_"
},
{
"path": "tests/voronoi/main.c",
"chars": 4012,
"preview": "/*======================================================================\n Maratis Tiny C Library\n version 1.0\n----"
}
]
// ... and 1 more files (download for full content)
About this extraction
This page contains the full source code of the anael-seghezzi/Maratis-Tiny-C-library GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 89 files (1.8 MB), approximately 563.6k tokens, and a symbol index with 1007 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.